Added some prints for debugging.

This commit is contained in:
Tobias Ottenweller 2013-06-23 18:07:18 +02:00
parent afe693d491
commit 09b9c65ef6
6 changed files with 14 additions and 9 deletions

View File

@ -306,7 +306,11 @@ public class GatesManager
protected void addGateByLocations(final Gate g) 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); SimpleLocation sl = new SimpleLocation(l);
gatesByLocation.put(sl, g); gatesByLocation.put(sl, g);
} }

View File

@ -73,5 +73,7 @@ public class CommandInfo extends BaseCommand
gate.getExit().getWorld().getName()); gate.getExit().getWorld().getName());
else else
sendMessage(ChatColor.DARK_AQUA + "NOTE: this gate has no exit"); sendMessage(ChatColor.DARK_AQUA + "NOTE: this gate has no exit");
System.out.println("frame: " + gate.getGateFrameBlocks());
} }
} }

View File

@ -77,6 +77,7 @@ public class CommandLocation extends BaseLocationCommand
} }
Plugin.getPlugin().getGatesManager().handleGateLocationChange(gate, oldLocation, oldGateBlockLocations, oldFrameBlocks); 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."); 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()); Plugin.log(Level.WARNING, e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
GateBlockChangeSender.updateGateBlocks(gate);
} }
} }

View File

@ -58,7 +58,6 @@ public class CommandNew extends BaseLocationCommand
} }
gate = new Gate(id); gate = new Gate(id);
gatesManager.handleNewGate(gate);
sendMessage(ChatColor.GREEN + "Gate with id '" + id + "' was created."); 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("Now you should build a frame and execute:");
sendMessage(new CommandLocation().getUsageTemplate(true, true)); sendMessage(new CommandLocation().getUsageTemplate(true, true));
} }
gatesManager.handleNewGate(gate);
} }
} }

View File

@ -45,14 +45,12 @@ public class CommandOpen extends BaseCommand
public void perform() public void perform()
{ {
try try {
{
gate.setOpen(true); gate.setOpen(true);
GateBlockChangeSender.updateGateBlocks(gate); GateBlockChangeSender.updateGateBlocks(gate);
sendMessage(ChatColor.GREEN + "The gate was opened."); sendMessage(ChatColor.GREEN + "The gate was opened.");
} }
catch (Exception e) catch (Exception e) {
{
sendMessage(ChatColor.RED + e.getMessage()); sendMessage(ChatColor.RED + e.getMessage());
} }
} }

View File

@ -48,7 +48,6 @@ public class PlayerMoveListener implements Listener
GateBlockChangeSender.updateGateBlocks(event.getPlayer(), event.getTo()); GateBlockChangeSender.updateGateBlocks(event.getPlayer(), event.getTo());
} }
GatesManager gateManager = Plugin.getPlugin().getGatesManager(); GatesManager gateManager = Plugin.getPlugin().getGatesManager();
Gate gateAtLocation = gateManager.getGateAtLocation(event.getTo()); Gate gateAtLocation = gateManager.getGateAtLocation(event.getTo());
@ -60,6 +59,8 @@ public class PlayerMoveListener implements Listener
return; return;
} }
System.out.println("player: " + event.getPlayer() + " location: " + event.getTo());
// Check for permission // Check for permission
if (!hasPermission(event.getPlayer(), gateAtLocation) if (!hasPermission(event.getPlayer(), gateAtLocation)