Package net.minecraft.server.network
Class ServerLoginNetworkHandler
java.lang.Object
net.minecraft.server.network.ServerLoginNetworkHandler
- All Implemented Interfaces:
PacketListener,ServerLoginPacketListener
public class ServerLoginNetworkHandler extends Object implements ServerLoginPacketListener
The server login network handler.
It listens to packets on the netty event loop and is ticked on the server thread simultaneously.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classServerLoginNetworkHandler.State -
Field Summary
Fields Modifier and Type Field Description ClientConnectionconnectionprivate ServerPlayerEntitydelayedPlayerThe delayed player, waiting to join the server once the existing player with the same UUID is gone.private static LoggerLOGGERprivate intloginTicksprivate static AtomicIntegerNEXT_AUTHENTICATOR_THREAD_IDprivate byte[]nonceprivate com.mojang.authlib.GameProfileprofileprivate static RandomRANDOMprivate SecretKeysecretKeyprivate MinecraftServerserverprivate StringserverIdprivate ServerLoginNetworkHandler.Statestate -
Constructor Summary
Constructors Constructor Description ServerLoginNetworkHandler(MinecraftServer server, ClientConnection connection) -
Method Summary
Modifier and Type Method Description voidacceptPlayer()Creates the player to be added to the server and adds it to the server.voiddisconnect(Text reason)ClientConnectiongetConnection()Returns the connection this packet listener intends to listen to.StringgetConnectionInfo()voidonDisconnected(Text reason)Called when the connection this listener listens to has disconnected.voidonHello(LoginHelloC2SPacket packet)voidonKey(LoginKeyC2SPacket packet)voidonQueryResponse(LoginQueryResponseC2SPacket packet)voidtick()Ticks this login network handler.protected com.mojang.authlib.GameProfiletoOfflineProfile(com.mojang.authlib.GameProfile profile)
-
Field Details
-
NEXT_AUTHENTICATOR_THREAD_ID
-
LOGGER
-
RANDOM
-
nonce
private final byte[] nonce -
server
-
connection
-
state
-
loginTicks
private int loginTicks -
profile
private com.mojang.authlib.GameProfile profile -
serverId
- See Also:
- Constant Field Values
-
secretKey
-
delayedPlayer
The delayed player, waiting to join the server once the existing player with the same UUID is gone.This will only be non-
nullif the state is delay-accept, and is reset tonullonce the player is accepted.
-
-
Constructor Details
-
ServerLoginNetworkHandler
-
-
Method Details
-
tick
public void tick()Ticks this login network handler.This accepts the player to the server if ready. If the state is delay accept, it checks if the old player with the same UUID is gone and admits the player.
-
getConnection
Returns the connection this packet listener intends to listen to.- Specified by:
getConnectionin interfacePacketListener- See Also:
ClientConnection.getPacketListener()
-
disconnect
-
acceptPlayer
public void acceptPlayer()Creates the player to be added to the server and adds it to the server.If a player with the same UUID is in the world, it will create the player and transition to the delay accept state.
-
onDisconnected
Called when the connection this listener listens to has disconnected. Can be used to display the disconnection reason.- Specified by:
onDisconnectedin interfacePacketListener- Parameters:
reason- the reason of disconnection; may be a generic message
-
getConnectionInfo
-
onHello
- Specified by:
onHelloin interfaceServerLoginPacketListener
-
onKey
- Specified by:
onKeyin interfaceServerLoginPacketListener
-
onQueryResponse
- Specified by:
onQueryResponsein interfaceServerLoginPacketListener
-
toOfflineProfile
protected com.mojang.authlib.GameProfile toOfflineProfile(com.mojang.authlib.GameProfile profile)
-