From d24f0b8fd112c6aa56b629f6672d696e0820a642 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sun, 23 Jun 2013 18:47:17 +0200 Subject: [PATCH] Bugfix: new gates do not work when opening them. --- src/de/craftinc/gates/commands/CommandOpen.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/de/craftinc/gates/commands/CommandOpen.java b/src/de/craftinc/gates/commands/CommandOpen.java index 7ae8e2b..1876701 100644 --- a/src/de/craftinc/gates/commands/CommandOpen.java +++ b/src/de/craftinc/gates/commands/CommandOpen.java @@ -46,8 +46,19 @@ public class CommandOpen extends BaseCommand public void perform() { try { - gate.setOpen(true); + boolean needsGateManagerUpdate = false; + + if (gate.getGateBlockLocations().isEmpty()) { + needsGateManagerUpdate = true; + } + + gate.setOpen(true); GateBlockChangeSender.updateGateBlocks(gate); + + if (needsGateManagerUpdate) { + Plugin.getPlugin().getGatesManager().handleGateLocationChange(gate, null, null, null); + } + sendMessage(ChatColor.GREEN + "The gate was opened."); } catch (Exception e) {