diff --git a/BuildConfigUpdater/BuildConfigUpdater.iml b/BuildConfigUpdater/BuildConfigUpdater.iml index 4902d56..f14440c 100644 --- a/BuildConfigUpdater/BuildConfigUpdater.iml +++ b/BuildConfigUpdater/BuildConfigUpdater.iml @@ -20,6 +20,7 @@ + diff --git a/ButtonCore/pom.xml b/ButtonCore/pom.xml index 2bbce2d..e044b9a 100755 --- a/ButtonCore/pom.xml +++ b/ButtonCore/pom.xml @@ -1,200 +1,200 @@ - - 4.0.0 - - com.github.TBMCPlugins - ButtonCore - master-SNAPSHOT - - com.github.TBMCPlugins.ButtonCore - ButtonCore - ButtonCore - ButtonCore - - src/main/java - - - src/main/resources - - *.properties - *.yml - *.csv - *.txt - - true - - - ButtonCore - - - maven-compiler-plugin - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-shade-plugin - 2.4.2 - - - package - - shade - - - - - - - - - - org.apache.maven.plugins - maven-resources-plugin - 3.0.1 - - - copy - compile - - copy-resources - - - target - - - src/main/resources - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - - - jitpack.io - https://jitpack.io/ - - - vault-repo - http://nexus.hc.to/content/repositories/pub_releases - - - ess-repo - http://repo.ess3.net/content/repositories/essrel/ - - - - - org.reflections - reflections - 0.9.10 - compile - - - org.spigotmc - spigot-api - 1.12.2-R0.1-SNAPSHOT - provided - - - - commons-io - commons-io - 1.3.2 - provided - - - - com.github.TBMCPlugins.ButtonCore - Towny - master-SNAPSHOT - provided - - - com.github.milkbowl - VaultAPI - master-SNAPSHOT - provided - - - - org.javassist - javassist - 3.20.0-GA - - - org.mockito - mockito-core - 2.7.20 - - - - org.projectlombok - lombok - 1.16.16 - provided - - - com.github.TBMCPlugins.ButtonCore - ButtonProcessor - master-SNAPSHOT - provided - - - net.ess3 - Essentials - 2.13.1 - provided - - - - TBMCPlugins - https://github.com/TBMCPlugins - - - - internal.repo - Temporary Staging Repository - file://${project.build.directory}/mvn-repo/${project.name} - - - - - github - UTF-8 - - - https://github.com/TBMCPlugins/mvn-repo - scm:git:https://github.com/TBMCPlugins/mvn-repo.git - scm:git:https://github.com/TBMCPlugins/mvn-repo.git - + + 4.0.0 + + com.github.TBMCPlugins + ButtonCore + master-SNAPSHOT + + com.github.TBMCPlugins.ButtonCore + ButtonCore + ButtonCore + ButtonCore + + src/main/java + + + src/main/resources + + *.properties + *.yml + *.csv + *.txt + + true + + + ButtonCore + + + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-shade-plugin + 2.4.2 + + + package + + shade + + + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.0.1 + + + copy + compile + + copy-resources + + + target + + + src/main/resources + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + jitpack.io + https://jitpack.io/ + + + vault-repo + http://nexus.hc.to/content/repositories/pub_releases + + + ess-repo + http://repo.ess3.net/content/repositories/essrel/ + + + + + org.reflections + reflections + 0.9.10 + compile + + + org.spigotmc + spigot-api + 1.12.2-R0.1-SNAPSHOT + provided + + + + commons-io + commons-io + 1.3.2 + provided + + + + com.github.TBMCPlugins.ButtonCore + Towny + master-SNAPSHOT + provided + + + com.github.milkbowl + VaultAPI + master-SNAPSHOT + provided + + + + org.javassist + javassist + 3.20.0-GA + + + org.mockito + mockito-core + 2.7.20 + + + + org.projectlombok + lombok + 1.16.16 + provided + + + com.github.TBMCPlugins.ButtonCore + ButtonProcessor + master-SNAPSHOT + compile + + + net.ess3 + Essentials + 2.13.1 + provided + + + + TBMCPlugins + https://github.com/TBMCPlugins + + + + internal.repo + Temporary Staging Repository + file://${project.build.directory}/mvn-repo/${project.name} + + + + + github + UTF-8 + + + https://github.com/TBMCPlugins/mvn-repo + scm:git:https://github.com/TBMCPlugins/mvn-repo.git + scm:git:https://github.com/TBMCPlugins/mvn-repo.git + \ No newline at end of file diff --git a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java index d15d2a9..b2200a4 100755 --- a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java +++ b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java @@ -132,6 +132,7 @@ public class MainPlugin extends ButtonPlugin { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (command.getName().equals("dontrunthiscmd")) return true; //Used in chat preprocess for console sender.sendMessage("§cThis command isn't available."); //In theory, unregistered commands use this method return true; } diff --git a/ButtonCore/src/main/java/buttondevteam/lib/architecture/ButtonPlugin.java b/ButtonCore/src/main/java/buttondevteam/lib/architecture/ButtonPlugin.java index bc0e46d..5b26d9d 100644 --- a/ButtonCore/src/main/java/buttondevteam/lib/architecture/ButtonPlugin.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/architecture/ButtonPlugin.java @@ -21,8 +21,17 @@ public abstract class ButtonPlugin extends JavaPlugin { protected abstract void pluginEnable(); + /** + * Called after the components are unregistered + */ protected abstract void pluginDisable(); + /** + * Called before the components are unregistered + */ + protected void pluginPreDisable() { + } + @Override public final void onEnable() { var section = super.getConfig().getConfigurationSection("global"); @@ -38,6 +47,7 @@ public abstract class ButtonPlugin extends JavaPlugin { @Override public final void onDisable() { try { + pluginPreDisable(); ComponentManager.unregComponents(this); pluginDisable(); saveConfig(); diff --git a/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java b/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java index 6ca2bbe..1a3a11f 100644 --- a/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java @@ -62,6 +62,18 @@ public class ConfigData { //TODO: Save after a while if (hmm == null) hmm = def; //Set if the getter returned null return hmm; } + if (val instanceof Number) { + if (def instanceof Long) + val = ((Number) val).longValue(); + else if (def instanceof Short) + val = ((Number) val).shortValue(); + else if (def instanceof Byte) + val = ((Number) val).byteValue(); + else if (def instanceof Float) + val = ((Number) val).floatValue(); + else if (def instanceof Double) + val = ((Number) val).doubleValue(); + } return (T) val; } diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/Command2.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/Command2.java index cb77556..c16d318 100644 --- a/ButtonCore/src/main/java/buttondevteam/lib/chat/Command2.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/chat/Command2.java @@ -174,12 +174,12 @@ public abstract class Command2 { } private static String[] getHelpText(Method method, String[] ht, String subcommand) { //TODO: helpText[0]="§6---- "+helpText[0]+" ----"; - val str = Command2.class.getResourceAsStream("/commands.yml"); + val str = method.getDeclaringClass().getResourceAsStream("/commands.yml"); if (str == null) TBMCCoreAPI.SendException("Error while getting command data!", new Exception("Resource not found!")); else { YamlConfiguration yc = YamlConfiguration.loadConfiguration(new InputStreamReader(str)); //Generated by ButtonProcessor - val ccs = yc.getConfigurationSection(method.getDeclaringClass().getName()); + val ccs = yc.getConfigurationSection(method.getDeclaringClass().getCanonicalName()); if (ccs != null) { val cs = ccs.getConfigurationSection(method.getName()); if (cs != null) { @@ -191,11 +191,11 @@ public abstract class Command2 { both[ht.length] = "Usage: " + subcommand + " " + params; ht = both; } else - TBMCCoreAPI.SendException("Error while getting command data!", new Exception("Method '" + method.toString() + "' != " + mname + " or params is " + params)); + TBMCCoreAPI.SendException("Error while getting command data for " + method + "!", new Exception("Method '" + method.toString() + "' != " + mname + " or params is " + params)); } else - TBMCCoreAPI.SendException("Error while getting command data!", new Exception("cs is " + cs)); + TBMCCoreAPI.SendException("Error while getting command data for " + method + "!", new Exception("cs is " + cs)); } else - TBMCCoreAPI.SendException("Error while getting command data!", new Exception("ccs is " + ccs)); + TBMCCoreAPI.SendException("Error while getting command data for " + method + "!", new Exception("ccs is " + ccs + " - class: " + method.getDeclaringClass().getCanonicalName())); } return ht; } diff --git a/ButtonProcessor/pom.xml b/ButtonProcessor/pom.xml index ccc6888..975ead3 100755 --- a/ButtonProcessor/pom.xml +++ b/ButtonProcessor/pom.xml @@ -1,6 +1,12 @@ 4.0.0 + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + org.yaml