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

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

@ -711,11 +711,6 @@ public class WorldServer { @@ -711,11 +711,6 @@ public class WorldServer {
}
player.getTimestamps().put("logout", System.currentTimeMillis());
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
WorldGrid.RemoveWorldObject(player);

Loading…
Cancel
Save