Start work on refactoring the list command.

This commit is contained in:
Tobias Ottenweller 2013-04-05 21:51:18 +02:00
parent 6373f98894
commit 4d40b140fa

View File

@ -7,6 +7,7 @@ import java.util.List;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.world.WorldEvent;
import de.craftinc.gates.Gate; import de.craftinc.gates.Gate;
import de.craftinc.gates.Plugin; import de.craftinc.gates.Plugin;
@ -61,11 +62,17 @@ public class CommandList extends BaseCommand
for (Gate gate : gatesCopy) { for (Gate gate : gatesCopy) {
if (!Plugin.permission.has(gate.getLocation().getWorld(), p.getName(), this.requiredPermission)) String gateLocationWorld = gate.getLocation().getWorld();
boolean permissionAtGateLocation = Plugin.permission.has(gateLocationWorld, p.getName(), this.requiredPermission);
if (!permissionAtGateLocation)
{ {
gates.remove(gate); gates.remove(gate);
continue;
} }
else if (gate.getExit() != null && !Plugin.permission.has(gate.getExit().getWorld(), p.getName(), this.requiredPermission))
boolean permissionAtGateExit = gate.getExit() != null && !Plugin.permission.has(gate.getExit().getWorld(), p.getName(), this.requiredPermission);
if (!permissionAtGateExit)
{ {
gates.remove(gate); gates.remove(gate);
} }