diff --git a/src/main/java/br/com/finalcraft/evernifecore/config/ConfigManager.java b/src/main/java/br/com/finalcraft/evernifecore/config/ConfigManager.java index 48f1afae..b6d77b4d 100644 --- a/src/main/java/br/com/finalcraft/evernifecore/config/ConfigManager.java +++ b/src/main/java/br/com/finalcraft/evernifecore/config/ConfigManager.java @@ -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; @@ -43,7 +44,8 @@ public static void initialize(JavaPlugin instance){ HelpContext.class, FCDefaultExecutor.class, PageViewer.class, - DefaultIcons.class + DefaultIcons.class, + InputElement.class ); FCLocaleManager.updateEverNifeCoreLocale(); diff --git a/src/main/java/br/com/finalcraft/evernifecore/util/FCChatUtil.java b/src/main/java/br/com/finalcraft/evernifecore/util/FCChatUtil.java new file mode 100644 index 00000000..e0a5b5a5 --- /dev/null +++ b/src/main/java/br/com/finalcraft/evernifecore/util/FCChatUtil.java @@ -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); + } + +}