Do call the exit changed method of the gates manager.

This commit is contained in:
Tobias Ottenweller 2014-02-05 20:16:16 +01:00
parent ca74b2e3ed
commit a579209037
3 changed files with 7 additions and 1 deletions

View File

@ -535,7 +535,7 @@ public class GatesManager
} }
} }
// TODO: call this method!
public void handleGateExitChange(final Gate g, final Location oldExit) public void handleGateExitChange(final Gate g, final Location oldExit)
{ {
// nothing to do // nothing to do

View File

@ -22,6 +22,7 @@ import de.craftinc.gates.util.GateBlockChangeSender;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import de.craftinc.gates.Plugin; import de.craftinc.gates.Plugin;
import org.bukkit.Location;
public class CommandExit extends BaseCommand public class CommandExit extends BaseCommand
@ -47,8 +48,10 @@ public class CommandExit extends BaseCommand
{ {
try try
{ {
Location oldExit = gate.getExit();
gate.setExit(player.getLocation()); gate.setExit(player.getLocation());
sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand."); sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand.");
Plugin.getPlugin().getGatesManager().handleGateExitChange(gate, oldExit);
} }
catch (Exception e) { catch (Exception e) {
GateBlockChangeSender.updateGateBlocks(gate); GateBlockChangeSender.updateGateBlocks(gate);

View File

@ -20,6 +20,7 @@ package de.craftinc.gates.commands;
import de.craftinc.gates.Plugin; import de.craftinc.gates.Plugin;
import de.craftinc.gates.util.GateBlockChangeSender; import de.craftinc.gates.util.GateBlockChangeSender;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location;
import java.util.logging.Level; import java.util.logging.Level;
@ -46,8 +47,10 @@ public class CommandExitOpen extends BaseCommand
{ {
try try
{ {
Location oldExit = gate.getExit();
gate.setExit(player.getLocation()); gate.setExit(player.getLocation());
sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand."); sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand.");
Plugin.getPlugin().getGatesManager().handleGateExitChange(gate, oldExit);
try { try {
boolean needsGateManagerUpdate = false; boolean needsGateManagerUpdate = false;