From 4d40b140fa3debabc243d7126b4dfc403d23e98b Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Fri, 5 Apr 2013 21:51:18 +0200 Subject: [PATCH] Start work on refactoring the list command. --- src/de/craftinc/gates/commands/CommandList.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/de/craftinc/gates/commands/CommandList.java b/src/de/craftinc/gates/commands/CommandList.java index 4f4fe3e..988ae3b 100644 --- a/src/de/craftinc/gates/commands/CommandList.java +++ b/src/de/craftinc/gates/commands/CommandList.java @@ -7,6 +7,7 @@ import java.util.List; import org.bukkit.ChatColor; import org.bukkit.entity.Player; +import org.bukkit.event.world.WorldEvent; import de.craftinc.gates.Gate; import de.craftinc.gates.Plugin; @@ -61,11 +62,17 @@ public class CommandList extends BaseCommand 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); + 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); }