diff --git a/src/engine/InterestManagement/InterestManager.java b/src/engine/InterestManagement/InterestManager.java index afb78d92..2a55151d 100644 --- a/src/engine/InterestManagement/InterestManager.java +++ b/src/engine/InterestManagement/InterestManager.java @@ -524,7 +524,7 @@ public enum InterestManager implements Runnable { player.setDirtyLoad(true); updateStaticList(player, origin); updateMobileList(player, origin); - PlayerCharacter.checkIfBoxed(player); + //PlayerCharacter.checkIfBoxed(player); } diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 912a68e0..7a8b00d3 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -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/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 2dee14ac..6a72e204 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -553,6 +553,8 @@ public class WorldServer { //Thread powerThread = new Thread(new PowersThread()); //powerThread.setName("power thread"); //powerThread.start(); + Logger.info("Starting Box Flag Thread"); + BoxFlagThread.startBoxFlagThread(); return true; } diff --git a/src/engine/workthreads/BoxFlagThread.java b/src/engine/workthreads/BoxFlagThread.java new file mode 100644 index 00000000..edc09744 --- /dev/null +++ b/src/engine/workthreads/BoxFlagThread.java @@ -0,0 +1,73 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + + +package engine.workthreads; + +import engine.Enum; +import engine.InterestManagement.InterestManager; +import engine.InterestManagement.WorldGrid; +import engine.gameManager.BuildingManager; +import engine.gameManager.PowersManager; +import engine.gameManager.SessionManager; +import engine.gameManager.ZergManager; +import engine.math.Vector3fImmutable; +import engine.objects.*; +import engine.server.MBServerStatics; +import org.pmw.tinylog.Logger; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +public class BoxFlagThread implements Runnable { + + public final static int THREAD_DELAY = 5000; + public BoxFlagThread() { + + } + + @Override + public void run() { + long nextPulse = System.currentTimeMillis(); + while(true){ + if(System.currentTimeMillis() > nextPulse) { + for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){ + if(pc.isEnteredWorld() && pc.isActive()){ + + if(PlayerCharacter.checkIfBoxed(pc)) { + 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); + } + } + } + } + nextPulse += THREAD_DELAY; + } + } + } + public static void startBoxFlagThread() { + + Thread boxFlag; + boxFlag = new Thread(new BoxFlagThread()); + + boxFlag.setName("boxFlagThread"); + boxFlag.start(); + } +} diff --git a/src/engine/workthreads/PowersThread.java b/src/engine/workthreads/PowersThread.java deleted file mode 100644 index 97794f99..00000000 --- a/src/engine/workthreads/PowersThread.java +++ /dev/null @@ -1,24 +0,0 @@ -package engine.workthreads; - -import engine.gameManager.PowersManager; - -import java.util.ArrayList; - -public class PowersThread implements Runnable { - - public PowersThread(){ - - } - - @Override - public void run() { - while(true){ - ArrayList purge = new ArrayList<>(); - for(PowersManager.PowerQueObject pqo : PowersManager.static_power_que){ - purge.add(pqo); - PowersManager.usePower(pqo.msg,pqo.origin,pqo.sendCastToSelf); - } - PowersManager.static_power_que.removeAll(purge); - } - } -}