Enable optional logging in ChatLogHandler

Modified the ChatLogHandler to support optional logging by introducing a new argument in the getInstance() method. This argument sets the logging state during instantiation. This facilitates better flexibility when using the ChatLogHandler across different sections of the code base as logging requirements may differ.
This commit is contained in:
2024-04-07 18:11:19 +02:00
parent c25767e473
commit c057c69653
3 changed files with 12 additions and 6 deletions
@@ -39,7 +39,7 @@ public class ChatPlugin extends JavaPlugin {
chatHandler = new ChatHandler();
DatabaseConnection.initialize();
serverConfig = new ServerConfig(Bukkit.getServerName());
ChatLogHandler chatLogHandler = ChatLogHandler.getInstance();
ChatLogHandler chatLogHandler = ChatLogHandler.getInstance(true);
registerListener(new PlayerListener(serverConfig), new ChatListener(chatLogHandler), new BookListener(), new ShutdownListener(chatLogHandler));
if(serverConfig.GLOBALCHAT) {
registerCommand("globalchat", new GlobalChat());