Remove chairs ignore list. Definitely won't port this to uuid. Instead
will use some temporaly metadata system i think.
This commit is contained in:
		| @@ -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; | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -1,31 +0,0 @@ | ||||
| package com.cnaude.chairs.commands; | ||||
|  | ||||
| import java.util.HashSet; | ||||
|  | ||||
| public class ChairsIgnoreList { | ||||
|  | ||||
| 	private static HashSet<String> ignoreList = new HashSet<String>(); | ||||
|  | ||||
| 	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; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| @@ -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<String> disabledRegions = new HashSet<String>(); | ||||
| 	public int maxChairWidth; | ||||
| 	public boolean sitHealEnabled; | ||||
| 	public int sitMaxHealth; | ||||
| @@ -42,7 +40,6 @@ public class Chairs extends JavaPlugin { | ||||
| 	public boolean sitDisableAllCommands = false; | ||||
| 	public HashSet<String> sitDisabledCommands = new HashSet<String>(); | ||||
| 	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<String>(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); | ||||
|   | ||||
| @@ -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())); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Shevchik
					Shevchik