forked from MagicBane/Server
relog crash bug
This commit is contained in:
@@ -511,6 +511,18 @@ public enum InterestManager implements Runnable {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
||||
if(pc.equals(player)){
|
||||
try{
|
||||
WorldGrid.RemoveWorldObject(player);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ClientConnection origin = player.getClientConnection();
|
||||
|
||||
if (origin == null)
|
||||
|
||||
@@ -976,8 +976,8 @@ public class MobAI {
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
|
||||
CheckForPlayerGuardAggro(mob);
|
||||
} else {
|
||||
//CheckForAggro(mob);
|
||||
NewAggroMechanic(mob);
|
||||
if(mob.combatTarget == null)
|
||||
NewAggroMechanic(mob);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1416,10 +1416,16 @@ public class MobAI {
|
||||
|
||||
public static void NewAggroMechanic(Mob mob){
|
||||
|
||||
if(mob == null || !mob.isAlive()){
|
||||
if(mob == null || !mob.isAlive() || mob.playerAgroMap.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
if(mob.hate_values == null)
|
||||
mob.hate_values = new HashMap<>();
|
||||
|
||||
if(mob.combatTarget != null)
|
||||
return;
|
||||
|
||||
HashSet<AbstractWorldObject> inRange = WorldGrid.getObjectsInRangePartial(mob.loc,60.0f,MBServerStatics.MASK_PLAYER);
|
||||
|
||||
if(inRange.isEmpty()){
|
||||
|
||||
Reference in New Issue
Block a user