From eb9deb39b44f8e48e041a8213b7fd526cfa515a4 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 6 May 2018 00:47:45 +0200 Subject: [PATCH 1/4] Rainbow rooms & [g]->[OOC] - Added all the rainbow chat rooms - Global chat renamed to OOC (out-of-characeter) --- .idea/ButtonCore.iml | 13 +++++++++++++ .idea/compiler.xml | 19 +++++++++++++++++++ .idea/encodings.xml | 7 +++++++ ...tonCore_Towny_master_v1_0_gc1751b8_228.xml | 13 +++++++++++++ ..._milkbowl_VaultAPI_master_8dc0859cba_1.xml | 13 +++++++++++++ ...google_code_findbugs_annotations_2_0_1.xml | 13 +++++++++++++ ...Maven__com_google_code_gson_gson_2_2_4.xml | 13 +++++++++++++ .../Maven__com_google_guava_guava_15_0.xml | 13 +++++++++++++ ...oglecode_json_simple_json_simple_1_1_1.xml | 13 +++++++++++++ .../Maven__commons_io_commons_io_1_3_2.xml | 13 +++++++++++++ .../Maven__commons_lang_commons_lang_2_6.xml | 13 +++++++++++++ ..._javax_persistence_persistence_api_1_0.xml | 13 +++++++++++++ .idea/libraries/Maven__junit_junit_3_8_1.xml | 13 +++++++++++++ ...Maven__net_bytebuddy_byte_buddy_1_6_11.xml | 13 +++++++++++++ ..._net_bytebuddy_byte_buddy_agent_1_6_11.xml | 13 +++++++++++++ ..._net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml | 13 +++++++++++++ .../Maven__org_avaje_ebean_2_8_1.xml | 13 +++++++++++++ ...n__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml | 13 +++++++++++++ ...ven__org_javassist_javassist_3_20_0_GA.xml | 13 +++++++++++++ ...Maven__org_mockito_mockito_core_2_7_20.xml | 13 +++++++++++++ .../Maven__org_objenesis_objenesis_2_5.xml | 13 +++++++++++++ ...aven__org_projectlombok_lombok_1_16_16.xml | 13 +++++++++++++ ...en__org_reflections_reflections_0_9_10.xml | 13 +++++++++++++ ...pigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml | 13 +++++++++++++ .../Maven__org_yaml_snakeyaml_1_15.xml | 13 +++++++++++++ .idea/misc.xml | 11 +++++++++++ .idea/modules.xml | 10 ++++++++++ .idea/vcs.xml | 6 ++++++ .../java/buttondevteam/core/MainPlugin.java | 18 ++++++++++++------ .../buttondevteam/core/PlayerListener.java | 7 +++---- .../lib/TBMCChatPreprocessEvent.java | 4 ++-- .../java/buttondevteam/lib/chat/Channel.java | 14 ++++++++------ ButtonProcessor/ButtonProcessor.iml | 16 ++++++++++++++++ 33 files changed, 393 insertions(+), 18 deletions(-) create mode 100644 .idea/ButtonCore.iml create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/libraries/Maven__com_github_TBMCPlugins_ButtonCore_Towny_master_v1_0_gc1751b8_228.xml create mode 100644 .idea/libraries/Maven__com_github_milkbowl_VaultAPI_master_8dc0859cba_1.xml create mode 100644 .idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml create mode 100644 .idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml create mode 100644 .idea/libraries/Maven__com_google_guava_guava_15_0.xml create mode 100644 .idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml create mode 100644 .idea/libraries/Maven__commons_io_commons_io_1_3_2.xml create mode 100644 .idea/libraries/Maven__commons_lang_commons_lang_2_6.xml create mode 100644 .idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml create mode 100644 .idea/libraries/Maven__junit_junit_3_8_1.xml create mode 100644 .idea/libraries/Maven__net_bytebuddy_byte_buddy_1_6_11.xml create mode 100644 .idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_6_11.xml create mode 100644 .idea/libraries/Maven__net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml create mode 100644 .idea/libraries/Maven__org_avaje_ebean_2_8_1.xml create mode 100644 .idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml create mode 100644 .idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml create mode 100644 .idea/libraries/Maven__org_mockito_mockito_core_2_7_20.xml create mode 100644 .idea/libraries/Maven__org_objenesis_objenesis_2_5.xml create mode 100644 .idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml create mode 100644 .idea/libraries/Maven__org_reflections_reflections_0_9_10.xml create mode 100644 .idea/libraries/Maven__org_spigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml create mode 100644 .idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 ButtonProcessor/ButtonProcessor.iml diff --git a/.idea/ButtonCore.iml b/.idea/ButtonCore.iml new file mode 100644 index 0000000..c32b2ad --- /dev/null +++ b/.idea/ButtonCore.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..e9bdc8a --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..3cbcad3 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_github_TBMCPlugins_ButtonCore_Towny_master_v1_0_gc1751b8_228.xml b/.idea/libraries/Maven__com_github_TBMCPlugins_ButtonCore_Towny_master_v1_0_gc1751b8_228.xml new file mode 100644 index 0000000..f3ec3e7 --- /dev/null +++ b/.idea/libraries/Maven__com_github_TBMCPlugins_ButtonCore_Towny_master_v1_0_gc1751b8_228.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_github_milkbowl_VaultAPI_master_8dc0859cba_1.xml b/.idea/libraries/Maven__com_github_milkbowl_VaultAPI_master_8dc0859cba_1.xml new file mode 100644 index 0000000..2f453df --- /dev/null +++ b/.idea/libraries/Maven__com_github_milkbowl_VaultAPI_master_8dc0859cba_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml b/.idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml new file mode 100644 index 0000000..a3d1316 --- /dev/null +++ b/.idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml new file mode 100644 index 0000000..4533c1b --- /dev/null +++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_guava_guava_15_0.xml b/.idea/libraries/Maven__com_google_guava_guava_15_0.xml new file mode 100644 index 0000000..8ae2de1 --- /dev/null +++ b/.idea/libraries/Maven__com_google_guava_guava_15_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml new file mode 100644 index 0000000..f3f3738 --- /dev/null +++ b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml b/.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml new file mode 100644 index 0000000..7b5b3b7 --- /dev/null +++ b/.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml new file mode 100644 index 0000000..2ec8376 --- /dev/null +++ b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml b/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml new file mode 100644 index 0000000..e60370e --- /dev/null +++ b/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__junit_junit_3_8_1.xml b/.idea/libraries/Maven__junit_junit_3_8_1.xml new file mode 100644 index 0000000..71b2993 --- /dev/null +++ b/.idea/libraries/Maven__junit_junit_3_8_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_6_11.xml b/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_6_11.xml new file mode 100644 index 0000000..b956618 --- /dev/null +++ b/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_6_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_6_11.xml b/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_6_11.xml new file mode 100644 index 0000000..dbbe456 --- /dev/null +++ b/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_6_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml new file mode 100644 index 0000000..51bddd3 --- /dev/null +++ b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml b/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml new file mode 100644 index 0000000..91f161a --- /dev/null +++ b/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml new file mode 100644 index 0000000..2fb4911 --- /dev/null +++ b/.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml b/.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml new file mode 100644 index 0000000..c21c9b0 --- /dev/null +++ b/.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_mockito_mockito_core_2_7_20.xml b/.idea/libraries/Maven__org_mockito_mockito_core_2_7_20.xml new file mode 100644 index 0000000..db215ab --- /dev/null +++ b/.idea/libraries/Maven__org_mockito_mockito_core_2_7_20.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_objenesis_objenesis_2_5.xml b/.idea/libraries/Maven__org_objenesis_objenesis_2_5.xml new file mode 100644 index 0000000..57448b4 --- /dev/null +++ b/.idea/libraries/Maven__org_objenesis_objenesis_2_5.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml b/.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml new file mode 100644 index 0000000..66c713e --- /dev/null +++ b/.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_reflections_reflections_0_9_10.xml b/.idea/libraries/Maven__org_reflections_reflections_0_9_10.xml new file mode 100644 index 0000000..d92ca0d --- /dev/null +++ b/.idea/libraries/Maven__org_reflections_reflections_0_9_10.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml new file mode 100644 index 0000000..19b00a4 --- /dev/null +++ b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml new file mode 100644 index 0000000..02d9152 --- /dev/null +++ b/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..9896aeb --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b7b1c7d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ 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 2762a48..b6a744f 100644 --- a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java +++ b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java @@ -1,10 +1,5 @@ package buttondevteam.core; -import java.util.logging.Logger; - -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.chat.Channel; import buttondevteam.lib.chat.ChatRoom; @@ -12,6 +7,11 @@ import buttondevteam.lib.chat.Color; import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.player.TBMCPlayerBase; import net.milkbowl.vault.permission.Permission; +import org.bukkit.plugin.PluginDescriptionFile; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.java.JavaPlugin; + +import java.util.logging.Logger; public class MainPlugin extends JavaPlugin { public static MainPlugin Instance; @@ -34,13 +34,19 @@ public class MainPlugin extends JavaPlugin { TBMCChatAPI.AddCommand(this, ScheduledRestartCommand.class); TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this); TBMCCoreAPI.RegisterUserClass(TBMCPlayerBase.class); - TBMCChatAPI.RegisterChatChannel(Channel.GlobalChat = new Channel("§fg§f", Color.White, "g", null)); + TBMCChatAPI.RegisterChatChannel(Channel.GlobalChat = new Channel("§fOOC§f", Color.White, "ooc", null)); + Channel.GlobalChat.IDs = new String[]{"g"}; //Support /g as well TBMCChatAPI.RegisterChatChannel( Channel.AdminChat = new Channel("§cADMIN§f", Color.Red, "a", Channel.inGroupFilter(null))); TBMCChatAPI.RegisterChatChannel( Channel.ModChat = new Channel("§9MOD§f", Color.Blue, "mod", Channel.inGroupFilter("mod"))); TBMCChatAPI.RegisterChatChannel(new Channel("§6DEV§", Color.Gold, "dev", Channel.inGroupFilter("developer"))); TBMCChatAPI.RegisterChatChannel(new ChatRoom("§cRED", Color.DarkRed, "red")); + TBMCChatAPI.RegisterChatChannel(new ChatRoom("§6ORANGE", Color.Gold, "orange")); + TBMCChatAPI.RegisterChatChannel(new ChatRoom("§eYELLOW", Color.Yellow, "yellow")); + TBMCChatAPI.RegisterChatChannel(new ChatRoom("§aGREEN", Color.Green, "green")); + TBMCChatAPI.RegisterChatChannel(new ChatRoom("§bBLUE", Color.Blue, "blue")); + TBMCChatAPI.RegisterChatChannel(new ChatRoom("§5PURPLE", Color.DarkPurple, "purple")); logger.info(pdfFile.getName() + " has been Enabled (V." + pdfFile.getVersion() + ") Test: " + Test + "."); } diff --git a/ButtonCore/src/main/java/buttondevteam/core/PlayerListener.java b/ButtonCore/src/main/java/buttondevteam/core/PlayerListener.java index b8bd6e7..5cffed3 100644 --- a/ButtonCore/src/main/java/buttondevteam/core/PlayerListener.java +++ b/ButtonCore/src/main/java/buttondevteam/core/PlayerListener.java @@ -1,5 +1,7 @@ package buttondevteam.core; +import buttondevteam.lib.TBMCSystemChatEvent; +import buttondevteam.lib.player.TBMCPlayerBase; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -7,9 +9,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; -import buttondevteam.lib.TBMCSystemChatEvent; -import buttondevteam.lib.player.TBMCPlayerBase; - public class PlayerListener implements Listener { @EventHandler(priority = EventPriority.LOWEST) @@ -29,4 +28,4 @@ public class PlayerListener implements Listener { Bukkit.getOnlinePlayers().stream().filter(p -> event.shouldSendTo(p)) .forEach(p -> p.sendMessage(event.getChannel().DisplayName.substring(0, 2) + event.getMessage())); } -} +} \ No newline at end of file diff --git a/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatPreprocessEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatPreprocessEvent.java index 8f8f9d2..d301876 100644 --- a/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatPreprocessEvent.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatPreprocessEvent.java @@ -1,14 +1,14 @@ package buttondevteam.lib; +import buttondevteam.lib.chat.Channel; import org.bukkit.command.CommandSender; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -import buttondevteam.lib.chat.Channel; - /** * Can be used to change messages before it's sent. + * Only called before sending messages with SendChatMessage. * * @author NorbiPeti * diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java index 43e00ea..5990116 100644 --- a/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java @@ -1,5 +1,11 @@ package buttondevteam.lib.chat; +import buttondevteam.core.MainPlugin; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.function.BiFunction; @@ -7,16 +13,12 @@ import java.util.function.BiPredicate; import java.util.function.Function; import java.util.function.Predicate; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import buttondevteam.core.MainPlugin; - public class Channel { public final String DisplayName; public final Color color; public final String ID; + public @Nullable + String[] IDs; /** * Filters both the sender and the targets */ diff --git a/ButtonProcessor/ButtonProcessor.iml b/ButtonProcessor/ButtonProcessor.iml new file mode 100644 index 0000000..52184f9 --- /dev/null +++ b/ButtonProcessor/ButtonProcessor.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file From bdf824e20ef3b4f65f56737f2f3b8d29b4f66b43 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Mon, 7 May 2018 20:01:36 +0200 Subject: [PATCH 2/4] Plugin update on shutdown+fromcmd Fromcmd: whether a message was sent by using a command Yesterday --- .idea/ButtonCore.iml | 0 .idea/compiler.xml | 0 .idea/encodings.xml | 0 ...tonCore_Towny_master_v1_0_gc1751b8_228.xml | 0 ..._milkbowl_VaultAPI_master_8dc0859cba_1.xml | 0 ...google_code_findbugs_annotations_2_0_1.xml | 0 ...Maven__com_google_code_gson_gson_2_2_4.xml | 0 .../Maven__com_google_guava_guava_15_0.xml | 0 ...oglecode_json_simple_json_simple_1_1_1.xml | 0 .../Maven__commons_io_commons_io_1_3_2.xml | 0 .../Maven__commons_lang_commons_lang_2_6.xml | 0 ..._javax_persistence_persistence_api_1_0.xml | 0 .idea/libraries/Maven__junit_junit_3_8_1.xml | 0 ...Maven__net_bytebuddy_byte_buddy_1_6_11.xml | 0 ..._net_bytebuddy_byte_buddy_agent_1_6_11.xml | 0 ..._net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml | 0 .../Maven__org_avaje_ebean_2_8_1.xml | 0 ...n__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml | 0 ...ven__org_javassist_javassist_3_20_0_GA.xml | 0 ...Maven__org_mockito_mockito_core_2_7_20.xml | 0 .../Maven__org_objenesis_objenesis_2_5.xml | 0 ...aven__org_projectlombok_lombok_1_16_16.xml | 0 ...en__org_reflections_reflections_0_9_10.xml | 0 ...pigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml | 0 .../Maven__org_yaml_snakeyaml_1_15.xml | 0 .idea/misc.xml | 0 .idea/modules.xml | 0 .idea/vcs.xml | 0 .project | 0 .settings/org.eclipse.m2e.core.prefs | 0 .travis.yml | 0 ButtonCore/.factorypath | 0 ButtonCore/.gitignore | 0 ButtonCore/.project | 0 .../org.eclipse.core.resources.prefs | 0 .../.settings/org.eclipse.jdt.apt.core.prefs | 0 .../.settings/org.eclipse.jdt.core.prefs | 0 .../.settings/org.eclipse.m2e.core.prefs | 0 ButtonCore/License.md | 0 ButtonCore/README.md | 0 ButtonCore/pom.xml | 0 .../buttondevteam/core/CommandCaller.java | 9 +-- .../java/buttondevteam/core/MainPlugin.java | 0 .../buttondevteam/core/PlayerListener.java | 0 .../core/ScheduledRestartCommand.java | 7 +-- .../java/buttondevteam/core/TestPrepare.java | 13 ++-- .../core/UpdatePluginCommand.java | 5 +- .../lib/EventExceptionCoreHandler.java | 0 .../lib/EventExceptionHandler.java | 21 +++---- .../java/buttondevteam/lib/PluginUpdater.java | 35 +++++------ .../lib/ScheduledServerRestartEvent.java | 0 .../java/buttondevteam/lib/TBMCChatEvent.java | 11 ++-- .../buttondevteam/lib/TBMCChatEventBase.java | 6 +- .../lib/TBMCChatPreprocessEvent.java | 0 .../java/buttondevteam/lib/TBMCCoreAPI.java | 24 ++++---- .../lib/TBMCDebugMessageEvent.java | 0 .../buttondevteam/lib/TBMCExceptionEvent.java | 5 +- .../lib/TBMCSystemChatEvent.java | 5 +- .../java/buttondevteam/lib/chat/Channel.java | 0 .../lib/chat/ChatChannelRegisterEvent.java | 0 .../java/buttondevteam/lib/chat/ChatRoom.java | 3 +- .../java/buttondevteam/lib/chat/Color.java | 0 .../buttondevteam/lib/chat/CommandClass.java | 6 +- .../lib/chat/IDiscordSender.java | 0 .../lib/chat/OptionallyPlayerCommandBase.java | 3 +- .../chat/OptionallyPlayerCommandClass.java | 6 +- .../lib/chat/PlayerCommandBase.java | 0 .../java/buttondevteam/lib/chat/Priority.java | 0 .../buttondevteam/lib/chat/TBMCChatAPI.java | 60 +++++++++++-------- .../lib/chat/TBMCCommandBase.java | 5 +- .../lib/chat/TellrawSerializableEnum.java | 0 .../lib/player/AbstractUserClass.java | 6 +- .../lib/player/ChromaGamerBase.java | 14 ++--- .../lib/player/ChromaGamerEnforcer.java | 6 +- .../lib/player/EnumPlayerData.java | 0 .../buttondevteam/lib/player/PlayerClass.java | 0 .../buttondevteam/lib/player/PlayerData.java | 0 .../buttondevteam/lib/player/TBMCPlayer.java | 0 .../lib/player/TBMCPlayerBase.java | 22 ++++--- .../lib/player/TBMCPlayerGetInfoEvent.java | 9 ++- .../lib/player/TBMCPlayerJoinEvent.java | 0 .../lib/player/TBMCPlayerLoadEvent.java | 0 .../lib/player/TBMCPlayerQuitEvent.java | 0 .../lib/player/TBMCPlayerSaveEvent.java | 0 .../lib/player/TBMCYEEHAWEvent.java | 0 .../buttondevteam/lib/player/UserClass.java | 6 +- .../buttondevteam/lib/potato/DebugPotato.java | 8 +-- .../java/buttondevteam/lib/potato/Gary.java | 0 ButtonCore/src/main/resources/plugin.yml | 0 .../buttondevteam/core/PlayerDataTest.java | 9 ++- .../buttondevteam/core/TestPlayerClass.java | 0 ButtonProcessor/.classpath | 0 ButtonProcessor/.gitignore | 0 ButtonProcessor/.project | 0 .../org.eclipse.core.resources.prefs | 0 .../.settings/org.eclipse.jdt.core.prefs | 0 .../.settings/org.eclipse.m2e.core.prefs | 0 ButtonProcessor/ButtonProcessor.iml | 0 ButtonProcessor/License.md | 0 ButtonProcessor/pom.xml | 0 .../buttonproc/ButtonProcessor.java | 4 +- .../javax.annotation.processing.Processor | 0 .../ButtonProcessor/AppTest.java | 0 deploy.sh | 0 jitpack.yml | 0 pom.xml | 0 106 files changed, 145 insertions(+), 163 deletions(-) mode change 100644 => 100755 .idea/ButtonCore.iml mode change 100644 => 100755 .idea/compiler.xml mode change 100644 => 100755 .idea/encodings.xml mode change 100644 => 100755 .idea/libraries/Maven__com_github_TBMCPlugins_ButtonCore_Towny_master_v1_0_gc1751b8_228.xml mode change 100644 => 100755 .idea/libraries/Maven__com_github_milkbowl_VaultAPI_master_8dc0859cba_1.xml mode change 100644 => 100755 .idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml mode change 100644 => 100755 .idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml mode change 100644 => 100755 .idea/libraries/Maven__com_google_guava_guava_15_0.xml mode change 100644 => 100755 .idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml mode change 100644 => 100755 .idea/libraries/Maven__commons_io_commons_io_1_3_2.xml mode change 100644 => 100755 .idea/libraries/Maven__commons_lang_commons_lang_2_6.xml mode change 100644 => 100755 .idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml mode change 100644 => 100755 .idea/libraries/Maven__junit_junit_3_8_1.xml mode change 100644 => 100755 .idea/libraries/Maven__net_bytebuddy_byte_buddy_1_6_11.xml mode change 100644 => 100755 .idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_6_11.xml mode change 100644 => 100755 .idea/libraries/Maven__net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml mode change 100644 => 100755 .idea/libraries/Maven__org_avaje_ebean_2_8_1.xml mode change 100644 => 100755 .idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml mode change 100644 => 100755 .idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml mode change 100644 => 100755 .idea/libraries/Maven__org_mockito_mockito_core_2_7_20.xml mode change 100644 => 100755 .idea/libraries/Maven__org_objenesis_objenesis_2_5.xml mode change 100644 => 100755 .idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml mode change 100644 => 100755 .idea/libraries/Maven__org_reflections_reflections_0_9_10.xml mode change 100644 => 100755 .idea/libraries/Maven__org_spigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml mode change 100644 => 100755 .idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml mode change 100644 => 100755 .idea/misc.xml mode change 100644 => 100755 .idea/modules.xml mode change 100644 => 100755 .idea/vcs.xml mode change 100644 => 100755 .project mode change 100644 => 100755 .settings/org.eclipse.m2e.core.prefs mode change 100644 => 100755 .travis.yml mode change 100644 => 100755 ButtonCore/.factorypath mode change 100644 => 100755 ButtonCore/.gitignore mode change 100644 => 100755 ButtonCore/.project mode change 100644 => 100755 ButtonCore/.settings/org.eclipse.core.resources.prefs mode change 100644 => 100755 ButtonCore/.settings/org.eclipse.jdt.apt.core.prefs mode change 100644 => 100755 ButtonCore/.settings/org.eclipse.jdt.core.prefs mode change 100644 => 100755 ButtonCore/.settings/org.eclipse.m2e.core.prefs mode change 100644 => 100755 ButtonCore/License.md mode change 100644 => 100755 ButtonCore/README.md mode change 100644 => 100755 ButtonCore/pom.xml mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/core/CommandCaller.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/core/PlayerListener.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/core/ScheduledRestartCommand.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/core/TestPrepare.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/core/UpdatePluginCommand.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/EventExceptionCoreHandler.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/EventExceptionHandler.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/ScheduledServerRestartEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEventBase.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/TBMCChatPreprocessEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/TBMCCoreAPI.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/TBMCDebugMessageEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/TBMCExceptionEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/TBMCSystemChatEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/ChatChannelRegisterEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/ChatRoom.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/Color.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/CommandClass.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/IDiscordSender.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandBase.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandClass.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/PlayerCommandBase.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/Priority.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/chat/TellrawSerializableEnum.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/AbstractUserClass.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerEnforcer.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/EnumPlayerData.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/PlayerClass.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/PlayerData.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayer.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerBase.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerGetInfoEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerJoinEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerLoadEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerQuitEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerSaveEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/TBMCYEEHAWEvent.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/player/UserClass.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/potato/DebugPotato.java mode change 100644 => 100755 ButtonCore/src/main/java/buttondevteam/lib/potato/Gary.java mode change 100644 => 100755 ButtonCore/src/main/resources/plugin.yml mode change 100644 => 100755 ButtonCore/src/test/java/buttondevteam/core/PlayerDataTest.java mode change 100644 => 100755 ButtonCore/src/test/java/buttondevteam/core/TestPlayerClass.java mode change 100644 => 100755 ButtonProcessor/.classpath mode change 100644 => 100755 ButtonProcessor/.gitignore mode change 100644 => 100755 ButtonProcessor/.project mode change 100644 => 100755 ButtonProcessor/.settings/org.eclipse.core.resources.prefs mode change 100644 => 100755 ButtonProcessor/.settings/org.eclipse.jdt.core.prefs mode change 100644 => 100755 ButtonProcessor/.settings/org.eclipse.m2e.core.prefs mode change 100644 => 100755 ButtonProcessor/ButtonProcessor.iml mode change 100644 => 100755 ButtonProcessor/License.md mode change 100644 => 100755 ButtonProcessor/pom.xml mode change 100644 => 100755 ButtonProcessor/src/main/java/buttondevteam/buttonproc/ButtonProcessor.java mode change 100644 => 100755 ButtonProcessor/src/main/resources/META-INF/services/javax.annotation.processing.Processor mode change 100644 => 100755 ButtonProcessor/src/test/java/buttondevteam/ButtonProcessor/AppTest.java mode change 100644 => 100755 deploy.sh mode change 100644 => 100755 jitpack.yml mode change 100644 => 100755 pom.xml diff --git a/.idea/ButtonCore.iml b/.idea/ButtonCore.iml old mode 100644 new mode 100755 diff --git a/.idea/compiler.xml b/.idea/compiler.xml old mode 100644 new mode 100755 diff --git a/.idea/encodings.xml b/.idea/encodings.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__com_github_TBMCPlugins_ButtonCore_Towny_master_v1_0_gc1751b8_228.xml b/.idea/libraries/Maven__com_github_TBMCPlugins_ButtonCore_Towny_master_v1_0_gc1751b8_228.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__com_github_milkbowl_VaultAPI_master_8dc0859cba_1.xml b/.idea/libraries/Maven__com_github_milkbowl_VaultAPI_master_8dc0859cba_1.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml b/.idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_1.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__com_google_guava_guava_15_0.xml b/.idea/libraries/Maven__com_google_guava_guava_15_0.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml b/.idea/libraries/Maven__com_googlecode_json_simple_json_simple_1_1_1.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml b/.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml b/.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml b/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__junit_junit_3_8_1.xml b/.idea/libraries/Maven__junit_junit_3_8_1.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_6_11.xml b/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_6_11.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_6_11.xml b/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_6_11.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_9_SNAPSHOT.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml b/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml b/.idea/libraries/Maven__org_javassist_javassist_3_20_0_GA.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__org_mockito_mockito_core_2_7_20.xml b/.idea/libraries/Maven__org_mockito_mockito_core_2_7_20.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__org_objenesis_objenesis_2_5.xml b/.idea/libraries/Maven__org_objenesis_objenesis_2_5.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml b/.idea/libraries/Maven__org_projectlombok_lombok_1_16_16.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__org_reflections_reflections_0_9_10.xml b/.idea/libraries/Maven__org_reflections_reflections_0_9_10.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_9_2_R0_1_SNAPSHOT.xml old mode 100644 new mode 100755 diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml old mode 100644 new mode 100755 diff --git a/.idea/misc.xml b/.idea/misc.xml old mode 100644 new mode 100755 diff --git a/.idea/modules.xml b/.idea/modules.xml old mode 100644 new mode 100755 diff --git a/.idea/vcs.xml b/.idea/vcs.xml old mode 100644 new mode 100755 diff --git a/.project b/.project old mode 100644 new mode 100755 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs old mode 100644 new mode 100755 diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 diff --git a/ButtonCore/.factorypath b/ButtonCore/.factorypath old mode 100644 new mode 100755 diff --git a/ButtonCore/.gitignore b/ButtonCore/.gitignore old mode 100644 new mode 100755 diff --git a/ButtonCore/.project b/ButtonCore/.project old mode 100644 new mode 100755 diff --git a/ButtonCore/.settings/org.eclipse.core.resources.prefs b/ButtonCore/.settings/org.eclipse.core.resources.prefs old mode 100644 new mode 100755 diff --git a/ButtonCore/.settings/org.eclipse.jdt.apt.core.prefs b/ButtonCore/.settings/org.eclipse.jdt.apt.core.prefs old mode 100644 new mode 100755 diff --git a/ButtonCore/.settings/org.eclipse.jdt.core.prefs b/ButtonCore/.settings/org.eclipse.jdt.core.prefs old mode 100644 new mode 100755 diff --git a/ButtonCore/.settings/org.eclipse.m2e.core.prefs b/ButtonCore/.settings/org.eclipse.m2e.core.prefs old mode 100644 new mode 100755 diff --git a/ButtonCore/License.md b/ButtonCore/License.md old mode 100644 new mode 100755 diff --git a/ButtonCore/README.md b/ButtonCore/README.md old mode 100644 new mode 100755 diff --git a/ButtonCore/pom.xml b/ButtonCore/pom.xml old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/core/CommandCaller.java b/ButtonCore/src/main/java/buttondevteam/core/CommandCaller.java old mode 100644 new mode 100755 index 26b0c47..2be8fab --- a/ButtonCore/src/main/java/buttondevteam/core/CommandCaller.java +++ b/ButtonCore/src/main/java/buttondevteam/core/CommandCaller.java @@ -1,14 +1,15 @@ package buttondevteam.core; -import java.util.Arrays; +import buttondevteam.lib.TBMCCoreAPI; +import buttondevteam.lib.chat.TBMCChatAPI; +import buttondevteam.lib.chat.TBMCCommandBase; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.PluginCommand; import org.bukkit.plugin.java.JavaPlugin; -import buttondevteam.lib.TBMCCoreAPI; -import buttondevteam.lib.chat.TBMCChatAPI; -import buttondevteam.lib.chat.TBMCCommandBase; + +import java.util.Arrays; public class CommandCaller implements CommandExecutor { diff --git a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/core/PlayerListener.java b/ButtonCore/src/main/java/buttondevteam/core/PlayerListener.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/core/ScheduledRestartCommand.java b/ButtonCore/src/main/java/buttondevteam/core/ScheduledRestartCommand.java old mode 100644 new mode 100755 index 7f9c4fe..987c244 --- a/ButtonCore/src/main/java/buttondevteam/core/ScheduledRestartCommand.java +++ b/ButtonCore/src/main/java/buttondevteam/core/ScheduledRestartCommand.java @@ -1,5 +1,8 @@ package buttondevteam.core; +import buttondevteam.lib.ScheduledServerRestartEvent; +import buttondevteam.lib.chat.CommandClass; +import buttondevteam.lib.chat.TBMCCommandBase; import org.bukkit.Bukkit; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarFlag; @@ -8,10 +11,6 @@ import org.bukkit.boss.BossBar; import org.bukkit.command.CommandSender; import org.bukkit.scheduler.BukkitTask; -import buttondevteam.lib.ScheduledServerRestartEvent; -import buttondevteam.lib.chat.CommandClass; -import buttondevteam.lib.chat.TBMCCommandBase; - @CommandClass(modOnly = true, path = "schrestart") public class ScheduledRestartCommand extends TBMCCommandBase { private static volatile int restartcounter; diff --git a/ButtonCore/src/main/java/buttondevteam/core/TestPrepare.java b/ButtonCore/src/main/java/buttondevteam/core/TestPrepare.java old mode 100644 new mode 100755 index 3b6c837..62d3de6 --- a/ButtonCore/src/main/java/buttondevteam/core/TestPrepare.java +++ b/ButtonCore/src/main/java/buttondevteam/core/TestPrepare.java @@ -1,9 +1,8 @@ package buttondevteam.core; -import java.util.Collection; -import java.util.Collections; -import java.util.logging.Logger; - +import buttondevteam.lib.chat.Channel; +import buttondevteam.lib.chat.Color; +import buttondevteam.lib.chat.TBMCChatAPI; import org.bukkit.Bukkit; import org.bukkit.Server; import org.bukkit.plugin.PluginManager; @@ -11,9 +10,9 @@ import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import buttondevteam.lib.chat.Channel; -import buttondevteam.lib.chat.Color; -import buttondevteam.lib.chat.TBMCChatAPI; +import java.util.Collection; +import java.util.Collections; +import java.util.logging.Logger; public class TestPrepare { public static void PrepareServer() { diff --git a/ButtonCore/src/main/java/buttondevteam/core/UpdatePluginCommand.java b/ButtonCore/src/main/java/buttondevteam/core/UpdatePluginCommand.java old mode 100644 new mode 100755 index 9d6bcda..19a5ed0 --- a/ButtonCore/src/main/java/buttondevteam/core/UpdatePluginCommand.java +++ b/ButtonCore/src/main/java/buttondevteam/core/UpdatePluginCommand.java @@ -1,12 +1,11 @@ package buttondevteam.core; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; - import buttondevteam.lib.PluginUpdater; import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.TBMCCommandBase; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; @CommandClass(modOnly = true) public class UpdatePluginCommand extends TBMCCommandBase { diff --git a/ButtonCore/src/main/java/buttondevteam/lib/EventExceptionCoreHandler.java b/ButtonCore/src/main/java/buttondevteam/lib/EventExceptionCoreHandler.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/EventExceptionHandler.java b/ButtonCore/src/main/java/buttondevteam/lib/EventExceptionHandler.java old mode 100644 new mode 100755 index e84cb2c..2d3ec1a --- a/ButtonCore/src/main/java/buttondevteam/lib/EventExceptionHandler.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/EventExceptionHandler.java @@ -1,25 +1,20 @@ package buttondevteam.lib; +import com.google.common.collect.Lists; +import org.apache.commons.lang.Validate; +import org.bukkit.event.Event; +import org.bukkit.event.EventException; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.plugin.*; + import java.lang.reflect.Method; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.lang.Validate; -import org.bukkit.event.Event; -import org.bukkit.event.EventException; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.plugin.EventExecutor; -import org.bukkit.plugin.IllegalPluginAccessException; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; -import org.bukkit.plugin.RegisteredListener; - -import com.google.common.collect.Lists; - abstract class EventExceptionHandler { // https://gist.github.com/aadnk/5430459 // For wrapping a registered listener private static class ExceptionRegisteredListener extends RegisteredListener { diff --git a/ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java b/ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java old mode 100644 new mode 100755 index 75b96b3..ba5ea90 --- a/ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java @@ -1,5 +1,15 @@ package buttondevteam.lib; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import org.apache.commons.io.FileUtils; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -9,21 +19,12 @@ import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import org.apache.commons.io.FileUtils; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; public class PluginUpdater { private PluginUpdater() { } + private static final File updatedir = new File("updateplugins"); /** * See {@link TBMCCoreAPI#UpdatePlugin(String, CommandSender, String)} */ @@ -57,11 +58,11 @@ public class PluginUpdater { return false; } info(sender, "Updating TBMC plugin: " + correctname + " from " + correctbranch.get()); - return updatePluginJitPack(sender, correctname, correctbranch); + return updatePluginJitPack(sender, correctname, correctbranch.get()); } private static boolean updatePluginJitPack(CommandSender sender, String correctname, - Optional correctbranch) { + String correctbranch) { URL url; final boolean isWindows = System.getProperty("os.name").contains("Windows"); File result = new File("plugins/" + correctname + (isWindows ? ".jar" : ".jar_tmp")); @@ -69,24 +70,24 @@ public class PluginUpdater { try { url = new URL("https://jitpack.io/com/github/TBMCPlugins/" + (correctname.equals("ButtonCore") ? "ButtonCore/ButtonCore" : correctname) + "/" - + correctbranch.get() + "-SNAPSHOT/" + correctname + "-" + correctbranch.get() + "-SNAPSHOT.jar"); // ButtonCore exception required since it hosts Towny as well + + correctbranch + "-SNAPSHOT/" + correctname + "-" + correctbranch + "-SNAPSHOT.jar"); // ButtonCore exception required since it hosts Towny as well FileUtils.copyURLToFile(url, result); if (!result.exists() || result.length() < 25) { result.delete(); - error(sender, "The downloaded JAR for " + correctname + " from " + correctbranch.get() + error(sender, "The downloaded JAR for " + correctname + " from " + correctbranch + " is too small (smnaller than 25 bytes). Am I downloading from the right place?"); return false; } else { if (!isWindows) Files.move(result.toPath(), finalresult.toPath(), StandardCopyOption.REPLACE_EXISTING); - info(sender, "Updating plugin " + correctname + " from " + correctbranch.get() + " done!"); + info(sender, "Updating plugin " + correctname + " from " + correctbranch + " done!"); return true; } } catch (FileNotFoundException e) { error(sender, - "Can't find JAR for " + correctname + " from " + correctbranch.get() + "Can't find JAR for " + correctname + " from " + correctbranch + ", the build probably failed. Build log (scroll to bottom):" + "\n" - + "https://jitpack.io/com/github/TBMCPlugins/" + correctname + "/" + correctbranch.get() + + "https://jitpack.io/com/github/TBMCPlugins/" + correctname + "/" + correctbranch + "-SNAPSHOT/build.log\nIf you'd like to rebuild the same commit, go to:\nhttps://jitpack.io/#TBMCPlugins/" + correctname + "\nAnd delete the newest build."); } catch (IOException e) { diff --git a/ButtonCore/src/main/java/buttondevteam/lib/ScheduledServerRestartEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/ScheduledServerRestartEvent.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEvent.java old mode 100644 new mode 100755 index 9b292df..6be9825 --- a/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEvent.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEvent.java @@ -1,27 +1,28 @@ package buttondevteam.lib; -import org.bukkit.command.CommandSender; -import org.bukkit.event.HandlerList; - import buttondevteam.lib.chat.Channel; import lombok.Getter; +import org.bukkit.command.CommandSender; +import org.bukkit.event.HandlerList; /** - * Make sure to only send the message to users who {@link #shouldSendTo(CommandSender)} returns true. + * Make sure to only send the message to users where {@link #shouldSendTo(CommandSender)} returns true. * * @author NorbiPeti * */ @Getter public class TBMCChatEvent extends TBMCChatEventBase { - public TBMCChatEvent(CommandSender sender, Channel channel, String message, int score) { + public TBMCChatEvent(CommandSender sender, Channel channel, String message, int score, boolean fromcmd) { super(channel, message, score); this.sender = sender; + this.fromcmd = fromcmd; } private static final HandlerList handlers = new HandlerList(); private CommandSender sender; + private boolean fromcmd; // TODO: Message object with data? @Override diff --git a/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEventBase.java b/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEventBase.java old mode 100644 new mode 100755 index 627f7c6..249230c --- a/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEventBase.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatEventBase.java @@ -1,14 +1,14 @@ package buttondevteam.lib; -import org.bukkit.command.CommandSender; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; import buttondevteam.lib.chat.Channel; import buttondevteam.lib.chat.Channel.RecipientTestResult; import lombok.Getter; import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.Setter; +import org.bukkit.command.CommandSender; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; @Getter @RequiredArgsConstructor diff --git a/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatPreprocessEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/TBMCChatPreprocessEvent.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/TBMCCoreAPI.java b/ButtonCore/src/main/java/buttondevteam/lib/TBMCCoreAPI.java old mode 100644 new mode 100755 index 2e0c9ae..2b0f05e --- a/ButtonCore/src/main/java/buttondevteam/lib/TBMCCoreAPI.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/TBMCCoreAPI.java @@ -1,10 +1,8 @@ package buttondevteam.lib; -import java.io.*; -import java.net.*; -import java.util.*; -import java.util.Map.Entry; - +import buttondevteam.core.MainPlugin; +import buttondevteam.lib.player.ChromaGamerBase; +import buttondevteam.lib.potato.DebugPotato; import org.apache.commons.io.IOUtils; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -12,9 +10,15 @@ import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.plugin.Plugin; -import buttondevteam.core.MainPlugin; -import buttondevteam.lib.player.ChromaGamerBase; -import buttondevteam.lib.potato.DebugPotato; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; public class TBMCCoreAPI { static List coders = new ArrayList() { @@ -67,8 +71,8 @@ public class TBMCCoreAPI { return body; } - private static HashMap exceptionsToSend = new HashMap<>(); - private static List debugMessagesToSend = new ArrayList<>(); + private static final HashMap exceptionsToSend = new HashMap<>(); + private static final List debugMessagesToSend = new ArrayList<>(); /** * Send exception to the {@link TBMCExceptionEvent}. diff --git a/ButtonCore/src/main/java/buttondevteam/lib/TBMCDebugMessageEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/TBMCDebugMessageEvent.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/TBMCExceptionEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/TBMCExceptionEvent.java old mode 100644 new mode 100755 index 7bb0e05..9cf6b3e --- a/ButtonCore/src/main/java/buttondevteam/lib/TBMCExceptionEvent.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/TBMCExceptionEvent.java @@ -1,10 +1,9 @@ package buttondevteam.lib; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - import lombok.Getter; import lombok.RequiredArgsConstructor; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; /** *

diff --git a/ButtonCore/src/main/java/buttondevteam/lib/TBMCSystemChatEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/TBMCSystemChatEvent.java old mode 100644 new mode 100755 index c0fce47..81d82d4 --- a/ButtonCore/src/main/java/buttondevteam/lib/TBMCSystemChatEvent.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/TBMCSystemChatEvent.java @@ -1,10 +1,9 @@ package buttondevteam.lib; -import org.bukkit.command.CommandSender; -import org.bukkit.event.HandlerList; - import buttondevteam.lib.chat.Channel; import lombok.Getter; +import org.bukkit.command.CommandSender; +import org.bukkit.event.HandlerList; /** * Make sure to only send the message to users who {@link #shouldSendTo(CommandSender)} returns true. diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/ChatChannelRegisterEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/ChatChannelRegisterEvent.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/ChatRoom.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/ChatRoom.java old mode 100644 new mode 100755 index 6a735e7..f037936 --- a/ButtonCore/src/main/java/buttondevteam/lib/chat/ChatRoom.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/chat/ChatRoom.java @@ -1,8 +1,9 @@ package buttondevteam.lib.chat; +import org.bukkit.command.CommandSender; + import java.util.ArrayList; import java.util.List; -import org.bukkit.command.CommandSender; public class ChatRoom extends Channel { private List usersInRoom = new ArrayList<>(); diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/Color.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/Color.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/CommandClass.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/CommandClass.java old mode 100644 new mode 100755 index 74e70d7..6e0206c --- a/ButtonCore/src/main/java/buttondevteam/lib/chat/CommandClass.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/chat/CommandClass.java @@ -1,10 +1,6 @@ package buttondevteam.lib.chat; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +import java.lang.annotation.*; /** * Abstract classes with no {@link CommandClass} annotations will be ignored. Classes that are not abstract or have the annotation will be included in the command path unless diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/IDiscordSender.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/IDiscordSender.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandBase.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandBase.java old mode 100644 new mode 100755 index 889cf76..d5095ee --- a/ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandBase.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandBase.java @@ -1,10 +1,9 @@ package buttondevteam.lib.chat; +import buttondevteam.lib.TBMCCoreAPI; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import buttondevteam.lib.TBMCCoreAPI; - public abstract class OptionallyPlayerCommandBase extends TBMCCommandBase { public boolean OnCommand(Player player, String alias, String[] args) { if (getClass().isAnnotationPresent(OptionallyPlayerCommandClass.class) diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandClass.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandClass.java old mode 100644 new mode 100755 index 6cfd977..88418c7 --- a/ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandClass.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/chat/OptionallyPlayerCommandClass.java @@ -1,10 +1,6 @@ package buttondevteam.lib.chat; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +import java.lang.annotation.*; /** * Only needed to use with {@link OptionallyPlayerCommandBase} command classes diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/PlayerCommandBase.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/PlayerCommandBase.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/Priority.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/Priority.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java old mode 100644 new mode 100755 index c537b63..118b0e2 --- a/ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java @@ -1,13 +1,12 @@ package buttondevteam.lib.chat; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map.Entry; -import java.util.Set; -import java.util.function.Consumer; - +import buttondevteam.core.CommandCaller; +import buttondevteam.core.MainPlugin; +import buttondevteam.lib.TBMCChatEvent; +import buttondevteam.lib.TBMCChatPreprocessEvent; +import buttondevteam.lib.TBMCCoreAPI; +import buttondevteam.lib.TBMCSystemChatEvent; +import buttondevteam.lib.chat.Channel.RecipientTestResult; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -17,13 +16,13 @@ import org.reflections.scanners.SubTypesScanner; import org.reflections.util.ClasspathHelper; import org.reflections.util.ConfigurationBuilder; -import buttondevteam.core.CommandCaller; -import buttondevteam.core.MainPlugin; -import buttondevteam.lib.TBMCChatEvent; -import buttondevteam.lib.TBMCChatPreprocessEvent; -import buttondevteam.lib.TBMCCoreAPI; -import buttondevteam.lib.TBMCSystemChatEvent; -import buttondevteam.lib.chat.Channel.RecipientTestResult; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Set; +import java.util.function.Consumer; public class TBMCChatAPI { @@ -119,7 +118,7 @@ public class TBMCChatAPI { continue; TBMCCommandBase c = cmd.newInstance(); c.plugin = plugin; - if (!CheckForNulls(plugin, c)) + if (HasNulls(plugin, c)) continue; commands.put(c.GetCommandPath(), c); CommandCaller.RegisterCommand(c); @@ -155,7 +154,7 @@ public class TBMCChatAPI { else c = thecmdclass.newInstance(); c.plugin = plugin; - if (!CheckForNulls(plugin, c)) + if (HasNulls(plugin, c)) return; commands.put(c.GetCommandPath(), c); CommandCaller.RegisterCommand(c); @@ -181,7 +180,7 @@ public class TBMCChatAPI { * The command to add */ public static void AddCommand(JavaPlugin plugin, TBMCCommandBase cmd) { - if (!CheckForNulls(plugin, cmd)) + if (HasNulls(plugin, cmd)) return; // plugin.getLogger().info("Registering command /" + cmd.GetCommandPath() + " for " + plugin.getName()); try { @@ -193,22 +192,22 @@ public class TBMCChatAPI { } } - private static boolean CheckForNulls(JavaPlugin plugin, TBMCCommandBase cmd) { + private static boolean HasNulls(JavaPlugin plugin, TBMCCommandBase cmd) { if (cmd == null) { TBMCCoreAPI.SendException("An error occured while registering a command for plugin " + plugin.getName(), new Exception("The command is null!")); - return false; + return true; } else if (cmd.GetCommandPath() == null) { TBMCCoreAPI.SendException("An error occured while registering command " + cmd.getClass().getSimpleName() + " for plugin " + plugin.getName(), new Exception("The command path is null!")); - return false; + return true; } - return true; + return false; } /** * Sends a chat message to Minecraft. Make sure that the channel is registered with {@link #RegisterChatChannel(Channel)}. - * + * * @param channel * The channel to send to * @param sender @@ -218,6 +217,19 @@ public class TBMCChatAPI { * @return The event cancelled state */ public static boolean SendChatMessage(Channel channel, CommandSender sender, String message) { + return SendChatMessage(channel, sender, message, false); + } + + /** + * Sends a chat message to Minecraft. Make sure that the channel is registered with {@link #RegisterChatChannel(Channel)}. + * + * @param channel The channel to send to + * @param sender The sender to send from + * @param message The message to send + * @param fromcommand Whether this message comes from running a command, used to determine whether to delete Discord messages for example + * @return The event cancelled state + */ + public static boolean SendChatMessage(Channel channel, CommandSender sender, String message, boolean fromcommand) { if (!Channel.getChannels().contains(channel)) throw new RuntimeException("Channel " + channel.DisplayName + " not registered!"); TBMCChatPreprocessEvent eventPre = new TBMCChatPreprocessEvent(sender, channel, message); @@ -227,7 +239,7 @@ public class TBMCChatAPI { int score = getScoreOrSendError(channel, sender); if (score == -1) return true; - TBMCChatEvent event = new TBMCChatEvent(sender, channel, eventPre.getMessage(), score); + TBMCChatEvent event = new TBMCChatEvent(sender, channel, eventPre.getMessage(), score, fromcommand); Bukkit.getPluginManager().callEvent(event); return event.isCancelled(); } diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java old mode 100644 new mode 100755 index 2f7cb2d..9b7e186 --- a/ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/chat/TBMCCommandBase.java @@ -1,11 +1,10 @@ package buttondevteam.lib.chat; -import java.util.function.Function; - +import javassist.Modifier; import org.bukkit.command.CommandSender; import org.bukkit.plugin.Plugin; -import javassist.Modifier; +import java.util.function.Function; /** * Extend this class to create new TBMCCommand and use {@link TBMCChatAPI#AddCommand(org.bukkit.plugin.java.JavaPlugin, TBMCCommandBase)} to add it. Note: The command path (command name diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/TellrawSerializableEnum.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/TellrawSerializableEnum.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/AbstractUserClass.java b/ButtonCore/src/main/java/buttondevteam/lib/player/AbstractUserClass.java old mode 100644 new mode 100755 index fdbc45d..14cf8cb --- a/ButtonCore/src/main/java/buttondevteam/lib/player/AbstractUserClass.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/player/AbstractUserClass.java @@ -1,10 +1,6 @@ package buttondevteam.lib.player; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +import java.lang.annotation.*; /** * Specifies a {@link ChromaGamerBase} direct subclass which's abstract. For Minecraft data, use {@link PlayerClass} diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java b/ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java old mode 100644 new mode 100755 index c533fa8..e340af6 --- a/ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerBase.java @@ -1,17 +1,15 @@ package buttondevteam.lib.player; +import buttondevteam.lib.TBMCCoreAPI; +import com.google.common.collect.HashBiMap; +import lombok.val; +import org.bukkit.Bukkit; +import org.bukkit.configuration.file.YamlConfiguration; + import java.io.File; import java.util.HashMap; import java.util.function.Consumer; -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.YamlConfiguration; - -import com.google.common.collect.HashBiMap; - -import buttondevteam.lib.TBMCCoreAPI; -import lombok.val; - @ChromaGamerEnforcer public abstract class ChromaGamerBase implements AutoCloseable { public static final String TBMC_PLAYERS_DIR = "TBMC/players/"; diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerEnforcer.java b/ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerEnforcer.java old mode 100644 new mode 100755 index 35ffdf4..b08d064 --- a/ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerEnforcer.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/player/ChromaGamerEnforcer.java @@ -1,10 +1,6 @@ package buttondevteam.lib.player; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +import java.lang.annotation.*; @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE) diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/EnumPlayerData.java b/ButtonCore/src/main/java/buttondevteam/lib/player/EnumPlayerData.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/PlayerClass.java b/ButtonCore/src/main/java/buttondevteam/lib/player/PlayerClass.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/PlayerData.java b/ButtonCore/src/main/java/buttondevteam/lib/player/PlayerData.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayer.java b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayer.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerBase.java b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerBase.java old mode 100644 new mode 100755 index 14d1c0d..367b255 --- a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerBase.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerBase.java @@ -1,23 +1,21 @@ package buttondevteam.lib.player; +import buttondevteam.lib.TBMCCoreAPI; +import com.palmergames.bukkit.towny.Towny; +import com.palmergames.bukkit.towny.exceptions.AlreadyRegisteredException; +import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; +import com.palmergames.bukkit.towny.object.Resident; +import com.palmergames.bukkit.towny.object.TownyUniverse; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; + import java.util.Iterator; import java.util.Map.Entry; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; - -import com.palmergames.bukkit.towny.Towny; -import com.palmergames.bukkit.towny.exceptions.AlreadyRegisteredException; -import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; -import com.palmergames.bukkit.towny.object.Resident; -import com.palmergames.bukkit.towny.object.TownyUniverse; - -import buttondevteam.lib.TBMCCoreAPI; - @AbstractUserClass(foldername = "minecraft", prototype = TBMCPlayer.class) public abstract class TBMCPlayerBase extends ChromaGamerBase { protected UUID uuid; diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerGetInfoEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerGetInfoEvent.java old mode 100644 new mode 100755 index 6e310a0..1abfac0 --- a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerGetInfoEvent.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerGetInfoEvent.java @@ -1,14 +1,13 @@ package buttondevteam.lib.player; +import buttondevteam.lib.player.ChromaGamerBase.InfoTarget; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -import buttondevteam.lib.player.ChromaGamerBase.InfoTarget; - /** *

* This event gets called when player information is requested. It can be used to give more per-plugin information about a player. diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerJoinEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerJoinEvent.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerLoadEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerLoadEvent.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerQuitEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerQuitEvent.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerSaveEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCPlayerSaveEvent.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCYEEHAWEvent.java b/ButtonCore/src/main/java/buttondevteam/lib/player/TBMCYEEHAWEvent.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/java/buttondevteam/lib/player/UserClass.java b/ButtonCore/src/main/java/buttondevteam/lib/player/UserClass.java old mode 100644 new mode 100755 index cae2326..9abfce6 --- a/ButtonCore/src/main/java/buttondevteam/lib/player/UserClass.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/player/UserClass.java @@ -1,10 +1,6 @@ package buttondevteam.lib.player; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +import java.lang.annotation.*; /** * Specifies a {@link ChromaGamerBase} direct subclass which can be instantiated. For Minecraft data, use {@link PlayerClass} diff --git a/ButtonCore/src/main/java/buttondevteam/lib/potato/DebugPotato.java b/ButtonCore/src/main/java/buttondevteam/lib/potato/DebugPotato.java old mode 100644 new mode 100755 index 4c5269f..d410bd9 --- a/ButtonCore/src/main/java/buttondevteam/lib/potato/DebugPotato.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/potato/DebugPotato.java @@ -1,15 +1,15 @@ package buttondevteam.lib.potato; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + public class DebugPotato { private List message; private String type; diff --git a/ButtonCore/src/main/java/buttondevteam/lib/potato/Gary.java b/ButtonCore/src/main/java/buttondevteam/lib/potato/Gary.java old mode 100644 new mode 100755 diff --git a/ButtonCore/src/main/resources/plugin.yml b/ButtonCore/src/main/resources/plugin.yml old mode 100644 new mode 100755 diff --git a/ButtonCore/src/test/java/buttondevteam/core/PlayerDataTest.java b/ButtonCore/src/test/java/buttondevteam/core/PlayerDataTest.java old mode 100644 new mode 100755 index 298d1c9..23993d5 --- a/ButtonCore/src/test/java/buttondevteam/core/PlayerDataTest.java +++ b/ButtonCore/src/test/java/buttondevteam/core/PlayerDataTest.java @@ -1,16 +1,15 @@ package buttondevteam.core; -import java.io.File; -import java.util.UUID; - -import org.apache.commons.io.FileUtils; - import buttondevteam.core.TestPlayerClass.TestEnum; import buttondevteam.lib.player.ChromaGamerBase; import buttondevteam.lib.player.TBMCPlayerBase; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.util.UUID; public class PlayerDataTest extends TestCase { public PlayerDataTest() { diff --git a/ButtonCore/src/test/java/buttondevteam/core/TestPlayerClass.java b/ButtonCore/src/test/java/buttondevteam/core/TestPlayerClass.java old mode 100644 new mode 100755 diff --git a/ButtonProcessor/.classpath b/ButtonProcessor/.classpath old mode 100644 new mode 100755 diff --git a/ButtonProcessor/.gitignore b/ButtonProcessor/.gitignore old mode 100644 new mode 100755 diff --git a/ButtonProcessor/.project b/ButtonProcessor/.project old mode 100644 new mode 100755 diff --git a/ButtonProcessor/.settings/org.eclipse.core.resources.prefs b/ButtonProcessor/.settings/org.eclipse.core.resources.prefs old mode 100644 new mode 100755 diff --git a/ButtonProcessor/.settings/org.eclipse.jdt.core.prefs b/ButtonProcessor/.settings/org.eclipse.jdt.core.prefs old mode 100644 new mode 100755 diff --git a/ButtonProcessor/.settings/org.eclipse.m2e.core.prefs b/ButtonProcessor/.settings/org.eclipse.m2e.core.prefs old mode 100644 new mode 100755 diff --git a/ButtonProcessor/ButtonProcessor.iml b/ButtonProcessor/ButtonProcessor.iml old mode 100644 new mode 100755 diff --git a/ButtonProcessor/License.md b/ButtonProcessor/License.md old mode 100644 new mode 100755 diff --git a/ButtonProcessor/pom.xml b/ButtonProcessor/pom.xml old mode 100644 new mode 100755 diff --git a/ButtonProcessor/src/main/java/buttondevteam/buttonproc/ButtonProcessor.java b/ButtonProcessor/src/main/java/buttondevteam/buttonproc/ButtonProcessor.java old mode 100644 new mode 100755 index 8f71daf..bd05e9c --- a/ButtonProcessor/src/main/java/buttondevteam/buttonproc/ButtonProcessor.java +++ b/ButtonProcessor/src/main/java/buttondevteam/buttonproc/ButtonProcessor.java @@ -1,7 +1,5 @@ package buttondevteam.buttonproc; -import java.util.List; -import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; @@ -10,6 +8,8 @@ import javax.lang.model.SourceVersion; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; +import java.util.List; +import java.util.Set; /** * A simple session bean type annotation processor. The implementation * is based on the standard annotation processing API in Java 6. */ @SupportedSourceVersion(SourceVersion.RELEASE_8) diff --git a/ButtonProcessor/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/ButtonProcessor/src/main/resources/META-INF/services/javax.annotation.processing.Processor old mode 100644 new mode 100755 diff --git a/ButtonProcessor/src/test/java/buttondevteam/ButtonProcessor/AppTest.java b/ButtonProcessor/src/test/java/buttondevteam/ButtonProcessor/AppTest.java old mode 100644 new mode 100755 diff --git a/deploy.sh b/deploy.sh old mode 100644 new mode 100755 diff --git a/jitpack.yml b/jitpack.yml old mode 100644 new mode 100755 diff --git a/pom.xml b/pom.xml old mode 100644 new mode 100755 From a24c4a5e545c685dc18d7ff75fca31157f86a4ce Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Mon, 7 May 2018 23:32:58 +0200 Subject: [PATCH 3/4] Updated plugin updater TODO! --- .idea/compiler.xml | 2 + ...Maven__com_google_code_gson_gson_2_8_0.xml | 13 ++++++ .../Maven__com_google_guava_guava_21_0.xml | 13 ++++++ .../Maven__commons_io_commons_io_2_6.xml | 13 ++++++ ...net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml | 13 ++++++ ...igotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml | 13 ++++++ .../Maven__org_yaml_snakeyaml_1_19.xml | 13 ++++++ .idea/modules.xml | 1 + BuildConfigUpdater/BuildConfigUpdater.iml | 33 ++++++++++++++ BuildConfigUpdater/pom.xml | 43 +++++++++++++++++++ BuildConfigUpdater/src/main/java/BCUMain.java | 16 +++++++ .../java/buttondevteam/core/MainPlugin.java | 19 ++++++++ .../java/buttondevteam/lib/PluginUpdater.java | 14 +++--- pom.xml | 1 + 14 files changed, 199 insertions(+), 8 deletions(-) create mode 100644 .idea/libraries/Maven__com_google_code_gson_gson_2_8_0.xml create mode 100644 .idea/libraries/Maven__com_google_guava_guava_21_0.xml create mode 100644 .idea/libraries/Maven__commons_io_commons_io_2_6.xml create mode 100644 .idea/libraries/Maven__net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml create mode 100644 .idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml create mode 100644 .idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml create mode 100644 BuildConfigUpdater/BuildConfigUpdater.iml create mode 100644 BuildConfigUpdater/pom.xml create mode 100644 BuildConfigUpdater/src/main/java/BCUMain.java diff --git a/.idea/compiler.xml b/.idea/compiler.xml index e9bdc8a..3220ab9 100755 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -7,10 +7,12 @@ + + diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_8_0.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_0.xml new file mode 100644 index 0000000..6e5d5b7 --- /dev/null +++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_8_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_google_guava_guava_21_0.xml b/.idea/libraries/Maven__com_google_guava_guava_21_0.xml new file mode 100644 index 0000000..a923456 --- /dev/null +++ b/.idea/libraries/Maven__com_google_guava_guava_21_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__commons_io_commons_io_2_6.xml b/.idea/libraries/Maven__commons_io_commons_io_2_6.xml new file mode 100644 index 0000000..d722698 --- /dev/null +++ b/.idea/libraries/Maven__commons_io_commons_io_2_6.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml new file mode 100644 index 0000000..befe1ab --- /dev/null +++ b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml new file mode 100644 index 0000000..ed73ade --- /dev/null +++ b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml new file mode 100644 index 0000000..33ccf19 --- /dev/null +++ b/.idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index b7b1c7d..3dc26c2 100755 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,6 +2,7 @@ + diff --git a/BuildConfigUpdater/BuildConfigUpdater.iml b/BuildConfigUpdater/BuildConfigUpdater.iml new file mode 100644 index 0000000..4902d56 --- /dev/null +++ b/BuildConfigUpdater/BuildConfigUpdater.iml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BuildConfigUpdater/pom.xml b/BuildConfigUpdater/pom.xml new file mode 100644 index 0000000..01781fb --- /dev/null +++ b/BuildConfigUpdater/pom.xml @@ -0,0 +1,43 @@ + + + + ButtonCore + com.github.TBMCPlugins + master-SNAPSHOT + + 4.0.0 + + BuildConfigUpdater + + + + Jitpack + https://jitpack.io/ + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + + + com.github.TBMCPlugins.ButtonCore + ButtonCore + master-SNAPSHOT + + + org.spigotmc + spigot-api + 1.12.2-R0.1-SNAPSHOT + + + commons-io + commons-io + 2.6 + + + + \ No newline at end of file diff --git a/BuildConfigUpdater/src/main/java/BCUMain.java b/BuildConfigUpdater/src/main/java/BCUMain.java new file mode 100644 index 0000000..5780afa --- /dev/null +++ b/BuildConfigUpdater/src/main/java/BCUMain.java @@ -0,0 +1,16 @@ +import buttondevteam.lib.PluginUpdater; + +import java.util.List; +import java.util.stream.Collectors; + +public class BCUMain { + public static void main(String[] args) { + System.out.println("Getting list of repositories..."); + List plugins = PluginUpdater.GetPluginNames(); + System.out.println("Removing non-Maven projects..."); + plugins.removeIf(plugin -> !PluginUpdater.isMaven(plugin, "master")); + System.out.println(plugins.stream().collect(Collectors.joining("\n"))); + for (String plugin : plugins) { //TODO: We don't want to apply it all at once, especially to unused/unowned repos + } //TODO: Add it to ButtonCore - or actually as a plugin or ButtonProcessor + } +} diff --git a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java index b6a744f..f39e430 100755 --- a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java +++ b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java @@ -1,5 +1,6 @@ package buttondevteam.core; +import buttondevteam.lib.PluginUpdater; import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.chat.Channel; import buttondevteam.lib.chat.ChatRoom; @@ -11,6 +12,10 @@ import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import java.util.logging.Logger; public class MainPlugin extends JavaPlugin { @@ -55,6 +60,20 @@ public class MainPlugin extends JavaPlugin { logger.info("Saving player data..."); TBMCPlayerBase.savePlayers(); logger.info("Player data saved."); + new Thread(() -> { + File[] files = PluginUpdater.updatedir.listFiles(); + if (files == null) + return; + System.out.println("Updating " + files.length + " plugins..."); + for (File file : files) { + try { + Files.move(file.toPath(), new File("plugins").toPath(), StandardCopyOption.REPLACE_EXISTING) + } catch (IOException e) { + e.printStackTrace(); + } + } + System.out.println("Update complete!"); + }); } private boolean setupPermissions() { diff --git a/ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java b/ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java index ba5ea90..bde9b71 100755 --- a/ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/PluginUpdater.java @@ -14,8 +14,6 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -24,11 +22,15 @@ public class PluginUpdater { private PluginUpdater() { } - private static final File updatedir = new File("updateplugins"); + public static final File updatedir = new File("TBMC", "pluginupdates"); /** * See {@link TBMCCoreAPI#UpdatePlugin(String, CommandSender, String)} */ public static boolean UpdatePlugin(String name, CommandSender sender, String branch) { + if (!updatedir.exists() && !updatedir.mkdirs()) { + error(sender, "Failed to create update directory!"); + return false; + } info(sender, "Checking plugin name..."); List plugins = GetPluginNames(); String correctname = null; @@ -64,9 +66,7 @@ public class PluginUpdater { private static boolean updatePluginJitPack(CommandSender sender, String correctname, String correctbranch) { URL url; - final boolean isWindows = System.getProperty("os.name").contains("Windows"); - File result = new File("plugins/" + correctname + (isWindows ? ".jar" : ".jar_tmp")); - File finalresult = new File("plugins/" + correctname + ".jar"); + File result = new File(updatedir, correctname + ".jar"); try { url = new URL("https://jitpack.io/com/github/TBMCPlugins/" + (correctname.equals("ButtonCore") ? "ButtonCore/ButtonCore" : correctname) + "/" @@ -78,8 +78,6 @@ public class PluginUpdater { + " is too small (smnaller than 25 bytes). Am I downloading from the right place?"); return false; } else { - if (!isWindows) - Files.move(result.toPath(), finalresult.toPath(), StandardCopyOption.REPLACE_EXISTING); info(sender, "Updating plugin " + correctname + " from " + correctbranch + " done!"); return true; } diff --git a/pom.xml b/pom.xml index 672f423..1da127a 100755 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ ButtonCore ButtonProcessor + BuildConfigUpdater From 75ab715c6e0e7a4a3aead88c87fe58512a51ffb2 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Tue, 15 May 2018 22:44:55 +0200 Subject: [PATCH 4/4] Plugin list gen, fixes It'll generate a plugin list file on each start #37 --- ...net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml | 6 +- ...igotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml | 6 +- .idea/misc.xml | 9 +- .idea/modules.xml | 1 - BuildConfigUpdater/BuildConfigUpdater.iml | 3 +- .../java/buttondevteam/core/MainPlugin.java | 13 +- .../java/buttondevteam/lib/chat/Channel.java | 187 +++++++++--------- ButtonProcessor/ButtonProcessor.iml | 1 + .../buttonproc/ButtonProcessor.java | 58 ++++-- 9 files changed, 156 insertions(+), 128 deletions(-) diff --git a/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml index befe1ab..dbefdef 100644 --- a/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml +++ b/.idea/libraries/Maven__net_md_5_bungeecord_chat_1_12_SNAPSHOT.xml @@ -1,13 +1,13 @@ - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml index ed73ade..b6f88ae 100644 --- a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml +++ b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml @@ -1,13 +1,13 @@ - + - + - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 9896aeb..dd45459 100755 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -6,6 +6,13 @@ + + + + - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 3dc26c2..0b24af5 100755 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -3,7 +3,6 @@ - diff --git a/BuildConfigUpdater/BuildConfigUpdater.iml b/BuildConfigUpdater/BuildConfigUpdater.iml index 4902d56..56fbaa2 100644 --- a/BuildConfigUpdater/BuildConfigUpdater.iml +++ b/BuildConfigUpdater/BuildConfigUpdater.iml @@ -11,7 +11,8 @@ - + + diff --git a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java index f39e430..c2eded4 100755 --- a/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java +++ b/ButtonCore/src/main/java/buttondevteam/core/MainPlugin.java @@ -8,6 +8,7 @@ import buttondevteam.lib.chat.Color; import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.player.TBMCPlayerBase; import net.milkbowl.vault.permission.Permission; +import org.bukkit.Bukkit; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; @@ -16,7 +17,9 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardCopyOption; +import java.util.Arrays; import java.util.logging.Logger; +import java.util.stream.Collectors; public class MainPlugin extends JavaPlugin { public static MainPlugin Instance; @@ -52,6 +55,11 @@ public class MainPlugin extends JavaPlugin { TBMCChatAPI.RegisterChatChannel(new ChatRoom("§aGREEN", Color.Green, "green")); TBMCChatAPI.RegisterChatChannel(new ChatRoom("§bBLUE", Color.Blue, "blue")); TBMCChatAPI.RegisterChatChannel(new ChatRoom("§5PURPLE", Color.DarkPurple, "purple")); + try { + Files.write(new File("plugins", "plugins.txt").toPath(), Arrays.stream(Bukkit.getPluginManager().getPlugins()).map(p -> (CharSequence) p.getDataFolder().getName())::iterator); + } catch (IOException e) { + TBMCCoreAPI.SendException("Failed to write plugin list!", e); + } logger.info(pdfFile.getName() + " has been Enabled (V." + pdfFile.getVersion() + ") Test: " + Test + "."); } @@ -67,13 +75,14 @@ public class MainPlugin extends JavaPlugin { System.out.println("Updating " + files.length + " plugins..."); for (File file : files) { try { - Files.move(file.toPath(), new File("plugins").toPath(), StandardCopyOption.REPLACE_EXISTING) + Files.move(file.toPath(), new File("plugins", file.getName()).toPath(), StandardCopyOption.REPLACE_EXISTING); + System.out.println("Updated " + file.getName()); } catch (IOException e) { e.printStackTrace(); } } System.out.println("Update complete!"); - }); + }).start(); } private boolean setupPermissions() { diff --git a/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java b/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java index 5990116..b654d47 100755 --- a/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/chat/Channel.java @@ -14,113 +14,106 @@ import java.util.function.Function; import java.util.function.Predicate; public class Channel { - public final String DisplayName; - public final Color color; - public final String ID; - public @Nullable - String[] IDs; - /** - * Filters both the sender and the targets - */ - public final Function filteranderrormsg; + public final String DisplayName; + public final Color color; + public final String ID; + @Nullable + public String[] IDs; + /** + * Filters both the sender and the targets + */ + public final Function filteranderrormsg; - private static List channels = new ArrayList<>(); + private static List channels = new ArrayList<>(); - /** - * Creates a channel. - * - * @param displayname - * The name that should appear at the start of the message. A chat color is expected at the beginning (§9). - * @param color - * The default color of the messages sent in the channel - * @param command - * The command to be used for the channel without /. For example "mod". It's also used for scoreboard objective names. - * @param filteranderrormsg - * Checks all senders against the criteria provided here and sends the message if the index matches the sender's - if no score at all, displays the error.
- * May be null to send to everyone. - */ - public Channel(String displayname, Color color, String command, - Function filteranderrormsg) { - DisplayName = displayname; - this.color = color; - ID = command; - this.filteranderrormsg = filteranderrormsg; - } + /** + * Creates a channel. + * + * @param displayname The name that should appear at the start of the message. A chat color is expected at the beginning (§9). + * @param color The default color of the messages sent in the channel + * @param command The command to be used for the channel without /. For example "mod". It's also used for scoreboard objective names. + * @param filteranderrormsg Checks all senders against the criteria provided here and sends the message if the index matches the sender's - if no score at all, displays the error.
+ * May be null to send to everyone. + */ + public Channel(String displayname, Color color, String command, + Function filteranderrormsg) { + DisplayName = displayname; + this.color = color; + ID = command; + this.filteranderrormsg = filteranderrormsg; + } - /** - * Must be only called from a subclass - otherwise it'll throw an exception. - * - * @see Channel#Channel(String, Color, String, Function) - */ - @SuppressWarnings("unchecked") - protected Channel(String displayname, Color color, String command, - BiFunction filteranderrormsg) { - DisplayName = displayname; - this.color = color; - ID = command; - this.filteranderrormsg = s -> filteranderrormsg.apply((T) this, s); - } + /** + * Must be only called from a subclass - otherwise it'll throw an exception. + * + * @see Channel#Channel(String, Color, String, Function) + */ + @SuppressWarnings("unchecked") + protected Channel(String displayname, Color color, String command, + BiFunction filteranderrormsg) { + DisplayName = displayname; + this.color = color; + ID = command; + this.filteranderrormsg = s -> filteranderrormsg.apply((T) this, s); + } - public static List getChannels() { - return channels; - } + public static List getChannels() { + return channels; + } - /** - * Convenience method for the function parameter of {@link #Channel(String, Color, String, Function)}. It checks if the sender is OP or optionally has the specified group. The error message is - * generated automatically. - * - * @param permgroup - * The group that can access the channel or null to only allow OPs. - * @return - */ - public static Function inGroupFilter(String permgroup) { - return noScoreResult( - s -> s.isOp() || (permgroup != null - ? s instanceof Player && MainPlugin.permission.playerInGroup((Player) s, permgroup) : false), - "You need to be a(n) " + (permgroup != null ? permgroup : "OP") + " to use this channel."); - } + /** + * Convenience method for the function parameter of {@link #Channel(String, Color, String, Function)}. It checks if the sender is OP or optionally has the specified group. The error message is + * generated automatically. + * + * @param permgroup The group that can access the channel or null to only allow OPs. + * @return + */ + public static Function inGroupFilter(String permgroup) { + return noScoreResult( + s -> s.isOp() || (permgroup != null + ? s instanceof Player && MainPlugin.permission.playerInGroup((Player) s, permgroup) : false), + "You need to be a(n) " + (permgroup != null ? permgroup : "OP") + " to use this channel."); + } - public static Function noScoreResult(Predicate filter, - String errormsg) { - return s -> filter.test(s) ? new RecipientTestResult(0) : new RecipientTestResult(errormsg); - } + public static Function noScoreResult(Predicate filter, + String errormsg) { + return s -> filter.test(s) ? new RecipientTestResult(0) : new RecipientTestResult(errormsg); + } - public static BiFunction noScoreResult( - BiPredicate filter, String errormsg) { - return (this_, s) -> filter.test(this_, s) ? new RecipientTestResult(0) : new RecipientTestResult(errormsg); - } + public static BiFunction noScoreResult( + BiPredicate filter, String errormsg) { + return (this_, s) -> filter.test(this_, s) ? new RecipientTestResult(0) : new RecipientTestResult(errormsg); + } - public static Channel GlobalChat; - public static Channel AdminChat; - public static Channel ModChat; + public static Channel GlobalChat; + public static Channel AdminChat; + public static Channel ModChat; - static void RegisterChannel(Channel channel) { - channels.add(channel); - Bukkit.getPluginManager().callEvent(new ChatChannelRegisterEvent(channel)); - } + static void RegisterChannel(Channel channel) { + channels.add(channel); + Bukkit.getPluginManager().callEvent(new ChatChannelRegisterEvent(channel)); + } - public static class RecipientTestResult { - public String errormessage; - public int score; + public static class RecipientTestResult { + public String errormessage; + public int score; - /** - * Creates a result that indicates an error - * - * @param errormessage - * The error message to show the sender if they don't meet the criteria. - */ - public RecipientTestResult(String errormessage) { - this.errormessage = errormessage; - } + /** + * Creates a result that indicates an error + * + * @param errormessage The error message to show the sender if they don't meet the criteria. + */ + public RecipientTestResult(String errormessage) { + this.errormessage = errormessage; + } - /** - * Creates a result that indicates a success - * - * @param score - * The score that identifies the target group. For example, the index of the town or nation to send to. - */ - public RecipientTestResult(int score) { - this.score = score; - } - } + /** + * Creates a result that indicates a success + * + * @param score The score that identifies the target group. For example, the index of the town or nation to send to. + */ + public RecipientTestResult(int score) { + this.score = score; + } + } } diff --git a/ButtonProcessor/ButtonProcessor.iml b/ButtonProcessor/ButtonProcessor.iml index 52184f9..cc79963 100755 --- a/ButtonProcessor/ButtonProcessor.iml +++ b/ButtonProcessor/ButtonProcessor.iml @@ -1,5 +1,6 @@ + diff --git a/ButtonProcessor/src/main/java/buttondevteam/buttonproc/ButtonProcessor.java b/ButtonProcessor/src/main/java/buttondevteam/buttonproc/ButtonProcessor.java index bd05e9c..63c0950 100755 --- a/ButtonProcessor/src/main/java/buttondevteam/buttonproc/ButtonProcessor.java +++ b/ButtonProcessor/src/main/java/buttondevteam/buttonproc/ButtonProcessor.java @@ -1,5 +1,9 @@ package buttondevteam.buttonproc; +import java.util.List; +import java.util.Set; +import java.util.function.Function; + import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; @@ -7,29 +11,43 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; +import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeElement; -import java.util.List; -import java.util.Set; +import javax.lang.model.util.Elements; +import javax.tools.Diagnostic.Kind; -/** * A simple session bean type annotation processor. The implementation * is based on the standard annotation processing API in Java 6. */ -@SupportedSourceVersion(SourceVersion.RELEASE_8) @SupportedAnnotationTypes("buttondevteam.*") public class ButtonProcessor extends AbstractProcessor { - /** * Check if both @Stateful and @Stateless are present in an * session bean. If so, emits a warning message. */ @Override - public boolean process(Set typeElements, RoundEnvironment roundEnv) { // TODO: SEparate JAR - for (TypeElement te : typeElements) { - Set elements = roundEnv.getElementsAnnotatedWith(te); - for (Element element : elements) { - System.out.println("Processing " + element); - List annotationMirrors = element.getAnnotationMirrors(); - System.out.println("Annotations: " + annotationMirrors); - for (AnnotationMirror annotation : annotationMirrors) { - String type = annotation.getAnnotationType().toString(); - System.out.println("Type: " + type); - } - } - } - return true; // claim the annotations - } + public boolean process(Set annotations, RoundEnvironment roundEnv) { + for (TypeElement te : annotations) { + Set classes = roundEnv.getElementsAnnotatedWith(te); + for (Element targetcl : classes) { + System.out.println("Processing " + targetcl); + List annotationMirrors = processingEnv.getElementUtils() + .getAllAnnotationMirrors(targetcl); + System.out.println("Annotations: " + annotationMirrors); + Function hasAnnotation = ann -> annotationMirrors.stream() + .anyMatch(am -> am.getAnnotationType().toString().contains(ann)); + if (hasAnnotation.apply("ChromaGamerEnforcer") && !hasAnnotation.apply("UserClass") + && !targetcl.getModifiers().contains(Modifier.ABSTRACT)) + processingEnv.getMessager().printMessage(Kind.ERROR, + "No UserClass annotation found for " + targetcl.getSimpleName(), targetcl); + if (hasAnnotation.apply("TBMCPlayerEnforcer") && !hasAnnotation.apply("PlayerClass") + && !targetcl.getModifiers().contains(Modifier.ABSTRACT)) + processingEnv.getMessager().printMessage(Kind.ERROR, + "No PlayerClass annotation found for " + targetcl.getSimpleName(), targetcl); + for (AnnotationMirror annotation : annotationMirrors) { + String type = annotation.getAnnotationType().toString(); + System.out.println("Type: " + type); + } + } + } + return true; // claim the annotations + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latestSupported(); + } }