Package megamek.server
Class ServerLobbyHelper
java.lang.Object
megamek.server.ServerLobbyHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcorrectC3Connections(Game game) For all game units, disconnects from enemy C3 masters / networksstatic voidcorrectLoading(Game game) For all game units, disembarks from carriers and offloads carried units if they are enemies.static voidcorrectTowLinks(Game game) For all game units, unhitches trailers whose train has ended up split between opposing players.static PacketcreateForcesDeletePacket(Collection<Integer> forces) Creates a packet detailing a force delete.static PacketcreateMultiEntityPacket(Collection<Entity> entities) Creates a packet for an update for the given entities.static StringentityUpdateMessage(Entity entity, Game game) Writes a "Unit XX has been customized" message to the chat.lobbyUnload(Game game, Collection<Entity> entities) Disembarks and offloads the given entities (removing it from transports and removing transported units from it).performC3Disconnect(Game game, Collection<Entity> entities) Performs a disconnect from C3 networks for the given entities.static voidreceiveAddEntitiesToForce(Packet packet, int connId, Game game, TWGameManager gameManager) Handles an add entity to force / remove from force packet, attaching the sent entities to a force or removing them from any force.static voidreceiveEntitiesAssign(Packet packet, int connId, Game game, TWGameManager gameManager) Handles a force assign full packet, changing the owner of forces and everything in them.static voidreceiveForceAdd(Packet packet, int connId, Game game, TWGameManager gameManager) Adds a force with the info from the client.static voidreceiveForceAssignFull(Packet packet, int connId, Game game, TWGameManager gameManager) Handles a force assign full packet, changing the owner of forces and everything in them.static voidreceiveForceParent(Packet packet, int connId, Game game, TWGameManager gameManager) Handles a force parent packet, attaching the sent forces to a new parent or making the sent forces top-level.static voidreceiveForceUpdate(Packet packet, int connId, Game game, TWGameManager gameManager) Handles a force update packet, forwarding a client-side change that only affects forces, not entities: - rename - move subforce/entity up/down (this does not change the entity, only the force) - owner change of only the force (not the entities, only within a team) This method is intended for use in the lobby!static voidreceiveLobbyTeamChange(Packet packet, int connId, Game game, TWGameManager gameManager) Handles a team change, updating units and forces as necessary.
-
Constructor Details
-
ServerLobbyHelper
public ServerLobbyHelper()
-
-
Method Details
-
entityUpdateMessage
Writes a "Unit XX has been customized" message to the chat. The message is adapted to blind drop conditions. -
lobbyUnload
Disembarks and offloads the given entities (removing it from transports and removing transported units from it). Returns a set of entities that received changes. The set may be empty, but not null.NOTE: This is a simplified unload that is only valid in the lobby!
-
performC3Disconnect
Performs a disconnect from C3 networks for the given entities. This is a simplified version that is only valid in the lobby. Returns a set of entities that received changes. -
createMultiEntityPacket
Creates a packet for an update for the given entities. Only valid in the lobby. -
createForcesDeletePacket
Creates a packet detailing a force delete. Only valid in the lobby. -
receiveForceParent
public static void receiveForceParent(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException Handles a force parent packet, attaching the sent forces to a new parent or making the sent forces top-level. This method is intended for use in the lobby!- Throws:
InvalidPacketDataException
-
receiveEntitiesAssign
public static void receiveEntitiesAssign(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException Handles a force assign full packet, changing the owner of forces and everything in them. This method is intended for use in the lobby!- Throws:
InvalidPacketDataException
-
receiveForceAssignFull
public static void receiveForceAssignFull(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException Handles a force assign full packet, changing the owner of forces and everything in them. This method is intended for use in the lobby!- Throws:
InvalidPacketDataException
-
receiveForceUpdate
public static void receiveForceUpdate(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException Handles a force update packet, forwarding a client-side change that only affects forces, not entities: - rename - move subforce/entity up/down (this does not change the entity, only the force) - owner change of only the force (not the entities, only within a team) This method is intended for use in the lobby!- Throws:
InvalidPacketDataException
-
receiveLobbyTeamChange
public static void receiveLobbyTeamChange(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException Handles a team change, updating units and forces as necessary. This method is intended for use in the lobby!- Throws:
InvalidPacketDataException
-
correctLoading
For all game units, disembarks from carriers and offloads carried units if they are enemies.NOTE: This is a simplified unload that is only valid in the lobby!
-
correctTowLinks
For all game units, unhitches trailers whose train has ended up split between opposing players.This is the tow counterpart of the disembarking done above. Reassigning one unit of a train to an enemy would otherwise leave the two hitched together, moving as one train across opposing sides.
NOTE: This is intended for use in the lobby phase!
-
correctC3Connections
For all game units, disconnects from enemy C3 masters / networksNOTE: This is intended for use in the lobby phase!
-
receiveAddEntitiesToForce
public static void receiveAddEntitiesToForce(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException Handles an add entity to force / remove from force packet, attaching the sent entities to a force or removing them from any force. This method is intended for use in the lobby!- Throws:
InvalidPacketDataException
-
receiveForceAdd
public static void receiveForceAdd(Packet packet, int connId, Game game, TWGameManager gameManager) throws InvalidPacketDataException Adds a force with the info from the client. Only valid during the lobby phase.- Throws:
InvalidPacketDataException
-