/com/daveblencowe/cleankraft/CleanKraft.java
https://bitbucket.org/dblencowe/cleankraft · Java · 80 lines · 66 code · 14 blank · 0 comment · 12 complexity · fa2812b43a5a08b8b8c6896c3b8b38ee MD5 · raw file
- package com.daveblencowe.cleankraft;
- import java.util.logging.Logger;
- import org.apache.commons.lang.StringUtils;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.plugin.java.JavaPlugin;
- public class CleanKraft extends JavaPlugin {
- final static String PLUGIN_NAME = "CleanKraft";
- final static String AUTHOR = "dblencowe";
- final static String VERSION = "1.0";
- public static Logger log = Logger.getLogger("Minecraft");
- public static ChatListener chatlistener = null;
-
- @Override
- public void onEnable () {
- Config.loadConfig(this);
- chatlistener = new ChatListener(this);
- log.info(PLUGIN_NAME+" "+VERSION+" enabled");
- }
-
- @Override
- public void onDisable () {
- log.info(PLUGIN_NAME+" "+VERSION+" disabled");
- }
-
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (cmd.getName().toLowerCase().equals("cleankraft")) {
-
- String prefix = "["+ChatColor.GREEN+CleanKraft.PLUGIN_NAME+ChatColor.WHITE+"] ";
-
- if (args.length == 0) {
- sender.sendMessage(prefix+CleanKraft.PLUGIN_NAME+" "+CleanKraft.VERSION+" by "+CleanKraft.AUTHOR);
- return true;
- }
-
- switch (args[0]) {
- case "kickweight":
- sender.sendMessage(prefix+"Current kick weight is "+Config.kickWeight);
- break;
- case "add":
- if (sender.hasPermission("cleankraft.add")) {
- Config.addWord(this, args[1]);
- sender.sendMessage(prefix+"Added word to list");
- } else sender.sendMessage(Config.permissionDenied);
- break;
- case "remove":
- if (sender.hasPermission("cleankraft.remove")) {
- Config.removeWord(this, args[1]);
- sender.sendMessage(prefix+"Removed word from list");
- } else sender.sendMessage(Config.permissionDenied);
- break;
- case "list":
- if (sender.hasPermission("cleankraft.list")) {
- String words = StringUtils.join(Config.naughtyWords, ", ");
- sender.sendMessage(prefix+words);
- } else sender.sendMessage(Config.permissionDenied);
- break;
- case "reload":
- if (sender.hasPermission("cleankraft.reload")) {
- Config.loadConfig(this);
- sender.sendMessage(prefix+"Reloaded from configuration file");
- } else sender.sendMessage(Config.permissionDenied);
- default:
- sender.sendMessage(prefix+CleanKraft.PLUGIN_NAME+" "+CleanKraft.VERSION+" by "+CleanKraft.AUTHOR);
- break;
- }
- return true;
-
- }
- return false;
- }
-
-
- }