From 6889f8ed879ea04c927a64fd6136a48b7810880b Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 23 Jun 2016 12:51:53 +0200 Subject: [PATCH] Fixed #33 and minor bugs --- plugin.yml | 3 +++ .../norbipeti/thebuttonmcchat/commands/TBMCCommandBase.java | 3 +++ .../commands/appendtext/AppendTextCommandBase.java | 6 ++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugin.yml b/plugin.yml index f0e04c8..6b5d833 100644 --- a/plugin.yml +++ b/plugin.yml @@ -25,6 +25,9 @@ commands: chatonly: description: Enable chat only mode. Useful for chat clients. usage: "&cUsage: /chatonly&r" + shrug: + description: Shrug. + usage: "&cUsage: /shrug [message]&r" author: NorbiPeti depend: [Essentials, Towny, Minigames, Votifier, WorldGuard, WorldEdit, ProtocolLib, FastLogin, Vault, AuthMe] permissions: diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/TBMCCommandBase.java b/src/io/github/norbipeti/thebuttonmcchat/commands/TBMCCommandBase.java index d2ac6bb..1615294 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/TBMCCommandBase.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/TBMCCommandBase.java @@ -3,6 +3,7 @@ package io.github.norbipeti.thebuttonmcchat.commands; import java.util.HashMap; import io.github.norbipeti.thebuttonmcchat.PluginMain; +import io.github.norbipeti.thebuttonmcchat.commands.appendtext.ShrugCommand; import io.github.norbipeti.thebuttonmcchat.commands.appendtext.TableflipCommand; import io.github.norbipeti.thebuttonmcchat.commands.appendtext.UnflipCommand; import io.github.norbipeti.thebuttonmcchat.commands.ucmds.UCommand; @@ -29,6 +30,8 @@ public abstract class TBMCCommandBase implements CommandExecutor { plugin.getCommand(cmd.GetCommandName()).setExecutor(cmd); cmd = new ChatonlyCommand(); plugin.getCommand(cmd.GetCommandName()).setExecutor(cmd); + cmd = new ShrugCommand(); + plugin.getCommand(cmd.GetCommandName()).setExecutor(cmd); } private static HashMap commands = new HashMap(); diff --git a/src/io/github/norbipeti/thebuttonmcchat/commands/appendtext/AppendTextCommandBase.java b/src/io/github/norbipeti/thebuttonmcchat/commands/appendtext/AppendTextCommandBase.java index 45c39d0..67061db 100644 --- a/src/io/github/norbipeti/thebuttonmcchat/commands/appendtext/AppendTextCommandBase.java +++ b/src/io/github/norbipeti/thebuttonmcchat/commands/appendtext/AppendTextCommandBase.java @@ -14,10 +14,8 @@ public abstract class AppendTextCommandBase extends TBMCCommandBase { @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { String msg = GetAppendedText(); - if (args.length > 0) { - msg = args[0] + " " + msg; - } else - msg = " " + msg; + for (int i = args.length - 1; i >= 0; i--) + msg = args[i] + " " + msg; ChatProcessing.ProcessChat(sender, msg); return true; }