From 8f69e40d8b151e26361ec7a36bfff1b7de9a5221 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 28 Apr 2017 16:00:05 +0200 Subject: [PATCH] Removed http error post and continued cmds --- src/main/java/buttondevteam/chat/PluginMain.java | 3 ++- .../chat/commands/ucmds/AcceptCommand.java | 2 +- .../chat/commands/ucmds/CCommand.java | 2 ++ .../chat/commands/ucmds/HelpCommand.java | 16 ++++------------ .../chat/commands/ucmds/IgnoreCommand.java | 9 ++++----- .../chat/commands/ucmds/InfoCommand.java | 12 ++---------- .../chat/commands/ucmds/OpmeCommand.java | 8 +++----- 7 files changed, 18 insertions(+), 34 deletions(-) diff --git a/src/main/java/buttondevteam/chat/PluginMain.java b/src/main/java/buttondevteam/chat/PluginMain.java index e1d3363..87c740d 100644 --- a/src/main/java/buttondevteam/chat/PluginMain.java +++ b/src/main/java/buttondevteam/chat/PluginMain.java @@ -168,7 +168,8 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15. errorcount++; if (errorcount >= 10) { errorcount = 0; - TBMCCoreAPI.SendException("Error while getting flairs from Reddit!", e); + if (!e.getMessage().contains("Server returned HTTP response code")) + TBMCCoreAPI.SendException("Error while getting flairs from Reddit!", e); } } } diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/AcceptCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/AcceptCommand.java index 69cca30..a588b6c 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/AcceptCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/AcceptCommand.java @@ -15,7 +15,7 @@ import buttondevteam.lib.chat.OptionallyPlayerCommandClass; import buttondevteam.lib.player.TBMCPlayer; @CommandClass(modOnly = false) -@OptionallyPlayerCommandClass(playerOnly = false) +@OptionallyPlayerCommandClass(playerOnly = true) public class AcceptCommand extends UCommandBase { @Override diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/CCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/CCommand.java index 50a29e1..1a61844 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/CCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/CCommand.java @@ -8,6 +8,8 @@ import buttondevteam.chat.PluginMain; import buttondevteam.lib.chat.*; import buttondevteam.lib.player.TBMCPlayer; +@CommandClass(modOnly = false) +@OptionallyPlayerCommandClass(playerOnly = true) public class CCommand extends UCommandBase { @Override diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java index 4f62fc6..8be549e 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/HelpCommand.java @@ -6,9 +6,11 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import buttondevteam.chat.PluginMain; +import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.chat.TBMCCommandBase; +@CommandClass(modOnly = false) public final class HelpCommand extends UCommandBase { @Override @@ -35,8 +37,8 @@ public final class HelpCommand extends UCommandBase { ArrayList text = new ArrayList(); text.add("ยง6---- Command list ----"); for (TBMCCommandBase cmd : TBMCChatAPI.GetCommands().values()) - if (!cmd.GetModOnly() || PluginMain.permission.has(sender, "tbmc.admin")) - if (!cmd.GetPlayerOnly() || sender instanceof Player) + if (!cmd.getClass().getAnnotation(CommandClass.class).modOnly() || PluginMain.permission.has(sender, "tbmc.admin")) + if (!cmd.isPlayerOnly() || sender instanceof Player) if (!cmd.GetCommandPath().contains(" ")) text.add("/" + cmd.GetCommandPath()); else { @@ -79,14 +81,4 @@ public final class HelpCommand extends UCommandBase { return true; } - - @Override - public String GetUCommandPath() { - return "help"; - } - - @Override - public boolean GetPlayerOnly() { - return false; - } } diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/IgnoreCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/IgnoreCommand.java index b93f59c..9e333db 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/IgnoreCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/IgnoreCommand.java @@ -5,8 +5,12 @@ import org.bukkit.entity.Player; import buttondevteam.chat.ChatPlayer; import buttondevteam.chat.FlairStates; +import buttondevteam.lib.chat.CommandClass; +import buttondevteam.lib.chat.OptionallyPlayerCommandClass; import buttondevteam.lib.player.TBMCPlayer; +@CommandClass(modOnly = false) +@OptionallyPlayerCommandClass(playerOnly = true) public final class IgnoreCommand extends UCommandBase { @Override @@ -38,9 +42,4 @@ public final class IgnoreCommand extends UCommandBase { return true; } - @Override - public String GetUCommandPath() { - return "ignore"; - } - } diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/InfoCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/InfoCommand.java index 3303884..4a61d4a 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/InfoCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/InfoCommand.java @@ -3,10 +3,12 @@ package buttondevteam.chat.commands.ucmds; import org.bukkit.command.CommandSender; import buttondevteam.lib.TBMCCoreAPI; +import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.player.TBMCPlayer; import buttondevteam.lib.player.ChromaGamerBase.InfoTarget; import buttondevteam.lib.player.TBMCPlayerBase; +@CommandClass(modOnly = false) public class InfoCommand extends UCommandBase { @Override @@ -18,11 +20,6 @@ public class InfoCommand extends UCommandBase { }; } - @Override - public String GetUCommandPath() { - return "info"; - } - @Override public boolean OnCommand(CommandSender sender, String alias, String[] args) { if (args.length == 0) @@ -44,9 +41,4 @@ public class InfoCommand extends UCommandBase { } return true; } - - @Override - public boolean GetPlayerOnly() { - return false; - } } diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/OpmeCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/OpmeCommand.java index 9be3239..adc2096 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/OpmeCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/OpmeCommand.java @@ -2,6 +2,9 @@ package buttondevteam.chat.commands.ucmds; import org.bukkit.command.CommandSender; +import buttondevteam.lib.chat.CommandClass; + +@CommandClass(modOnly = false) public class OpmeCommand extends UCommandBase { @Override @@ -15,9 +18,4 @@ public class OpmeCommand extends UCommandBase { return true; } - @Override - public String GetUCommandPath() { - return "opme"; - } - }