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