|
|
@ -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
|
|
|
|
|
|
|
|
|
|
|
|