diff --git a/pom.xml b/pom.xml
index 8bbeeb6..00fa483 100644
--- a/pom.xml
+++ b/pom.xml
@@ -169,6 +169,11 @@
javassist
3.20.0-GA
+
+ com.github.TBMCPlugins
+ DiscordPlugin
+ master-SNAPSHOT
+
ButtonChat
diff --git a/src/main/java/buttondevteam/chat/PluginMain.java b/src/main/java/buttondevteam/chat/PluginMain.java
index 29804a8..a45cfde 100644
--- a/src/main/java/buttondevteam/chat/PluginMain.java
+++ b/src/main/java/buttondevteam/chat/PluginMain.java
@@ -64,39 +64,13 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
@Override
public void onEnable() {
Instance = this;
- /*try {
- PluginMain.Instance.getLogger().info("Extracting necessary libraries...");
- final File[] libs = new File[] { new File(getDataFolder(), "htmlcleaner-2.16.jar"),
- new File(getDataFolder(), "reflections-0.9.10.jar"),
- new File(getDataFolder(), "javassist-3.19.0-GA.jar") };
- for (final File lib : libs) {
- if (!lib.exists()) {
- JarUtils.extractFromJar(lib.getName(), lib.getAbsolutePath());
- }
- }
- for (final File lib : libs) {
- if (!lib.exists()) {
- getLogger().warning("Failed to load plugin! Could not find lib: " + lib.getName());
- Bukkit.getServer().getPluginManager().disablePlugin(this);
- return;
- }
- addClassPath(JarUtils.getJarUrl(lib));
- }
- } catch (final Exception e) {
- e.printStackTrace();
- }*/
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
CommandCaller.RegisterChatCommands(this);
Console = this.getServer().getConsoleSender();
LoadFiles(false);
- SB = PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard(); // Main
- // can
- // be
- // detected
- // with
- // @a[score_...]
+ SB = PluginMain.Instance.getServer().getScoreboardManager().getMainScoreboard(); // Main can be detected with @a[score_...]
if (SB.getObjective("town") == null)
SB.registerNewObjective("town", "dummy");
if (SB.getObjective("nation") == null)
@@ -134,7 +108,7 @@ public class PluginMain extends JavaPlugin { // Translated to Java: 2015.07.15.
// Fired when plugin is disabled
@Override
public void onDisable() {
- SaveFiles(); // 2015.08.09.
+ SaveFiles();
stop = true;
}
diff --git a/src/main/java/buttondevteam/chat/commands/CommandCaller.java b/src/main/java/buttondevteam/chat/commands/CommandCaller.java
index d4d2dc8..96dfae8 100644
--- a/src/main/java/buttondevteam/chat/commands/CommandCaller.java
+++ b/src/main/java/buttondevteam/chat/commands/CommandCaller.java
@@ -19,6 +19,7 @@ import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
import buttondevteam.chat.PluginMain;
+import buttondevteam.discordplugin.TBMCDiscordAPI;
public class CommandCaller implements CommandExecutor {
@@ -94,9 +95,13 @@ public class CommandCaller implements CommandExecutor {
sender.sendMessage("§cOnly ingame players can use this command.");
return true;
}
- if (!cmd.OnCommand(sender, alias,
- (args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args)))
- sender.sendMessage(cmd.GetHelpText(alias));
+ try {
+ if (!cmd.OnCommand(sender, alias,
+ (args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args)))
+ sender.sendMessage(cmd.GetHelpText(alias));
+ } catch (Exception e) {
+ TBMCDiscordAPI.SendException(e, "Failed to execute command " + cmd.GetCommandPath() + " with arguments ");
+ }
return true;
}