forked from MagicBane/Server
stop invisible player plague
This commit is contained in:
@@ -537,7 +537,8 @@ public enum InterestManager implements Runnable {
|
|||||||
|
|
||||||
// Update loaded upbjects lists
|
// Update loaded upbjects lists
|
||||||
|
|
||||||
player.isBoxed = PlayerCharacter.checkIfBoxed(player);
|
//player.isBoxed = PlayerCharacter.checkIfBoxed(player);
|
||||||
|
player.updateBoxStatus(player.isBoxed,PlayerCharacter.checkIfBoxed(player));
|
||||||
player.setDirtyLoad(true);
|
player.setDirtyLoad(true);
|
||||||
updateStaticList(player, origin);
|
updateStaticList(player, origin);
|
||||||
updateMobileList(player, origin);
|
updateMobileList(player, origin);
|
||||||
|
|||||||
@@ -5205,26 +5205,31 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
if (!this.timestamps.containsKey("nextBoxCheck"))
|
if (!this.timestamps.containsKey("nextBoxCheck"))
|
||||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||||
|
|
||||||
if (!this.isBoxed && this.timestamps.get("nextBoxCheck") < System.currentTimeMillis()) {
|
// if (!this.isBoxed && this.timestamps.get("nextBoxCheck") < System.currentTimeMillis()) {
|
||||||
this.isBoxed = checkIfBoxed(this);
|
// this.isBoxed = checkIfBoxed(this);
|
||||||
|
// this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||||
|
//}
|
||||||
|
|
||||||
|
if(this.timestamps.get("nextBoxCheck") < System.currentTimeMillis()) {
|
||||||
|
updateBoxStatus(this.isBoxed,checkIfBoxed(this));
|
||||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isBoxed){
|
//if (this.isBoxed){
|
||||||
if(!this.title.equals(CharacterTitle.PVE)){
|
//if(!this.title.equals(CharacterTitle.PVE)){
|
||||||
this.title = CharacterTitle.PVE;
|
// this.title = CharacterTitle.PVE;
|
||||||
InterestManager.setObjectDirty(this);
|
// InterestManager.setObjectDirty(this);
|
||||||
InterestManager.reloadCharacter(this, false);
|
// InterestManager.reloadCharacter(this, false);
|
||||||
this.setDirtyLoad(true);
|
// this.setDirtyLoad(true);
|
||||||
}
|
//}
|
||||||
}else {
|
//}else {
|
||||||
if (!this.title.equals(CharacterTitle.NONE)) {
|
// if (!this.title.equals(CharacterTitle.NONE)) {
|
||||||
this.title = CharacterTitle.NONE;
|
// this.title = CharacterTitle.NONE;
|
||||||
InterestManager.setObjectDirty(this);
|
// InterestManager.setObjectDirty(this);
|
||||||
InterestManager.reloadCharacter(this, false);
|
// InterestManager.reloadCharacter(this, false);
|
||||||
this.setDirtyLoad(true);
|
// this.setDirtyLoad(true);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (this.level < 10 && this.enteredWorld) {
|
if (this.level < 10 && this.enteredWorld) {
|
||||||
while (this.level < 10) {
|
while (this.level < 10) {
|
||||||
@@ -5264,6 +5269,24 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
Logger.error("UPDATE ISSUE: " + e);
|
Logger.error("UPDATE ISSUE: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateBoxStatus(boolean oldValue, boolean newValue) {
|
||||||
|
if ((oldValue && newValue) || (!oldValue && !newValue))
|
||||||
|
return; // Status has not changed, no need to proceed
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove this after new visual system implemented
|
||||||
|
this.getClientConnection().forceDisconnect();
|
||||||
|
}
|
||||||
public static void unboxPlayer(PlayerCharacter player) {
|
public static void unboxPlayer(PlayerCharacter player) {
|
||||||
String machineID = player.getClientConnection().machineID;
|
String machineID = player.getClientConnection().machineID;
|
||||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||||
@@ -5275,9 +5298,10 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
for (PlayerCharacter pc : sameMachine) {
|
for (PlayerCharacter pc : sameMachine) {
|
||||||
if(pc.equals(player))
|
if(pc.equals(player))
|
||||||
continue;
|
continue;
|
||||||
pc.isBoxed = true;
|
//pc.isBoxed = true;
|
||||||
|
pc.updateBoxStatus(pc.isBoxed,true);
|
||||||
}
|
}
|
||||||
player.isBoxed = false;
|
player.updateBoxStatus(player.isBoxed,true);
|
||||||
}
|
}
|
||||||
public static boolean checkIfBoxed(PlayerCharacter player){
|
public static boolean checkIfBoxed(PlayerCharacter player){
|
||||||
if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) {
|
if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user