diff --git a/resources/config.yml b/resources/config.yml index 1e2f188..4af427c 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -7,4 +7,5 @@ gateTeleportMessage: "Thank you for traveling with Craft Inc. Gates." showTeleportMessage: true gateTeleportNoPermissionMessage: "You are not allowed to use this gate!" showTeleportNoPermissionMessage: true +gateTeleportVehicleNotAllowedMessage: "You must not use that gate while riding!" gateMaterial: "nether portal" \ No newline at end of file diff --git a/src/de/craftinc/gates/GatesManager.java b/src/de/craftinc/gates/GatesManager.java index 81fda3d..b7e7797 100644 --- a/src/de/craftinc/gates/GatesManager.java +++ b/src/de/craftinc/gates/GatesManager.java @@ -535,7 +535,7 @@ public class GatesManager } } - // TODO: call this method! + public void handleGateExitChange(final Gate g, final Location oldExit) { // nothing to do diff --git a/src/de/craftinc/gates/commands/CommandExit.java b/src/de/craftinc/gates/commands/CommandExit.java index 05231ab..0aff595 100644 --- a/src/de/craftinc/gates/commands/CommandExit.java +++ b/src/de/craftinc/gates/commands/CommandExit.java @@ -22,6 +22,7 @@ import de.craftinc.gates.util.GateBlockChangeSender; import org.bukkit.ChatColor; import de.craftinc.gates.Plugin; +import org.bukkit.Location; public class CommandExit extends BaseCommand @@ -47,8 +48,10 @@ public class CommandExit extends BaseCommand { try { + Location oldExit = gate.getExit(); gate.setExit(player.getLocation()); sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand."); + Plugin.getPlugin().getGatesManager().handleGateExitChange(gate, oldExit); } catch (Exception e) { GateBlockChangeSender.updateGateBlocks(gate); diff --git a/src/de/craftinc/gates/commands/CommandExitOpen.java b/src/de/craftinc/gates/commands/CommandExitOpen.java index 47c7436..f131e78 100644 --- a/src/de/craftinc/gates/commands/CommandExitOpen.java +++ b/src/de/craftinc/gates/commands/CommandExitOpen.java @@ -20,6 +20,7 @@ package de.craftinc.gates.commands; import de.craftinc.gates.Plugin; import de.craftinc.gates.util.GateBlockChangeSender; import org.bukkit.ChatColor; +import org.bukkit.Location; import java.util.logging.Level; @@ -46,8 +47,10 @@ public class CommandExitOpen extends BaseCommand { try { + Location oldExit = gate.getExit(); gate.setExit(player.getLocation()); sendMessage(ChatColor.GREEN + "The exit of gate '" + gate.getId() + "' is now where you stand."); + Plugin.getPlugin().getGatesManager().handleGateExitChange(gate, oldExit); try { boolean needsGateManagerUpdate = false; diff --git a/src/de/craftinc/gates/listeners/PlayerMoveListener.java b/src/de/craftinc/gates/listeners/PlayerMoveListener.java index 733bee7..1a88b93 100644 --- a/src/de/craftinc/gates/listeners/PlayerMoveListener.java +++ b/src/de/craftinc/gates/listeners/PlayerMoveListener.java @@ -110,8 +110,9 @@ public class PlayerMoveListener implements Listener if (vehicle != null && (!vehicleIsSuitable) || !gate.getAllowsVehicles()) { - if (!gate.getAllowsVehicles()) { - // TODO: display not allowed message + if (!gate.getAllowsVehicles() && Plugin.getPlugin().getConfig().getBoolean(ConfigurationUtil.confShowTeleportNoPermissionMessageKey)) { + final String notAllowedMessage = Plugin.getPlugin().getConfig().getString(ConfigurationUtil.confGateTeleportVehicleNotAllowedMessageKey); + player.sendMessage(ChatColor.DARK_AQUA + notAllowedMessage); } return; diff --git a/src/de/craftinc/gates/util/ConfigurationUtil.java b/src/de/craftinc/gates/util/ConfigurationUtil.java index 0419629..ed49eba 100644 --- a/src/de/craftinc/gates/util/ConfigurationUtil.java +++ b/src/de/craftinc/gates/util/ConfigurationUtil.java @@ -29,6 +29,7 @@ public class ConfigurationUtil public static final String confPlayerGateBlockUpdateRadiusKey = "playerGateBlockUpdateRadius"; public static final String confCheckForBrokenGateFramesKey = "checkForBrokenGateFrames"; public static final String confGateTeleportMessageKey = "gateTeleportMessage"; + public static final String confGateTeleportVehicleNotAllowedMessageKey = "gateTeleportVehicleNotAllowedMessage"; public static final String confShowTeleportMessageKey = "showTeleportMessage"; public static final String confGateTeleportNoPermissionMessageKey = "gateTeleportNoPermissionMessage"; public static final String confShowTeleportNoPermissionMessageKey = "showTeleportNoPermissionMessage"; @@ -62,10 +63,10 @@ public class ConfigurationUtil material.material = Material.DEAD_BUSH; } else if (materialString.equals("dandelion")) { - material.material = Material.YELLOW_FLOWER; // TODO: this will change with minecraft 1.7 + material.material = Material.YELLOW_FLOWER; } else if (materialString.equals("poppy")) { - material.material = Material.RED_ROSE; // TODO: this will change with minecraft 1.7 + material.material = Material.RED_ROSE; } else if (materialString.equals("brown mushroom")) { material.material = Material.BROWN_MUSHROOM;