From 5b31c95079991ee14c93ff48df8193777b34f05a Mon Sep 17 00:00:00 2001 From: Shevchik Date: Thu, 15 Jan 2015 13:07:45 +0400 Subject: [PATCH] Remove chairs ignore list. Definitely won't port this to uuid. Instead will use some temporaly metadata system i think. --- .../cnaude/chairs/commands/ChairsCommand.java | 23 +------------- .../chairs/commands/ChairsIgnoreList.java | 31 ------------------- src/com/cnaude/chairs/core/Chairs.java | 10 ++---- .../chairs/listeners/TrySitEventListener.java | 10 +----- 4 files changed, 4 insertions(+), 70 deletions(-) delete mode 100644 src/com/cnaude/chairs/commands/ChairsIgnoreList.java diff --git a/src/com/cnaude/chairs/commands/ChairsCommand.java b/src/com/cnaude/chairs/commands/ChairsCommand.java index d2b1dbc..014ea90 100644 --- a/src/com/cnaude/chairs/commands/ChairsCommand.java +++ b/src/com/cnaude/chairs/commands/ChairsCommand.java @@ -10,11 +10,9 @@ import com.cnaude.chairs.core.Chairs; public class ChairsCommand implements CommandExecutor { private final Chairs plugin; - public ChairsIgnoreList ignoreList; - public ChairsCommand(Chairs instance, ChairsIgnoreList ignoreList) { + public ChairsCommand(Chairs instance) { this.plugin = instance; - this.ignoreList = ignoreList; } @Override @@ -40,25 +38,6 @@ public class ChairsCommand implements CommandExecutor { sender.sendMessage(plugin.msgNoPerm); } } - if (sender instanceof Player) { - Player p = (Player) sender; - if (args[0].equalsIgnoreCase("on")) { - if (p.hasPermission("chairs.self")) { - ignoreList.removePlayer(p.getName()); - p.sendMessage(plugin.msgEnabled); - } else { - p.sendMessage(plugin.msgNoPerm); - } - } - if (args[0].equalsIgnoreCase("off")) { - if (p.hasPermission("chairs.self")) { - ignoreList.addPlayer(p.getName()); - p.sendMessage(plugin.msgDisabled); - } else { - p.sendMessage(plugin.msgNoPerm); - } - } - } return true; } diff --git a/src/com/cnaude/chairs/commands/ChairsIgnoreList.java b/src/com/cnaude/chairs/commands/ChairsIgnoreList.java deleted file mode 100644 index 8f6c49f..0000000 --- a/src/com/cnaude/chairs/commands/ChairsIgnoreList.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.cnaude.chairs.commands; - -import java.util.HashSet; - -public class ChairsIgnoreList { - - private static HashSet ignoreList = new HashSet(); - - public ChairsIgnoreList() { - } - - public void addPlayer(String s) { - if (ignoreList.contains(s)) { - return; - } - ignoreList.add(s); - } - - public void removePlayer(String s) { - ignoreList.remove(s); - } - - public boolean isIgnored(String s) { - if (ignoreList.contains(s)) { - return true; - } - else { - return false; - } - } -} \ No newline at end of file diff --git a/src/com/cnaude/chairs/core/Chairs.java b/src/com/cnaude/chairs/core/Chairs.java index 185c470..fca9270 100644 --- a/src/com/cnaude/chairs/core/Chairs.java +++ b/src/com/cnaude/chairs/core/Chairs.java @@ -16,7 +16,6 @@ import org.bukkit.plugin.java.JavaPlugin; import com.cnaude.chairs.api.APIInit; import com.cnaude.chairs.commands.ChairsCommand; -import com.cnaude.chairs.commands.ChairsIgnoreList; import com.cnaude.chairs.listeners.NANLoginListener; import com.cnaude.chairs.listeners.TrySitEventListener; import com.cnaude.chairs.listeners.TryUnsitEventListener; @@ -32,7 +31,6 @@ public class Chairs extends JavaPlugin { public boolean autoRotate, signCheck, notifyplayer; public boolean ignoreIfBlockInHand; public double distance; - public HashSet disabledRegions = new HashSet(); public int maxChairWidth; public boolean sitHealEnabled; public int sitMaxHealth; @@ -42,7 +40,6 @@ public class Chairs extends JavaPlugin { public boolean sitDisableAllCommands = false; public HashSet sitDisabledCommands = new HashSet(); private Logger log; - public ChairsIgnoreList ignoreList; public String msgSitting, msgStanding, msgOccupied, msgNoPerm, msgReloaded, msgDisabled, msgEnabled, msgCommandRestricted; @@ -66,7 +63,6 @@ public class Chairs extends JavaPlugin { return; } chairEffects = new ChairEffects(this); - ignoreList = new ChairsIgnoreList(); psitdata = new PlayerSitData(this); getConfig().options().copyDefaults(true); saveConfig(); @@ -78,10 +74,10 @@ public class Chairs extends JavaPlugin { chairEffects.startPickup(); } getServer().getPluginManager().registerEvents(new NANLoginListener(), this); - getServer().getPluginManager().registerEvents(new TrySitEventListener(this, ignoreList), this); + getServer().getPluginManager().registerEvents(new TrySitEventListener(this), this); getServer().getPluginManager().registerEvents(new TryUnsitEventListener(this), this); getServer().getPluginManager().registerEvents(new CommandRestrict(this), this); - getCommand("chairs").setExecutor(new ChairsCommand(this, ignoreList)); + getCommand("chairs").setExecutor(new ChairsCommand(this)); new APIInit().initAPI(getPlayerSitData()); } @@ -113,8 +109,6 @@ public class Chairs extends JavaPlugin { notifyplayer = config.getBoolean("notify-player"); ignoreIfBlockInHand = config.getBoolean("ignore-if-item-in-hand"); - disabledRegions = new HashSet(config.getStringList("disabledWGRegions")); - sitHealEnabled = config.getBoolean("sit-effects.healing.enabled", false); sitHealInterval = config.getInt("sit-effects.healing.interval",20); sitMaxHealth = config.getInt("sit-effects.healing.max-percent",100); diff --git a/src/com/cnaude/chairs/listeners/TrySitEventListener.java b/src/com/cnaude/chairs/listeners/TrySitEventListener.java index a6d02b1..d8ddfef 100644 --- a/src/com/cnaude/chairs/listeners/TrySitEventListener.java +++ b/src/com/cnaude/chairs/listeners/TrySitEventListener.java @@ -16,18 +16,15 @@ import org.bukkit.material.Stairs; import org.bukkit.material.Step; import org.bukkit.material.WoodenStep; -import com.cnaude.chairs.commands.ChairsIgnoreList; import com.cnaude.chairs.core.ChairBlock; import com.cnaude.chairs.core.Chairs; public class TrySitEventListener implements Listener { public Chairs plugin; - public ChairsIgnoreList ignoreList; - public TrySitEventListener(Chairs plugin, ChairsIgnoreList ignoreList) { + public TrySitEventListener(Chairs plugin) { this.plugin = plugin; - this.ignoreList = ignoreList; } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @@ -65,11 +62,6 @@ public class TrySitEventListener implements Listener { return false; } - // Check for /chairs off - if (ignoreList.isIgnored(player.getName())) { - return false; - } - // Sit occupied check if (plugin.getPlayerSitData().isBlockOccupied(block)) { player.sendMessage(plugin.msgOccupied.replace("%PLAYER%", plugin.getPlayerSitData().getPlayerOnChair(block).getName()));