forked from MagicBane/Server
null check
This commit is contained in:
@@ -37,19 +37,20 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
|
|||||||
Enum.GameObjectType targetType;
|
Enum.GameObjectType targetType;
|
||||||
|
|
||||||
targetType = Enum.GameObjectType.values()[msg.getTargetType()];
|
targetType = Enum.GameObjectType.values()[msg.getTargetType()];
|
||||||
switch(targetType){
|
if(targetType != null) {
|
||||||
case Building:
|
switch (targetType) {
|
||||||
target = BuildingManager.getBuilding(msg.getTargetID());
|
case Building:
|
||||||
if(target == null)
|
target = BuildingManager.getBuilding(msg.getTargetID());
|
||||||
return true;// early exit for no building pulled
|
if (target == null)
|
||||||
Building targetBuilding = (Building) target;
|
return true;// early exit for no building pulled
|
||||||
if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0)
|
Building targetBuilding = (Building) target;
|
||||||
return true;// cannot attack destroyed building or protected building
|
if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0)
|
||||||
break;
|
return true;// cannot attack destroyed building or protected building
|
||||||
case NPC:
|
break;
|
||||||
return true;//cannot attack anything other than the 3 above
|
case NPC:
|
||||||
|
return true;//cannot attack anything other than the 3 above
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MovementManager.movement(msg, pc);
|
MovementManager.movement(msg, pc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user