From 78283a4f347772e9c4d940ddd2b1bb11631c6c41 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sat, 15 Jun 2013 15:33:01 +0200 Subject: [PATCH] Send block changes on command execution. --- src/de/craftinc/gates/commands/CommandClose.java | 2 ++ src/de/craftinc/gates/commands/CommandDelete.java | 2 ++ src/de/craftinc/gates/commands/CommandOpen.java | 2 ++ src/de/craftinc/gates/commands/CommandSetExit.java | 4 +++- src/de/craftinc/gates/commands/CommandSetHidden.java | 2 ++ src/de/craftinc/gates/commands/CommandSetLocation.java | 3 +++ 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/de/craftinc/gates/commands/CommandClose.java b/src/de/craftinc/gates/commands/CommandClose.java index 03e0336..bc99a06 100644 --- a/src/de/craftinc/gates/commands/CommandClose.java +++ b/src/de/craftinc/gates/commands/CommandClose.java @@ -18,6 +18,7 @@ package de.craftinc.gates.commands; import java.util.logging.Level; +import de.craftinc.gates.util.GateBlockChangeSender; import org.bukkit.ChatColor; import de.craftinc.gates.Plugin; @@ -49,6 +50,7 @@ public class CommandClose extends BaseCommand try { gate.setOpen(false); + GateBlockChangeSender.updateGateBlocks(gate); sendMessage(ChatColor.GREEN + "The gate was closed."); } catch(Exception e) diff --git a/src/de/craftinc/gates/commands/CommandDelete.java b/src/de/craftinc/gates/commands/CommandDelete.java index fa6bc1f..02ef9db 100644 --- a/src/de/craftinc/gates/commands/CommandDelete.java +++ b/src/de/craftinc/gates/commands/CommandDelete.java @@ -16,6 +16,7 @@ */ package de.craftinc.gates.commands; +import de.craftinc.gates.util.GateBlockChangeSender; import org.bukkit.ChatColor; import de.craftinc.gates.Plugin; @@ -47,6 +48,7 @@ public class CommandDelete extends BaseCommand public void perform() { Plugin.getPlugin().getGatesManager().handleDeletion(gate); + GateBlockChangeSender.updateGateBlocks(gate); sendMessage(ChatColor.GREEN + "Gate with id '" + gate.getId() + "' was deleted."); } } diff --git a/src/de/craftinc/gates/commands/CommandOpen.java b/src/de/craftinc/gates/commands/CommandOpen.java index 188b504..e8cec75 100644 --- a/src/de/craftinc/gates/commands/CommandOpen.java +++ b/src/de/craftinc/gates/commands/CommandOpen.java @@ -17,6 +17,7 @@ package de.craftinc.gates.commands; +import de.craftinc.gates.util.GateBlockChangeSender; import org.bukkit.ChatColor; import de.craftinc.gates.Plugin; @@ -47,6 +48,7 @@ public class CommandOpen extends BaseCommand try { gate.setOpen(true); + GateBlockChangeSender.updateGateBlocks(gate); sendMessage(ChatColor.GREEN + "The gate was opened."); } catch (Exception e) diff --git a/src/de/craftinc/gates/commands/CommandSetExit.java b/src/de/craftinc/gates/commands/CommandSetExit.java index 8989aba..9804fe9 100644 --- a/src/de/craftinc/gates/commands/CommandSetExit.java +++ b/src/de/craftinc/gates/commands/CommandSetExit.java @@ -18,6 +18,7 @@ package de.craftinc.gates.commands; import java.util.logging.Level; +import de.craftinc.gates.util.GateBlockChangeSender; import org.bukkit.ChatColor; import de.craftinc.gates.Plugin; @@ -51,7 +52,8 @@ public class CommandSetExit extends BaseCommand sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand."); } catch (Exception e) { - sendMessage(ChatColor.RED + "Setting the exit for the gate failed! See server log for more information"); + GateBlockChangeSender.updateGateBlocks(gate); + sendMessage(ChatColor.RED + "Setting the exit for the gate failed! See server log for more information"); Plugin.log(Level.WARNING, e.getMessage()); e.printStackTrace(); } diff --git a/src/de/craftinc/gates/commands/CommandSetHidden.java b/src/de/craftinc/gates/commands/CommandSetHidden.java index 8a681e8..b8b3d89 100644 --- a/src/de/craftinc/gates/commands/CommandSetHidden.java +++ b/src/de/craftinc/gates/commands/CommandSetHidden.java @@ -18,6 +18,7 @@ package de.craftinc.gates.commands; import java.util.logging.Level; +import de.craftinc.gates.util.GateBlockChangeSender; import org.bukkit.ChatColor; import de.craftinc.gates.Plugin; @@ -46,6 +47,7 @@ public class CommandSetHidden extends BaseCommand try { gate.setHidden(true); + GateBlockChangeSender.updateGateBlocks(gate); sendMessage(ChatColor.GREEN + "The gate '" + gate.getId() + "' is now hidden."); } catch (Exception e) diff --git a/src/de/craftinc/gates/commands/CommandSetLocation.java b/src/de/craftinc/gates/commands/CommandSetLocation.java index 22d47c9..9c1d9e2 100644 --- a/src/de/craftinc/gates/commands/CommandSetLocation.java +++ b/src/de/craftinc/gates/commands/CommandSetLocation.java @@ -20,6 +20,7 @@ package de.craftinc.gates.commands; import java.util.Set; import java.util.logging.Level; +import de.craftinc.gates.util.GateBlockChangeSender; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -72,6 +73,8 @@ public class CommandSetLocation extends BaseLocationCommand Plugin.log(Level.WARNING, e.getMessage()); e.printStackTrace(); } + + GateBlockChangeSender.updateGateBlocks(gate); } }