From 0f402ac0cc037ec9c06b841ecea3523b5980b997 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 16 Mar 2025 08:49:13 -0500 Subject: [PATCH] new box flag system --- .../InterestManagement/InterestManager.java | 2 +- src/engine/objects/PlayerCharacter.java | 29 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/engine/InterestManagement/InterestManager.java b/src/engine/InterestManagement/InterestManager.java index fdd53c43..bbd68acd 100644 --- a/src/engine/InterestManagement/InterestManager.java +++ b/src/engine/InterestManagement/InterestManager.java @@ -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); diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 915b1d29..0b70d0ef 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -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")) {