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