new box flag system

This commit is contained in:
2025-03-16 08:49:13 -05:00
parent 9032565220
commit 0f402ac0cc
2 changed files with 15 additions and 16 deletions
@@ -538,7 +538,7 @@ public enum InterestManager implements Runnable {
// Update loaded upbjects lists
//player.isBoxed = PlayerCharacter.checkIfBoxed(player);
player.updateBoxStatus(player.isBoxed,PlayerCharacter.checkIfBoxed(player));
player.updateBoxStatus(PlayerCharacter.checkIfBoxed(player));
player.setDirtyLoad(true);
updateStaticList(player, origin);
updateMobileList(player, origin);
+14 -15
View File
@@ -5211,7 +5211,7 @@ public class PlayerCharacter extends AbstractCharacter {
//}
if(this.timestamps.get("nextBoxCheck") < System.currentTimeMillis()) {
updateBoxStatus(this.isBoxed,checkIfBoxed(this));
updateBoxStatus(checkIfBoxed(this));
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
}
@@ -5270,22 +5270,21 @@ public class PlayerCharacter extends AbstractCharacter {
}
}
public void updateBoxStatus(boolean oldValue, boolean newValue) {
if ((oldValue && newValue) || (!oldValue && !newValue))
return; // Status has not changed, no need to proceed
public void updateBoxStatus(boolean newValue) {
this.isBoxed = newValue; // Update the isBoxed status
if (newValue) {
// Change from not boxed to boxed
this.title = CharacterTitle.PVE;//replace with effect bit or other visual system eventually
} else {
// Change from boxed to not boxed
this.title = CharacterTitle.NONE;//replace with removing effect bit or other visual system eventually
if(this.isBoxed) {
if(!this.title.equals(CharacterTitle.PVE)){
this.title = CharacterTitle.PVE;
this.getClientConnection().forceDisconnect();
}
}else{
if(!this.title.equals(CharacterTitle.NONE)){
this.title = CharacterTitle.NONE;
this.getClientConnection().forceDisconnect();
}
}
//remove this after new visual system implemented
this.getClientConnection().forceDisconnect();
}
public static void unboxPlayer(PlayerCharacter player) {
String machineID = player.getClientConnection().machineID;
@@ -5299,9 +5298,9 @@ public class PlayerCharacter extends AbstractCharacter {
if(pc.equals(player))
continue;
//pc.isBoxed = true;
pc.updateBoxStatus(pc.isBoxed,true);
pc.updateBoxStatus(true);
}
player.updateBoxStatus(player.isBoxed,true);
player.updateBoxStatus(false);
}
public static boolean checkIfBoxed(PlayerCharacter player){
if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) {