Interface ServerPlayContext
- All Superinterfaces:
ListenerContext,PlayContext,ServerContext
public interface ServerPlayContext extends ServerContext, PlayContext
Represents the context for
ServerNetworking.getPlayReceiver(), in which a
client to server
custom payload packet is received.- See Also:
ServerNetworking.getPlayReceiver()
-
Method Summary
Modifier and Type Method Description net.minecraft.server.network.ServerPlayNetworkHandlergetListener()Returns the packet listener that received this packet.net.minecraft.server.network.ServerPlayerEntitygetPlayer()Returns a player associated with the current packet.Methods inherited from interface io.github.fablabsmc.fablabs.api.networking.v1.PlayContext
getPacketSenderMethods inherited from interface io.github.fablabsmc.fablabs.api.networking.v1.server.ServerContext
getEngine
-
Method Details
-
getPlayer
net.minecraft.server.network.ServerPlayerEntity getPlayer()Returns a player associated with the current packet.For security concerns, this method should be called on game engine threads in order to prevent inadvertent asynchronous modifications to the game.
networking-api-v1-draft.offThreadGameAccesssystem property can be set toPERMITfor disabling checks,WARNfor emitting an error message, andTHROWto throw an exception. The values are case insensitive.In the server play context, the player is always a server player associated with the
network handler.- Specified by:
getPlayerin interfacePlayContext- Returns:
- a server player
-
getListener
net.minecraft.server.network.ServerPlayNetworkHandler getListener()Returns the packet listener that received this packet.The packet listener offers access to the connection.
In the client play context, the packet listener is always a
ServerPlayNetworkHandler.- Specified by:
getListenerin interfaceListenerContext- Returns:
- the packet listener
-