forked from MagicBane/Server
box check only every 10 seconds
This commit is contained in:
@@ -530,7 +530,7 @@ public enum InterestManager implements Runnable {
|
||||
player.setDirtyLoad(true);
|
||||
updateStaticList(player, origin);
|
||||
updateMobileList(player, origin);
|
||||
player.isBoxed = PlayerCharacter.checkIfBoxed(player);
|
||||
PlayerCharacter.checkIfBoxed(player);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
public long lastAction = 0;
|
||||
|
||||
public long lastBoxCheck = System.currentTimeMillis();
|
||||
public long nextBoxCheck = System.currentTimeMillis();
|
||||
/**
|
||||
* No Id Constructor
|
||||
*/
|
||||
@@ -4865,11 +4865,13 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
ItemFactory.fillInventory(this, 980066, 1);
|
||||
}
|
||||
}
|
||||
this.isBoxed = checkIfBoxed(this);
|
||||
if(!this.isBoxed) {
|
||||
checkIfBoxed(this);
|
||||
}
|
||||
if(this.isBoxed) {
|
||||
if(!this.title.equals(CharacterTitle.BOX)) {
|
||||
this.title = CharacterTitle.BOX;
|
||||
InterestManager.reloadCharacter(this);
|
||||
//InterestManager.reloadCharacter(this);
|
||||
}
|
||||
|
||||
if (!this.containsEffect(1672601862)) {//Deathshroud
|
||||
@@ -4881,7 +4883,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}else{
|
||||
if(!this.title.equals(CharacterTitle.NONE)) {
|
||||
this.title = CharacterTitle.NONE;
|
||||
InterestManager.reloadCharacter(this);
|
||||
//InterestManager.reloadCharacter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4894,11 +4896,11 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean checkIfBoxed(PlayerCharacter player){
|
||||
if(System.currentTimeMillis() < player.lastBoxCheck + 5000)
|
||||
return false;
|
||||
public static void checkIfBoxed(PlayerCharacter player){
|
||||
if(System.currentTimeMillis() > player.nextBoxCheck)
|
||||
return;
|
||||
|
||||
player.lastBoxCheck = System.currentTimeMillis();
|
||||
player.nextBoxCheck = System.currentTimeMillis() + 10000;
|
||||
try {
|
||||
for (PlayerCharacter pc : SessionManager.getAllActivePlayers()) {
|
||||
if(pc.getClientConnection().machineID.equals(player.getClientConnection().machineID) == false)
|
||||
@@ -4910,13 +4912,14 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
if (pc.equals(player))
|
||||
continue;
|
||||
if (pc.isBoxed == false) {
|
||||
return true;
|
||||
player.isBoxed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
player.isBoxed = false;
|
||||
}catch(Exception e){
|
||||
return false;
|
||||
player.isBoxed = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user