From 09b9c65ef650cb7b0adad19d4de6111c8deee2bd Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sun, 23 Jun 2013 18:07:18 +0200 Subject: [PATCH] Added some prints for debugging. --- src/de/craftinc/gates/GatesManager.java | 6 +++++- src/de/craftinc/gates/commands/CommandInfo.java | 2 ++ src/de/craftinc/gates/commands/CommandLocation.java | 3 +-- src/de/craftinc/gates/commands/CommandNew.java | 3 ++- src/de/craftinc/gates/commands/CommandOpen.java | 6 ++---- src/de/craftinc/gates/listeners/PlayerMoveListener.java | 3 ++- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/de/craftinc/gates/GatesManager.java b/src/de/craftinc/gates/GatesManager.java index e2bac0e..d5bc73a 100644 --- a/src/de/craftinc/gates/GatesManager.java +++ b/src/de/craftinc/gates/GatesManager.java @@ -306,7 +306,11 @@ public class GatesManager protected void addGateByLocations(final Gate g) { - for (Location l : g.getGateBlockLocations()) { + if (g.getGateBlockLocations().isEmpty()) { + System.out.println("gate has no block locations!"); + } + + for (Location l : g.getGateBlockLocations()) { SimpleLocation sl = new SimpleLocation(l); gatesByLocation.put(sl, g); } diff --git a/src/de/craftinc/gates/commands/CommandInfo.java b/src/de/craftinc/gates/commands/CommandInfo.java index d8893ee..8f97065 100644 --- a/src/de/craftinc/gates/commands/CommandInfo.java +++ b/src/de/craftinc/gates/commands/CommandInfo.java @@ -73,5 +73,7 @@ public class CommandInfo extends BaseCommand gate.getExit().getWorld().getName()); else sendMessage(ChatColor.DARK_AQUA + "NOTE: this gate has no exit"); + + System.out.println("frame: " + gate.getGateFrameBlocks()); } } diff --git a/src/de/craftinc/gates/commands/CommandLocation.java b/src/de/craftinc/gates/commands/CommandLocation.java index 887d763..0f2f76d 100644 --- a/src/de/craftinc/gates/commands/CommandLocation.java +++ b/src/de/craftinc/gates/commands/CommandLocation.java @@ -77,6 +77,7 @@ public class CommandLocation extends BaseLocationCommand } Plugin.getPlugin().getGatesManager().handleGateLocationChange(gate, oldLocation, oldGateBlockLocations, oldFrameBlocks); + GateBlockChangeSender.updateGateBlocks(gate); sendMessage(ChatColor.GREEN + "The location of '" + gate.getId() + "' is now at your current location."); } @@ -86,8 +87,6 @@ public class CommandLocation extends BaseLocationCommand Plugin.log(Level.WARNING, e.getMessage()); e.printStackTrace(); } - - GateBlockChangeSender.updateGateBlocks(gate); } } diff --git a/src/de/craftinc/gates/commands/CommandNew.java b/src/de/craftinc/gates/commands/CommandNew.java index a61a960..56813b3 100644 --- a/src/de/craftinc/gates/commands/CommandNew.java +++ b/src/de/craftinc/gates/commands/CommandNew.java @@ -58,7 +58,6 @@ public class CommandNew extends BaseLocationCommand } gate = new Gate(id); - gatesManager.handleNewGate(gate); sendMessage(ChatColor.GREEN + "Gate with id '" + id + "' was created."); @@ -77,6 +76,8 @@ public class CommandNew extends BaseLocationCommand sendMessage("Now you should build a frame and execute:"); sendMessage(new CommandLocation().getUsageTemplate(true, true)); } + + gatesManager.handleNewGate(gate); } } diff --git a/src/de/craftinc/gates/commands/CommandOpen.java b/src/de/craftinc/gates/commands/CommandOpen.java index e8cec75..7ae8e2b 100644 --- a/src/de/craftinc/gates/commands/CommandOpen.java +++ b/src/de/craftinc/gates/commands/CommandOpen.java @@ -45,14 +45,12 @@ public class CommandOpen extends BaseCommand public void perform() { - try - { + try { gate.setOpen(true); GateBlockChangeSender.updateGateBlocks(gate); sendMessage(ChatColor.GREEN + "The gate was opened."); } - catch (Exception e) - { + catch (Exception e) { sendMessage(ChatColor.RED + e.getMessage()); } } diff --git a/src/de/craftinc/gates/listeners/PlayerMoveListener.java b/src/de/craftinc/gates/listeners/PlayerMoveListener.java index 6ed8859..a3fdce3 100644 --- a/src/de/craftinc/gates/listeners/PlayerMoveListener.java +++ b/src/de/craftinc/gates/listeners/PlayerMoveListener.java @@ -48,7 +48,6 @@ public class PlayerMoveListener implements Listener GateBlockChangeSender.updateGateBlocks(event.getPlayer(), event.getTo()); } - GatesManager gateManager = Plugin.getPlugin().getGatesManager(); Gate gateAtLocation = gateManager.getGateAtLocation(event.getTo()); @@ -60,6 +59,8 @@ public class PlayerMoveListener implements Listener return; } + System.out.println("player: " + event.getPlayer() + " location: " + event.getTo()); + // Check for permission if (!hasPermission(event.getPlayer(), gateAtLocation)