diff --git a/src/engine/net/client/handlers/MoveToPointHandler.java b/src/engine/net/client/handlers/MoveToPointHandler.java index 3c82d07b..3c017b13 100644 --- a/src/engine/net/client/handlers/MoveToPointHandler.java +++ b/src/engine/net/client/handlers/MoveToPointHandler.java @@ -14,6 +14,8 @@ import engine.gameManager.MovementManager; import engine.net.client.ClientConnection; import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.MoveToPointMsg; +import engine.objects.AbstractWorldObject; +import engine.objects.Building; import engine.objects.PlayerCharacter; public class MoveToPointHandler extends AbstractClientMsgHandler { @@ -30,9 +32,23 @@ public class MoveToPointHandler extends AbstractClientMsgHandler { PlayerCharacter pc = (origin != null) ? (origin.getPlayerCharacter()) : null; if (pc == null) return false; + PlayerCharacter player = origin.getPlayerCharacter(); + if (player == null) + return false; + AbstractWorldObject target = player.combatTarget; + + if (target != null) { + switch (target.getObjectType()) { + case NPC: + return false; + case Building: + Building targetBuilding = (Building) target; + if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) + return false; + } + } MovementManager.movement(msg, pc); return true; } - }