DispatchManager is now an official manager singleton.

This commit is contained in:
2024-05-12 13:14:42 -04:00
parent ff17cacda7
commit 96ba17f67a
160 changed files with 642 additions and 718 deletions
@@ -8,6 +8,7 @@
package engine.InterestManagement;
import engine.gameManager.DispatchManager;
import engine.gameManager.GroupManager;
import engine.gameManager.SessionManager;
import engine.job.JobScheduler;
@@ -17,7 +18,6 @@ import engine.mbEnums.DispatchChannel;
import engine.mbEnums.GameObjectType;
import engine.net.AbstractNetMsg;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
import engine.net.client.msg.LoadCharacterMsg;
import engine.net.client.msg.LoadStructureMsg;
@@ -88,7 +88,7 @@ public enum InterestManager implements Runnable {
if (send) {
Dispatch dispatch = Dispatch.borrow(player, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
}
}
@@ -270,7 +270,7 @@ public enum InterestManager implements Runnable {
}
Dispatch dispatch = Dispatch.borrow(player, uom);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
loadedStaticObjects.removeAll(toRemove);
@@ -292,7 +292,7 @@ public enum InterestManager implements Runnable {
lcm = new LoadCharacterMsg(corpse, PlayerCharacter.hideNonAscii());
Dispatch dispatch = Dispatch.borrow(player, lcm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
} else if (awo.getObjectType().equals(GameObjectType.NPC)) {
NPC npc = (NPC) awo;
@@ -304,13 +304,13 @@ public enum InterestManager implements Runnable {
if (lsm.getStructureList().size() > 0) {
Dispatch dispatch = Dispatch.borrow(player, lsm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
for (LoadCharacterMsg lc : lcmList) {
Dispatch dispatch = Dispatch.borrow(player, lc);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
loadedStaticObjects.addAll(toLoad);
@@ -414,7 +414,7 @@ public enum InterestManager implements Runnable {
if (!uom.getObjectList().isEmpty()) {
Dispatch dispatch = Dispatch.borrow(player, uom);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
}
@@ -492,7 +492,7 @@ public enum InterestManager implements Runnable {
if (lcm != null) {
Dispatch dispatch = Dispatch.borrow(player, lcm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);
}
+4 -4
View File
@@ -8,10 +8,10 @@
package engine.InterestManagement;
import engine.gameManager.DispatchManager;
import engine.math.Vector3fImmutable;
import engine.mbEnums;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.msg.TerritoryChangeMessage;
import engine.objects.City;
import engine.objects.PlayerCharacter;
@@ -91,17 +91,17 @@ public enum RealmMap {
if (city != null) {
TerritoryChangeMessage tcm = new TerritoryChangeMessage((PlayerCharacter) realm.getRulingCity().getOwner(), realm);
Dispatch dispatch = Dispatch.borrow(player, tcm);
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
} else {
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
Dispatch dispatch = Dispatch.borrow(player, tcm);
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
}
} else {
TerritoryChangeMessage tcm = new TerritoryChangeMessage(null, realm);
Dispatch dispatch = Dispatch.borrow(player, tcm);
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
}
}
+11 -11
View File
@@ -8,11 +8,11 @@
package engine.InterestManagement;
import engine.mbEnums.GridObjectType;
import engine.gameManager.DispatchManager;
import engine.math.FastMath;
import engine.math.Vector3f;
import engine.math.Vector3fImmutable;
import engine.net.DispatchMessage;
import engine.mbEnums.GridObjectType;
import engine.net.client.ClientConnection;
import engine.net.client.msg.LoadCharacterMsg;
import engine.net.client.msg.LoadStructureMsg;
@@ -201,7 +201,7 @@ public class WorldGrid {
UnloadObjectsMsg uom = new UnloadObjectsMsg();
uom.addObject(awo);
DispatchMessage.sendToAllInRange(awo, uom);
DispatchManager.sendToAllInRange(awo, uom);
}
public static void loadObject(AbstractWorldObject awo) {
@@ -213,15 +213,15 @@ public class WorldGrid {
case Building:
lsm = new LoadStructureMsg();
lsm.addObject((Building) awo);
DispatchMessage.sendToAllInRange(awo, lsm);
DispatchManager.sendToAllInRange(awo, lsm);
break;
case NPC:
lcm = new LoadCharacterMsg((NPC) awo, false);
DispatchMessage.sendToAllInRange(awo, lcm);
DispatchManager.sendToAllInRange(awo, lcm);
break;
case Mob:
lcm = new LoadCharacterMsg((Mob) awo, false);
DispatchMessage.sendToAllInRange(awo, lcm);
DispatchManager.sendToAllInRange(awo, lcm);
break;
default:
// *** Refactor: Log error?
@@ -239,19 +239,19 @@ public class WorldGrid {
case Building:
lsm = new LoadStructureMsg();
lsm.addObject((Building) awo);
DispatchMessage.sendToAllInRange(awo, lsm);
DispatchManager.sendToAllInRange(awo, lsm);
break;
case NPC:
lcm = new LoadCharacterMsg((NPC) awo, false);
DispatchMessage.sendToAllInRange(awo, lcm);
DispatchManager.sendToAllInRange(awo, lcm);
break;
case Mob:
lcm = new LoadCharacterMsg((Mob) awo, false);
DispatchMessage.sendToAllInRange(awo, lcm);
DispatchManager.sendToAllInRange(awo, lcm);
break;
case PlayerCharacter:
lcm = new LoadCharacterMsg((PlayerCharacter) awo, false);
DispatchMessage.sendToAllInRange(awo, lcm);
DispatchManager.sendToAllInRange(awo, lcm);
break;
default:
// *** Refactor: Log error?
@@ -263,7 +263,7 @@ public class WorldGrid {
ClientConnection origin) {
UnloadObjectsMsg uom = new UnloadObjectsMsg();
uom.addObject(awo);
DispatchMessage.sendToAllInRange(awo, uom);
DispatchManager.sendToAllInRange(awo, uom);
}
public static void addObject(AbstractWorldObject awo, PlayerCharacter pc) {