Last active
August 29, 2015 14:00
-
-
Save Jikoo/ae1a78f6d685c461a981 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.jikoo.chesterfix; | |
import info.gomeow.chester.API.ChesterLogEvent; | |
import java.util.List; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.Listener; | |
import org.bukkit.plugin.java.JavaPlugin; | |
/** | |
* Tiny plugin that fixes Chester locking up servers. Does not fix chester.brain! | |
* | |
* @author Jikoo | |
*/ | |
public class ChesterFix extends JavaPlugin implements Listener { | |
private List<String> triggers; | |
@Override | |
public void onEnable() { | |
if (!this.getServer().getPluginManager().isPluginEnabled("Chester")) { | |
this.getLogger().warning("Chester not found! Disabling ChesterFix..."); | |
this.getServer().getPluginManager().disablePlugin(this); | |
return; | |
} | |
triggers = this.getServer().getPluginManager().getPlugin("Chester").getConfig().getStringList("triggerwords"); | |
this.getServer().getPluginManager().registerEvents(this, this); | |
} | |
@Override | |
public void onDisable() { | |
triggers = null; | |
} | |
@EventHandler | |
public void onChesterLog(ChesterLogEvent event) { | |
for (String s : triggers) { | |
if (event.getMessage().equalsIgnoreCase(s)) { | |
this.getLogger().info("Not logging: Chat equals trigger \"" + event.getMessage() + "\""); | |
event.setCancelled(true); | |
return; | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ChesterFix | |
main: com.github.jikoo.chesterfix.ChesterFix | |
version: 1.0 | |
author: Jikoo | |
depend: [Chester] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment