Skip to content

Commit

Permalink
Add expectPlayerChat, a way to expect for messages on the chat
Browse files Browse the repository at this point in the history
  • Loading branch information
EverNife committed Oct 11, 2024
1 parent 1c8bef8 commit b13cbc2
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import br.com.finalcraft.evernifecore.EverNifeCore;
import br.com.finalcraft.evernifecore.autoupdater.SpigotUpdateChecker;
import br.com.finalcraft.evernifecore.chatmenuapi.menu.element.InputElement;
import br.com.finalcraft.evernifecore.commands.finalcmd.executor.FCDefaultExecutor;
import br.com.finalcraft.evernifecore.commands.finalcmd.help.HelpContext;
import br.com.finalcraft.evernifecore.config.playerdata.PlayerController;
Expand Down Expand Up @@ -43,7 +44,8 @@ public static void initialize(JavaPlugin instance){
HelpContext.class,
FCDefaultExecutor.class,
PageViewer.class,
DefaultIcons.class
DefaultIcons.class,
InputElement.class
);
FCLocaleManager.updateEverNifeCoreLocale();

Expand Down
56 changes: 56 additions & 0 deletions src/main/java/br/com/finalcraft/evernifecore/util/FCChatUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package br.com.finalcraft.evernifecore.util;

import br.com.finalcraft.evernifecore.chatmenuapi.listeners.CMListener;
import br.com.finalcraft.evernifecore.chatmenuapi.listeners.expectedchat.ExpectedChat;
import br.com.finalcraft.evernifecore.chatmenuapi.menu.ChatMenuAPI;
import org.bukkit.entity.Player;

public class FCChatUtil {

/**
* Expect a player's to chat a message.
*
* @param player The player to expect a chat from.
* @param chatAction The action to perform when the player chats.
*/
public static ExpectedChat expectPlayerChat(Player player, CMListener.IChatAction chatAction) {
return ChatMenuAPI.getChatListener().expectPlayerChat(player, chatAction, 0, null, null);
}

/**
* Expect a player's to chat a message.
*
* @param player The player to expect a chat from.
* @param chatAction The action to perform when the player chats.
* @param expiration The time in milliseconds the wait for the chat.
*/
public static ExpectedChat expectPlayerChat(Player player, CMListener.IChatAction chatAction, long expiration) {
return ChatMenuAPI.getChatListener().expectPlayerChat(player, chatAction, expiration, null, null);
}

/**
* Expect a player's to chat a message.
*
* @param player The player to expect a chat from.
* @param chatAction The action to perform when the player chats.
* @param expiration The time in milliseconds the wait for the chat.
* @param onExpireAction The action to perform when the chat expires.
*/
public static ExpectedChat expectPlayerChat(Player player, CMListener.IChatAction chatAction, long expiration, Runnable onExpireAction) {
return ChatMenuAPI.getChatListener().expectPlayerChat(player, chatAction, expiration, onExpireAction, null);
}

/**
* Expect a player's to chat a message.
*
* @param player The player to expect a chat from.
* @param chatAction The action to perform when the player chats.
* @param expiration The time in milliseconds the wait for the chat.
* @param onExpireAction The action to perform when the chat expires.
* @param onPlayerQuitAction The action to perform when the player quits.
*/
public static ExpectedChat expectPlayerChat(Player player, CMListener.IChatAction chatAction, long expiration, Runnable onExpireAction, Runnable onPlayerQuitAction) {
return ChatMenuAPI.getChatListener().expectPlayerChat(player, chatAction, expiration, onExpireAction, onPlayerQuitAction);
}

}

0 comments on commit b13cbc2

Please sign in to comment.