From 57f15694ada170fed5c54e6abc0b2736c5536ff4 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 4 Dec 2016 20:07:02 +0100 Subject: [PATCH] Applied changes --- .../chat/commands/CommandCaller.java | 2 +- .../chat/commands/ucmds/HelpCommand.java | 6 +++- .../chat/commands/ucmds/UCommand.java | 34 ------------------- .../commands/ucmds/admin/AdminCommand.java | 34 ------------------- .../ucmds/announce/AnnounceCommand.java | 29 ---------------- 5 files changed, 6 insertions(+), 99 deletions(-) delete mode 100644 src/main/java/buttondevteam/chat/commands/ucmds/UCommand.java delete mode 100644 src/main/java/buttondevteam/chat/commands/ucmds/admin/AdminCommand.java delete mode 100644 src/main/java/buttondevteam/chat/commands/ucmds/announce/AnnounceCommand.java diff --git a/src/main/java/buttondevteam/chat/commands/CommandCaller.java b/src/main/java/buttondevteam/chat/commands/CommandCaller.java index 1caf456..dfda9de 100644 --- a/src/main/java/buttondevteam/chat/commands/CommandCaller.java +++ b/src/main/java/buttondevteam/chat/commands/CommandCaller.java @@ -75,7 +75,7 @@ public class CommandCaller implements CommandExecutor { } if (cmd == null) { if (hadspace) { - sender.sendMessage(TBMCChatAPI.GetSubCommands(path)); + sender.sendMessage(TBMCChatAPI.GetSubCommands(path, sender)); return true; } String[] errormsg = new String[] { // diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java index 251de6f..ad9874c 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java @@ -3,7 +3,9 @@ package buttondevteam.chat.commands.ucmds; import java.util.ArrayList; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import buttondevteam.chat.PluginMain; import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.chat.TBMCCommandBase; @@ -34,7 +36,9 @@ public final class HelpCommand extends UCommandBase { text.add("§6---- Command list ----"); for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values()) if (!cmd.GetCommandPath().contains(" ")) - text.add("/" + cmd.GetCommandPath()); + if (!cmd.GetModOnly() || PluginMain.permission.has(sender, "tbmc.admin")) + if (!cmd.GetPlayerOnly() || sender instanceof Player) + text.add("/" + cmd.GetCommandPath()); sender.sendMessage(text.toArray(new String[text.size()])); } else if (args[0].equalsIgnoreCase("colors")) { sender.sendMessage(new String[] { "§6---- Chat colors/formats ----", // diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/UCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/UCommand.java deleted file mode 100644 index 85b901d..0000000 --- a/src/main/java/buttondevteam/chat/commands/ucmds/UCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -package buttondevteam.chat.commands.ucmds; - -import org.bukkit.command.CommandSender; - -import buttondevteam.lib.chat.TBMCChatAPI; -import buttondevteam.lib.chat.TBMCCommandBase; - -public final class UCommand extends TBMCCommandBase { - - @Override - public String[] GetHelpText(String alias) { - return TBMCChatAPI.GetSubCommands(this); - } - - @Override - public boolean OnCommand(CommandSender sender, String alias, String[] args) { - return false; - } - - @Override - public String GetCommandPath() { - return "u"; - } - - @Override - public boolean GetPlayerOnly() { - return false; - } - - @Override - public boolean GetModOnly() { - return false; - } -} diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/admin/AdminCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/admin/AdminCommand.java deleted file mode 100644 index 46f285c..0000000 --- a/src/main/java/buttondevteam/chat/commands/ucmds/admin/AdminCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -package buttondevteam.chat.commands.ucmds.admin; - -import org.bukkit.command.CommandSender; - -import buttondevteam.chat.commands.ucmds.UCommandBase; -import buttondevteam.lib.chat.TBMCChatAPI; - -public final class AdminCommand extends UCommandBase { - - @Override - public String[] GetHelpText(String alias) { - return TBMCChatAPI.GetSubCommands(this); - } - - @Override - public boolean OnCommand(CommandSender sender, String alias, String[] args) { - return false; - } - - @Override - public String GetUCommandPath() { - return "admin"; - } - - @Override - public boolean GetPlayerOnly() { - return false; - } - - @Override - public boolean GetModOnly() { - return true; - } -} diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/announce/AnnounceCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/announce/AnnounceCommand.java deleted file mode 100644 index 623c3c8..0000000 --- a/src/main/java/buttondevteam/chat/commands/ucmds/announce/AnnounceCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -package buttondevteam.chat.commands.ucmds.announce; - -import org.bukkit.command.CommandSender; - -import buttondevteam.chat.commands.ucmds.UCommandBase; -import buttondevteam.lib.chat.TBMCChatAPI; - -public class AnnounceCommand extends UCommandBase { - - @Override - public String[] GetHelpText(String alias) { - return TBMCChatAPI.GetSubCommands(this); - } - - @Override - public boolean OnCommand(CommandSender sender, String alias, String[] args) { - return false; - } - - @Override - public String GetUCommandPath() { - return "announce"; - } - - @Override - public boolean GetPlayerOnly() { - return false; - } -}