diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 7a8b00d3..03ea9676 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4859,8 +4859,8 @@ public class PlayerCharacter extends AbstractCharacter { //if(this.isBoxed && this.containsEffect(429611355) == false) {//pathfinding // PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 429611355, 40, false); //} - if(this.isEnteredWorld() && this.isActive()){ - if( this.getLevel() < 10) { + if(this.isEnteredWorld() && this.isActive()) { + if (this.getLevel() < 10) { this.setLevel((short) 10); boolean hasConc = false; for (Item i : this.getCharItemManager().getInventory()) { @@ -4873,20 +4873,20 @@ public class PlayerCharacter extends AbstractCharacter { } } - //if(this.isBoxed) { - // if(this.title.equals(CharacterTitle.BOX) == false) { - // this.title = CharacterTitle.BOX; - // InterestManager.reloadCharacter(this); - // } - // if (this.containsEffect(1672601862) == false) {//Deathshroud - // PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); - // } - // }else{ - // if(this.title.equals(CharacterTitle.NONE) == false) { - // this.title = CharacterTitle.NONE; - // InterestManager.reloadCharacter(this); - // } - // } + if (this.isBoxed) { + if (this.title.equals(CharacterTitle.BOX) == false) { + this.title = CharacterTitle.BOX; + InterestManager.reloadCharacter(this); + } + if (this.containsEffect(1672601862) == false) {//Deathshroud + PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); + } + } else { + if (this.title.equals(CharacterTitle.NONE) == false) { + this.title = CharacterTitle.NONE; + InterestManager.reloadCharacter(this); + } + } } } catch (Exception e) { diff --git a/src/engine/workthreads/BoxFlagThread.java b/src/engine/workthreads/BoxFlagThread.java index 053f599f..209dcc56 100644 --- a/src/engine/workthreads/BoxFlagThread.java +++ b/src/engine/workthreads/BoxFlagThread.java @@ -35,26 +35,35 @@ public class BoxFlagThread implements Runnable { LocalDateTime nextPulse = LocalDateTime.now().minusMinutes(1); while(true){ if(LocalDateTime.now().isAfter(nextPulse)) { + HashMap> PlayersByMachineID = new HashMap<>(); for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){ - if(pc.isEnteredWorld() && pc.isActive()){ - ChatManager.chatSystemInfo(pc, " You Are Being Box Checked"); - pc.isBoxed = PlayerCharacter.checkIfBoxed(pc); - if(pc.isBoxed) { - if(pc.title.equals(CharacterTitle.BOX) == false) { - pc.title = CharacterTitle.BOX; - //InterestManager.reloadCharacter(pc); - InterestManager.setObjectDirty(pc); - if (pc.containsEffect(1672601862) == false) {//Deathshroud - PowersManager.applyPower(pc, pc, Vector3fImmutable.ZERO, 1672601862, 40, false); - } - } - }else{ - if(pc.title.equals(CharacterTitle.NONE) == false) { - pc.title = CharacterTitle.NONE; - //InterestManager.reloadCharacter(pc); - InterestManager.setObjectDirty(pc); + if(PlayersByMachineID.containsKey(pc.getClientConnection().machineID)){ + if(PlayersByMachineID.get(pc.getClientConnection().machineID).contains(pc) == false) + PlayersByMachineID.get(pc.getClientConnection().machineID).add(pc); + }else{ + ArrayList newList = new ArrayList<>(); + newList.add(pc); + PlayersByMachineID.put(pc.getClientConnection().machineID,newList); + } + } + + for(String key : PlayersByMachineID.keySet()){ + ArrayList machinePlayers = PlayersByMachineID.get(key); + if(machinePlayers.size() > 1){ + int unboxedCount = 0; + for(PlayerCharacter pc : machinePlayers){ + if(!pc.isBoxed) + unboxedCount++; + } + + if(unboxedCount > 1){ + for(PlayerCharacter pc : machinePlayers){ + pc.isBoxed = true; } + machinePlayers.get(0).isBoxed = false; } + }else{ + machinePlayers.get(0).isBoxed = false; } } nextPulse = nextPulse.plusSeconds(THREAD_DELAY_SECONDS);