Browse Source

new 3 box limit

birdbane
FatBoy-DOTC 8 months ago
parent
commit
a320333ddc
  1. 29
      src/engine/InterestManagement/InterestManager.java
  2. 5
      src/engine/server/world/WorldServer.java

29
src/engine/InterestManagement/InterestManager.java

@ -19,12 +19,15 @@ import engine.net.AbstractNetMsg;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.ClientConnectionManager;
import engine.net.client.msg.LoadCharacterMsg; import engine.net.client.msg.LoadCharacterMsg;
import engine.net.client.msg.LoadStructureMsg; import engine.net.client.msg.LoadStructureMsg;
import engine.net.client.msg.MoveToPointMsg; import engine.net.client.msg.MoveToPointMsg;
import engine.net.client.msg.UnloadObjectsMsg; import engine.net.client.msg.UnloadObjectsMsg;
import engine.net.client.msg.login.CharSelectScreenMsg;
import engine.objects.*; import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import engine.session.Session;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
@ -38,7 +41,6 @@ public enum InterestManager implements Runnable {
INTERESTMANAGER; INTERESTMANAGER;
private static long lastTime; private static long lastTime;
public static HashMap<String,ArrayList<PlayerCharacter>> playersByMachine = new HashMap<>();
InterestManager() { InterestManager() {
Logger.info(" Interest Management thread is running."); Logger.info(" Interest Management thread is running.");
@ -524,18 +526,23 @@ public enum InterestManager implements Runnable {
if (origin == null) if (origin == null)
return; return;
if(playersByMachine.containsKey(origin.machineID)){ int currentConnections = 0;
if(playersByMachine.get(origin.machineID) == null){ for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
ArrayList<PlayerCharacter> newList = new ArrayList<>(); if(pc.isActive() && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(player.getClientConnection().machineID)){
newList.add(player); currentConnections++;
playersByMachine.put(origin.machineID,newList); }
} else{ }
if(playersByMachine.get(origin.machineID).size() >= 3){
origin.disconnect(); try {
}else{ if (currentConnections >= 3) {
playersByMachine.get(origin.machineID).add(player); Session s = SessionManager.getSession(player);
if (s.getAccount() != null) {
CharSelectScreenMsg cssm = new CharSelectScreenMsg(s, false);
s.getConn().sendMsg(cssm);
} }
} }
}catch(Exception ex){
} }
// Update loaded upbjects lists // Update loaded upbjects lists

5
src/engine/server/world/WorldServer.java

@ -711,11 +711,6 @@ public class WorldServer {
} }
player.getTimestamps().put("logout", System.currentTimeMillis()); player.getTimestamps().put("logout", System.currentTimeMillis());
player.setEnteredWorld(false); player.setEnteredWorld(false);
if(InterestManager.playersByMachine.containsKey(player.getClientConnection().machineID)){
if(InterestManager.playersByMachine.get(player.getClientConnection().machineID).contains(player)){
InterestManager.playersByMachine.get(player.getClientConnection().machineID).remove(player);
}
}
// remove from simulation and zero current loc // remove from simulation and zero current loc
WorldGrid.RemoveWorldObject(player); WorldGrid.RemoveWorldObject(player);

Loading…
Cancel
Save