Refine ChatPlugin and improve "vote to mute" logic
Modified ChatPlugin to include "thisPlugin" within the ShutdownListener initialization. Additionally, adjusted the mute vote failure message color from green to red in ActiveVoteToMute file and added a condition to return false if there are no votes. Also, made improvements to the pagination logic in the VoteToMuteStarter file. Lastly, improved the chat logging mechanics in ChatLogHandler by adding and refining various log information for capturing action details.
This commit is contained in:
@@ -40,7 +40,7 @@ public class ChatPlugin extends JavaPlugin {
|
||||
DatabaseConnection.initialize();
|
||||
serverConfig = new ServerConfig(Bukkit.getServerName());
|
||||
ChatLogHandler chatLogHandler = ChatLogHandler.getInstance(true);
|
||||
registerListener(new PlayerListener(serverConfig), new ChatListener(chatLogHandler), new BookListener(), new ShutdownListener(chatLogHandler));
|
||||
registerListener(new PlayerListener(serverConfig), new ChatListener(chatLogHandler), new BookListener(), new ShutdownListener(chatLogHandler, this));
|
||||
if(serverConfig.GLOBALCHAT) {
|
||||
registerCommand("globalchat", new GlobalChat());
|
||||
registerCommand("toggleglobalchat", new ToggleGlobalChat());
|
||||
|
||||
@@ -4,17 +4,23 @@ import com.alttd.chat.objects.chat_log.ChatLogHandler;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class ShutdownListener implements Listener {
|
||||
|
||||
private final ChatLogHandler chatLogHandler;
|
||||
private final Plugin thisPlugin;
|
||||
|
||||
public ShutdownListener(ChatLogHandler chatLogHandler) {
|
||||
public ShutdownListener(ChatLogHandler chatLogHandler, Plugin thisPlugin) {
|
||||
this.chatLogHandler = chatLogHandler;
|
||||
this.thisPlugin = thisPlugin;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onShutdown(PluginDisableEvent event) {
|
||||
if (!event.getPlugin().getName().equals(thisPlugin.getName())){
|
||||
return;
|
||||
}
|
||||
chatLogHandler.shutDown();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user