From d13dfc3eb2b89cf968ebc66c0c1f930ccdb8b932 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Mon, 2 Jan 2017 00:03:56 +0100 Subject: [PATCH] Added /waitwhat or /ww --- .../chat/commands/WaitWhatCommand.java | 49 +++++++++++++++++++ src/main/resources/plugin.yml | 3 ++ 2 files changed, 52 insertions(+) create mode 100644 src/main/java/buttondevteam/chat/commands/WaitWhatCommand.java diff --git a/src/main/java/buttondevteam/chat/commands/WaitWhatCommand.java b/src/main/java/buttondevteam/chat/commands/WaitWhatCommand.java new file mode 100644 index 0000000..7d55fc4 --- /dev/null +++ b/src/main/java/buttondevteam/chat/commands/WaitWhatCommand.java @@ -0,0 +1,49 @@ +package buttondevteam.chat.commands; + +import java.util.Arrays; +import java.util.stream.Collectors; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import buttondevteam.chat.ChatPlayer; +import buttondevteam.lib.TBMCPlayer; +import buttondevteam.lib.chat.Channel; +import buttondevteam.lib.chat.TBMCChatAPI; +import buttondevteam.lib.chat.TBMCCommandBase; + +public class WaitWhatCommand extends TBMCCommandBase { + @Override + public boolean OnCommand(CommandSender sender, String alias, String[] args) { + Channel channel; + if (sender instanceof Player && ((Player) sender).isOnline()) + channel = TBMCPlayer.getPlayer((Player) sender).asPluginPlayer(ChatPlayer.class).CurrentChannel; + else + channel = Channel.GlobalChat; + final String message; + if (args.length == 0) + message = "wait what"; + else + message = "wait " + Arrays.stream(args).collect(Collectors.joining(" ")) + " what"; + TBMCChatAPI.SendChatMessage(channel, sender, message); + return true; + } + + @Override + public String[] GetHelpText(String alias) { + return new String[] { // + "ยง6--- Wait what ----", // + "Wait what" // + }; + } + + @Override + public boolean GetPlayerOnly() { + return false; + } + + @Override + public boolean GetModOnly() { + return false; + } +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 0358249..e7e3e4e 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -23,6 +23,9 @@ commands: description: Shrug. yeehaw: description: This command makes you yeehaw. + waitwhat: + description: Wait what. + aliases: ww author: NorbiPeti depend: - Essentials