Registering the formatter component

Only disabling the chat handler if the component is enabled
This commit is contained in:
Norbi Peti 2019-09-30 15:55:25 +02:00
parent aa455e373d
commit a91ee1b842
3 changed files with 6 additions and 4 deletions

View file

@ -28,7 +28,7 @@
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version> <version>3.8.1</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>

View file

@ -10,6 +10,7 @@ import buttondevteam.chat.commands.ucmds.admin.DebugCommand;
import buttondevteam.chat.components.announce.AnnouncerComponent; import buttondevteam.chat.components.announce.AnnouncerComponent;
import buttondevteam.chat.components.appendext.AppendTextComponent; import buttondevteam.chat.components.appendext.AppendTextComponent;
import buttondevteam.chat.components.flair.FlairComponent; import buttondevteam.chat.components.flair.FlairComponent;
import buttondevteam.chat.components.formatter.FormatterComponent;
import buttondevteam.chat.components.fun.FunComponent; import buttondevteam.chat.components.fun.FunComponent;
import buttondevteam.chat.components.towncolors.TownColorComponent; import buttondevteam.chat.components.towncolors.TownColorComponent;
import buttondevteam.chat.components.towny.TownyComponent; 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 PlayerListener(), this);
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this); TBMCCoreAPI.RegisterEventsForExceptions(new PlayerJoinLeaveListener(), this);
MainPlugin.Instance.setChatHandlerEnabled(false); //Disable Core chat handler
Console = this.getServer().getConsoleSender(); Console = this.getServer().getConsoleSender();
if (Bukkit.getPluginManager().isPluginEnabled("Towny")) 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 AnnouncerComponent());
Component.registerComponent(this, new FunComponent()); Component.registerComponent(this, new FunComponent());
Component.registerComponent(this, new AppendTextComponent()); Component.registerComponent(this, new AppendTextComponent());
Component.registerComponent(this, new FormatterComponent());
getCommand2MC().registerCommand(new DebugCommand()); getCommand2MC().registerCommand(new DebugCommand());
getCommand2MC().registerCommand(new HelpCommand()); getCommand2MC().registerCommand(new HelpCommand());
getCommand2MC().registerCommand(new HistoryCommand()); getCommand2MC().registerCommand(new HistoryCommand());

View file

@ -2,6 +2,7 @@ package buttondevteam.chat.components.formatter;
import buttondevteam.chat.PluginMain; import buttondevteam.chat.PluginMain;
import buttondevteam.core.ComponentManager; import buttondevteam.core.ComponentManager;
import buttondevteam.core.MainPlugin;
import buttondevteam.lib.TBMCChatEvent; import buttondevteam.lib.TBMCChatEvent;
import buttondevteam.lib.architecture.Component; import buttondevteam.lib.architecture.Component;
import buttondevteam.lib.architecture.ConfigData; import buttondevteam.lib.architecture.ConfigData;
@ -17,12 +18,12 @@ public class FormatterComponent extends Component<PluginMain> {
@Override @Override
protected void enable() { protected void enable() {
MainPlugin.Instance.setChatHandlerEnabled(false); //Disable Core chat handler - if this component is disabled then let it do it's job
} }
@Override @Override
protected void disable() { protected void disable() {
MainPlugin.Instance.setChatHandlerEnabled(true);
} }
/** /**