From a91ee1b8421ec11fde9bc7564805e5bc2ea4cd68 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Mon, 30 Sep 2019 15:55:25 +0200 Subject: [PATCH] Registering the formatter component Only disabling the chat handler if the component is enabled --- pom.xml | 2 +- src/main/java/buttondevteam/chat/PluginMain.java | 3 ++- .../chat/components/formatter/FormatterComponent.java | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 9fca21e..7e928a4 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ maven-compiler-plugin - 3.3 + 3.8.1 1.8 1.8 diff --git a/src/main/java/buttondevteam/chat/PluginMain.java b/src/main/java/buttondevteam/chat/PluginMain.java index 89c4ed1..b6095a1 100644 --- a/src/main/java/buttondevteam/chat/PluginMain.java +++ b/src/main/java/buttondevteam/chat/PluginMain.java @@ -10,6 +10,7 @@ import buttondevteam.chat.commands.ucmds.admin.DebugCommand; import buttondevteam.chat.components.announce.AnnouncerComponent; import buttondevteam.chat.components.appendext.AppendTextComponent; import buttondevteam.chat.components.flair.FlairComponent; +import buttondevteam.chat.components.formatter.FormatterComponent; import buttondevteam.chat.components.fun.FunComponent; import buttondevteam.chat.components.towncolors.TownColorComponent; import buttondevteam.chat.components.towny.TownyComponent; @@ -52,7 +53,6 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15 TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this); TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this); - MainPlugin.Instance.setChatHandlerEnabled(false); //Disable Core chat handler Console = this.getServer().getConsoleSender(); if (Bukkit.getPluginManager().isPluginEnabled("Towny")) @@ -69,6 +69,7 @@ public class PluginMain extends ButtonPlugin { // Translated to Java: 2015.07.15 Component.registerComponent(this, new AnnouncerComponent()); Component.registerComponent(this, new FunComponent()); Component.registerComponent(this, new AppendTextComponent()); + Component.registerComponent(this, new FormatterComponent()); getCommand2MC().registerCommand(new DebugCommand()); getCommand2MC().registerCommand(new HelpCommand()); getCommand2MC().registerCommand(new HistoryCommand()); diff --git a/src/main/java/buttondevteam/chat/components/formatter/FormatterComponent.java b/src/main/java/buttondevteam/chat/components/formatter/FormatterComponent.java index fadc86c..6789b0d 100644 --- a/src/main/java/buttondevteam/chat/components/formatter/FormatterComponent.java +++ b/src/main/java/buttondevteam/chat/components/formatter/FormatterComponent.java @@ -2,6 +2,7 @@ package buttondevteam.chat.components.formatter; import buttondevteam.chat.PluginMain; import buttondevteam.core.ComponentManager; +import buttondevteam.core.MainPlugin; import buttondevteam.lib.TBMCChatEvent; import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.ConfigData; @@ -17,12 +18,12 @@ public class FormatterComponent extends Component { @Override protected void enable() { - + MainPlugin.Instance.setChatHandlerEnabled(false); //Disable Core chat handler - if this component is disabled then let it do it's job } @Override protected void disable() { - + MainPlugin.Instance.setChatHandlerEnabled(true); } /**