public final class ServerLoginNetworking extends Object
Server-side networking functionalities include receiving serverbound query responses and sending clientbound query requests.
ServerPlayNetworking
,
ClientLoginNetworking
Modifier and Type | Class and Description |
---|---|
static interface |
ServerLoginNetworking.LoginQueryResponseHandler |
static interface |
ServerLoginNetworking.LoginSynchronizer
Allows blocking client log-in until all all futures passed into
ServerLoginNetworking.LoginSynchronizer.waitFor(Future) are completed. |
Modifier and Type | Method and Description |
---|---|
static Set<net.minecraft.util.Identifier> |
getGlobalReceivers()
Gets all channel names which global receivers are registered for.
|
static net.minecraft.server.MinecraftServer |
getServer(net.minecraft.server.network.ServerLoginNetworkHandler handler)
Returns the Minecraft Server of a server login network handler.
|
static boolean |
registerGlobalReceiver(net.minecraft.util.Identifier channelName,
ServerLoginNetworking.LoginQueryResponseHandler channelHandler)
Registers a handler to a query response channel.
|
static boolean |
registerReceiver(net.minecraft.server.network.ServerLoginNetworkHandler networkHandler,
net.minecraft.util.Identifier channelName,
ServerLoginNetworking.LoginQueryResponseHandler responseHandler)
Registers a handler to a query response channel.
|
static ServerLoginNetworking.LoginQueryResponseHandler |
unregisterGlobalReceiver(net.minecraft.util.Identifier channelName)
Removes the handler of a query response channel.
|
static ServerLoginNetworking.LoginQueryResponseHandler |
unregisterReceiver(net.minecraft.server.network.ServerLoginNetworkHandler networkHandler,
net.minecraft.util.Identifier channelName)
Removes the handler of a query response channel.
|
public static boolean registerGlobalReceiver(net.minecraft.util.Identifier channelName, ServerLoginNetworking.LoginQueryResponseHandler channelHandler)
If a handler is already registered to the channel
, this method will return false
, and no change will be made.
Use unregisterGlobalReceiver(Identifier)
to unregister the existing handler.
channelName
- the id of the channelchannelHandler
- the handlerunregisterGlobalReceiver(Identifier)
,
registerReceiver(ServerLoginNetworkHandler, Identifier, LoginQueryResponseHandler)
@Nullable public static ServerLoginNetworking.LoginQueryResponseHandler unregisterGlobalReceiver(net.minecraft.util.Identifier channelName)
The channel
is guaranteed not to have a handler after this call.
channelName
- the id of the channelnull
if no handler was bound to the channelregisterGlobalReceiver(Identifier, LoginQueryResponseHandler)
,
unregisterReceiver(ServerLoginNetworkHandler, Identifier)
public static Set<net.minecraft.util.Identifier> getGlobalReceivers()
public static boolean registerReceiver(net.minecraft.server.network.ServerLoginNetworkHandler networkHandler, net.minecraft.util.Identifier channelName, ServerLoginNetworking.LoginQueryResponseHandler responseHandler)
If a handler is already registered to the channelName
, this method will return false
, and no change will be made.
Use unregisterReceiver(ServerLoginNetworkHandler, Identifier)
to unregister the existing handler.
networkHandler
- the handlerchannelName
- the id of the channelresponseHandler
- the handler@Nullable public static ServerLoginNetworking.LoginQueryResponseHandler unregisterReceiver(net.minecraft.server.network.ServerLoginNetworkHandler networkHandler, net.minecraft.util.Identifier channelName)
The channelName
is guaranteed not to have a handler after this call.
channelName
- the id of the channelnull
if no handler was bound to the channel namepublic static net.minecraft.server.MinecraftServer getServer(net.minecraft.server.network.ServerLoginNetworkHandler handler)
handler
- the server login network handler