Skip to content

Instantly share code, notes, and snippets.

@Jikoo
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jikoo/ae1a78f6d685c461a981 to your computer and use it in GitHub Desktop.
Save Jikoo/ae1a78f6d685c461a981 to your computer and use it in GitHub Desktop.
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;
}
}
}
}
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