Browse Source

new box flag system

lakebane
FatBoy-DOTC 2 weeks ago
parent
commit
0f402ac0cc
  1. 2
      src/engine/InterestManagement/InterestManager.java
  2. 29
      src/engine/objects/PlayerCharacter.java

2
src/engine/InterestManagement/InterestManager.java

@ -538,7 +538,7 @@ public enum InterestManager implements Runnable { @@ -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);

29
src/engine/objects/PlayerCharacter.java

@ -5211,7 +5211,7 @@ public class PlayerCharacter extends AbstractCharacter { @@ -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 { @@ -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 { @@ -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")) {

Loading…
Cancel
Save