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