Package net.minecraft.server.network
Class ServerGamePacketListenerImpl
java.lang.Object
net.minecraft.server.network.ServerCommonPacketListenerImpl
net.minecraft.server.network.ServerGamePacketListenerImpl
- All Implemented Interfaces:
PacketListener
,ServerCommonPacketListener
,ServerCookiePacketListener
,ServerGamePacketListener
,ServerPacketListener
,ServerPingPacketListener
,ServerboundPacketListener
,TickablePacketListener
,ServerPlayerConnection
,ICommonPacketListener
,IServerCommonPacketListenerExtension
,IServerGamePacketListenerExtension
- Direct Known Subclasses:
FakePlayer.FakePlayerNetHandler
public class ServerGamePacketListenerImpl
extends ServerCommonPacketListenerImpl
implements ServerGamePacketListener, ServerPlayerConnection, TickablePacketListener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private int
private int
private Vec3
private int
private int
private static final Component
private final FutureChain
private RemoteChatSession
private int
final PlayerChunkSender
private boolean
private boolean
private int
private double
private double
private double
private static final Component
private int
private double
private double
private double
private final LastSeenMessagesValidator
private Entity
(package private) static final org.slf4j.Logger
private static final int
private static final int
private final MessageSignatureCache
private static final int
private int
private SignedMessageChain.Decoder
private int
private static final int
private double
private double
private double
private double
private double
private double
private boolean
Fields inherited from class net.minecraft.server.network.ServerCommonPacketListenerImpl
connection, connectionType, DISCONNECT_UNEXPECTED_QUERY, LATENCY_CHECK_INTERVAL, server
-
Constructor Summary
ConstructorsConstructorDescriptionServerGamePacketListenerImpl
(MinecraftServer p_9770_, Connection p_9771_, ServerPlayer p_9772_, CommonListenerCookie p_301978_) -
Method Summary
Modifier and TypeMethodDescriptionvoid
ackBlockChangesUpTo
(int p_215202_) void
addPendingMessage
(PlayerChatMessage p_242439_) private void
broadcastChatMessage
(PlayerChatMessage p_243277_) private static double
clampHorizontal
(double p_143610_) private static double
clampVertical
(double p_143654_) private <S> Map
<String, PlayerChatMessage> collectSignedArguments
(ServerboundChatCommandSignedPacket p_338222_, SignableCommand<S> p_250039_, LastSeenMessages p_249207_) private <S> Map
<String, PlayerChatMessage> collectUnsignedArguments
(List<SignableCommand.Argument<S>> p_338744_) private static boolean
containsInvalidValues
(double p_143664_, double p_143665_, double p_143666_, float p_143667_, float p_143668_) private static <S> SignedMessageChain.DecodeException
createSignedArgumentMismatchException
(String p_338499_, List<ArgumentSignatures.Entry> p_338388_, List<SignableCommand.Argument<S>> p_338708_) private void
private Filterable
<String> filterableFromOutgoing
(FilteredText p_332041_) private CompletableFuture
<FilteredText> filterTextPacket
(String p_243213_) private CompletableFuture
<List<FilteredText>> filterTextPacket
(List<String> p_243258_) private <T,
R> CompletableFuture <R> filterTextPacket
(T p_243240_, BiFunction<TextFilter, T, CompletableFuture<R>> p_243271_) private int
getMaximumFlyingTicks
(Entity p_326388_) private PlayerChatMessage
getSignedMessage
(ServerboundChatPacket p_251061_, LastSeenMessages p_250566_) void
void
handleAnimate
(ServerboundSwingPacket p_9926_) void
void
void
handleChat
(ServerboundChatPacket p_9841_) void
handleChatAck
(ServerboundChatAckPacket p_242387_) void
handleChatCommand
(ServerboundChatCommandPacket p_215225_) void
void
void
void
void
void
void
void
void
void
void
void
void
handleEditBook
(ServerboundEditBookPacket p_9862_) void
void
handleInteract
(ServerboundInteractPacket p_9866_) void
void
private void
void
void
void
void
handlePickItem
(ServerboundPickItemPacket p_9880_) void
handlePingRequest
(ServerboundPingRequestPacket p_320356_) void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
handleUseItem
(ServerboundUseItemPacket p_9932_) void
boolean
private static boolean
isChatMessageIllegal
(String p_215215_) private boolean
isPlayerCollidingWithAnythingNew
(LevelReader p_289008_, AABB p_288986_, double p_288990_, double p_288991_, double p_288967_) private boolean
noBlocksAround
(Entity p_9794_) void
onDisconnect
(DisconnectionDetails p_350554_) private com.mojang.brigadier.ParseResults
<CommandSourceStack> parseCommand
(String p_242938_) private void
performSignedChatCommand
(ServerboundChatCommandSignedPacket p_338593_, LastSeenMessages p_250484_) private void
performUnsignedChatCommand
(String p_338482_) protected com.mojang.authlib.GameProfile
private void
private void
resetPlayerChatState
(RemoteChatSession p_253823_) void
private void
resyncPlayerWithVehicle
(Entity vehicle) void
sendDisguisedChatMessage
(Component p_251804_, ChatType.Bound p_250040_) void
sendPlayerChatMessage
(PlayerChatMessage p_250321_, ChatType.Bound p_250910_) boolean
shouldHandleMessage
(Packet<?> p_295183_) private void
signBook
(FilteredText p_215209_, List<FilteredText> p_215210_, int p_215211_) void
void
teleport
(double p_9775_, double p_9776_, double p_9777_, float p_9778_, float p_9779_) void
teleport
(double p_9781_, double p_9782_, double p_9783_, float p_9784_, float p_9785_, Set<RelativeMovement> p_9786_) void
tick()
private void
tryHandleChat
(String p_338775_, Runnable p_338235_) private Optional
<LastSeenMessages> unpackAndApplyLastSeen
(LastSeenMessages.Update p_249673_) private boolean
private void
updateBookContents
(List<FilteredText> p_9813_, int p_9814_) private void
updateSignText
(ServerboundSignUpdatePacket p_9923_, List<FilteredText> p_9924_) private static boolean
wasBlockPlacementAttempt
(ServerPlayer p_9791_, ItemStack p_9792_) Methods inherited from class net.minecraft.server.network.ServerCommonPacketListenerImpl
createCookie, createCookie, disconnect, disconnect, getConnection, getConnectionType, getMainThreadEventLoop, getOwner, handleCookieResponse, handleKeepAlive, handlePong, handleResourcePackResponse, isSingleplayerOwner, keepConnectionAlive, latency, resumeFlushing, send, send, suspendFlushing
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.neoforge.common.extensions.ICommonPacketListener
disconnect, getConnection, getConnectionType, getMainThreadEventLoop, hasChannel, hasChannel, hasChannel, send
Methods inherited from interface net.neoforged.neoforge.common.extensions.IServerCommonPacketListenerExtension
send, send, send
Methods inherited from interface net.neoforged.neoforge.common.extensions.IServerGamePacketListenerExtension
sendBundled, sendBundled
Methods inherited from interface net.minecraft.network.PacketListener
createDisconnectionInfo, fillCrashReport, fillListenerSpecificCrashDetails
Methods inherited from interface net.minecraft.network.ServerboundPacketListener
flow
Methods inherited from interface net.minecraft.network.protocol.common.ServerCommonPacketListener
handleKeepAlive, handlePong, handleResourcePackResponse
Methods inherited from interface net.minecraft.network.protocol.cookie.ServerCookiePacketListener
handleCookieResponse
Methods inherited from interface net.minecraft.network.protocol.game.ServerGamePacketListener
protocol
Methods inherited from interface net.minecraft.network.protocol.game.ServerPacketListener
onPacketError
Methods inherited from interface net.minecraft.server.network.ServerPlayerConnection
send
-
Field Details
-
LOGGER
static final org.slf4j.Logger LOGGER -
NO_BLOCK_UPDATES_TO_ACK
private static final int NO_BLOCK_UPDATES_TO_ACK- See Also:
-
TRACKED_MESSAGE_DISCONNECT_THRESHOLD
private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD- See Also:
-
MAXIMUM_FLYING_TICKS
private static final int MAXIMUM_FLYING_TICKS- See Also:
-
CHAT_VALIDATION_FAILED
-
INVALID_COMMAND_SIGNATURE
-
MAX_COMMAND_SUGGESTIONS
private static final int MAX_COMMAND_SUGGESTIONS- See Also:
-
player
-
chunkSender
-
tickCount
private int tickCount -
ackBlockChangesUpTo
private int ackBlockChangesUpTo -
chatSpamTickCount
private int chatSpamTickCount -
dropSpamTickCount
private int dropSpamTickCount -
firstGoodX
private double firstGoodX -
firstGoodY
private double firstGoodY -
firstGoodZ
private double firstGoodZ -
lastGoodX
private double lastGoodX -
lastGoodY
private double lastGoodY -
lastGoodZ
private double lastGoodZ -
lastVehicle
-
vehicleFirstGoodX
private double vehicleFirstGoodX -
vehicleFirstGoodY
private double vehicleFirstGoodY -
vehicleFirstGoodZ
private double vehicleFirstGoodZ -
vehicleLastGoodX
private double vehicleLastGoodX -
vehicleLastGoodY
private double vehicleLastGoodY -
vehicleLastGoodZ
private double vehicleLastGoodZ -
awaitingPositionFromClient
-
awaitingTeleport
private int awaitingTeleport -
awaitingTeleportTime
private int awaitingTeleportTime -
clientIsFloating
private boolean clientIsFloating -
aboveGroundTickCount
private int aboveGroundTickCount -
clientVehicleIsFloating
private boolean clientVehicleIsFloating -
aboveGroundVehicleTickCount
private int aboveGroundVehicleTickCount -
receivedMovePacketCount
private int receivedMovePacketCount -
knownMovePacketCount
private int knownMovePacketCount -
chatSession
-
signedMessageDecoder
-
lastSeenMessages
-
messageSignatureCache
-
chatMessageChain
-
waitingForSwitchToConfig
private boolean waitingForSwitchToConfig
-
-
Constructor Details
-
ServerGamePacketListenerImpl
public ServerGamePacketListenerImpl(MinecraftServer p_9770_, Connection p_9771_, ServerPlayer p_9772_, CommonListenerCookie p_301978_)
-
-
Method Details
-
tick
public void tick()- Specified by:
tick
in interfaceTickablePacketListener
-
getMaximumFlyingTicks
-
resetPosition
public void resetPosition() -
isAcceptingMessages
public boolean isAcceptingMessages()- Specified by:
isAcceptingMessages
in interfacePacketListener
-
shouldHandleMessage
- Specified by:
shouldHandleMessage
in interfacePacketListener
-
playerProfile
protected com.mojang.authlib.GameProfile playerProfile()- Specified by:
playerProfile
in classServerCommonPacketListenerImpl
-
filterTextPacket
private <T,R> CompletableFuture<R> filterTextPacket(T p_243240_, BiFunction<TextFilter, T, CompletableFuture<R>> p_243271_) -
filterTextPacket
-
filterTextPacket
-
handlePlayerInput
- Specified by:
handlePlayerInput
in interfaceServerGamePacketListener
-
containsInvalidValues
private static boolean containsInvalidValues(double p_143664_, double p_143665_, double p_143666_, float p_143667_, float p_143668_) -
clampHorizontal
private static double clampHorizontal(double p_143610_) -
clampVertical
private static double clampVertical(double p_143654_) -
handleMoveVehicle
- Specified by:
handleMoveVehicle
in interfaceServerGamePacketListener
-
resyncPlayerWithVehicle
-
noBlocksAround
-
handleAcceptTeleportPacket
- Specified by:
handleAcceptTeleportPacket
in interfaceServerGamePacketListener
-
handleRecipeBookSeenRecipePacket
- Specified by:
handleRecipeBookSeenRecipePacket
in interfaceServerGamePacketListener
-
handleRecipeBookChangeSettingsPacket
- Specified by:
handleRecipeBookChangeSettingsPacket
in interfaceServerGamePacketListener
-
handleSeenAdvancements
- Specified by:
handleSeenAdvancements
in interfaceServerGamePacketListener
-
handleCustomCommandSuggestions
- Specified by:
handleCustomCommandSuggestions
in interfaceServerGamePacketListener
-
handleSetCommandBlock
- Specified by:
handleSetCommandBlock
in interfaceServerGamePacketListener
-
handleSetCommandMinecart
- Specified by:
handleSetCommandMinecart
in interfaceServerGamePacketListener
-
handlePickItem
- Specified by:
handlePickItem
in interfaceServerGamePacketListener
-
handleRenameItem
- Specified by:
handleRenameItem
in interfaceServerGamePacketListener
-
handleSetBeaconPacket
- Specified by:
handleSetBeaconPacket
in interfaceServerGamePacketListener
-
handleSetStructureBlock
- Specified by:
handleSetStructureBlock
in interfaceServerGamePacketListener
-
handleSetJigsawBlock
- Specified by:
handleSetJigsawBlock
in interfaceServerGamePacketListener
-
handleJigsawGenerate
- Specified by:
handleJigsawGenerate
in interfaceServerGamePacketListener
-
handleSelectTrade
- Specified by:
handleSelectTrade
in interfaceServerGamePacketListener
-
handleEditBook
- Specified by:
handleEditBook
in interfaceServerGamePacketListener
-
updateBookContents
-
signBook
-
filterableFromOutgoing
-
handleEntityTagQuery
- Specified by:
handleEntityTagQuery
in interfaceServerGamePacketListener
-
handleContainerSlotStateChanged
- Specified by:
handleContainerSlotStateChanged
in interfaceServerGamePacketListener
-
handleBlockEntityTagQuery
- Specified by:
handleBlockEntityTagQuery
in interfaceServerGamePacketListener
-
handleMovePlayer
- Specified by:
handleMovePlayer
in interfaceServerGamePacketListener
-
updateAwaitingTeleport
private boolean updateAwaitingTeleport() -
isPlayerCollidingWithAnythingNew
private boolean isPlayerCollidingWithAnythingNew(LevelReader p_289008_, AABB p_288986_, double p_288990_, double p_288991_, double p_288967_) -
teleport
public void teleport(double p_9775_, double p_9776_, double p_9777_, float p_9778_, float p_9779_) -
teleport
public void teleport(double p_9781_, double p_9782_, double p_9783_, float p_9784_, float p_9785_, Set<RelativeMovement> p_9786_) -
handlePlayerAction
- Specified by:
handlePlayerAction
in interfaceServerGamePacketListener
-
wasBlockPlacementAttempt
-
handleUseItemOn
- Specified by:
handleUseItemOn
in interfaceServerGamePacketListener
-
handleUseItem
- Specified by:
handleUseItem
in interfaceServerGamePacketListener
-
handleTeleportToEntityPacket
- Specified by:
handleTeleportToEntityPacket
in interfaceServerGamePacketListener
-
handlePaddleBoat
- Specified by:
handlePaddleBoat
in interfaceServerGamePacketListener
-
onDisconnect
- Specified by:
onDisconnect
in interfacePacketListener
- Overrides:
onDisconnect
in classServerCommonPacketListenerImpl
-
removePlayerFromWorld
private void removePlayerFromWorld() -
ackBlockChangesUpTo
public void ackBlockChangesUpTo(int p_215202_) -
handleSetCarriedItem
- Specified by:
handleSetCarriedItem
in interfaceServerGamePacketListener
-
handleChat
- Specified by:
handleChat
in interfaceServerGamePacketListener
-
handleChatCommand
- Specified by:
handleChatCommand
in interfaceServerGamePacketListener
-
performUnsignedChatCommand
-
handleSignedChatCommand
- Specified by:
handleSignedChatCommand
in interfaceServerGamePacketListener
-
performSignedChatCommand
private void performSignedChatCommand(ServerboundChatCommandSignedPacket p_338593_, LastSeenMessages p_250484_) -
handleMessageDecodeFailure
-
collectSignedArguments
private <S> Map<String,PlayerChatMessage> collectSignedArguments(ServerboundChatCommandSignedPacket p_338222_, SignableCommand<S> p_250039_, LastSeenMessages p_249207_) throws SignedMessageChain.DecodeException -
collectUnsignedArguments
private <S> Map<String,PlayerChatMessage> collectUnsignedArguments(List<SignableCommand.Argument<S>> p_338744_) throws SignedMessageChain.DecodeException -
createSignedArgumentMismatchException
private static <S> SignedMessageChain.DecodeException createSignedArgumentMismatchException(String p_338499_, List<ArgumentSignatures.Entry> p_338388_, List<SignableCommand.Argument<S>> p_338708_) -
parseCommand
-
tryHandleChat
-
unpackAndApplyLastSeen
-
isChatMessageIllegal
-
getSignedMessage
private PlayerChatMessage getSignedMessage(ServerboundChatPacket p_251061_, LastSeenMessages p_250566_) throws SignedMessageChain.DecodeException -
broadcastChatMessage
-
detectRateSpam
private void detectRateSpam() -
handleChatAck
- Specified by:
handleChatAck
in interfaceServerGamePacketListener
-
handleAnimate
- Specified by:
handleAnimate
in interfaceServerGamePacketListener
-
handlePlayerCommand
- Specified by:
handlePlayerCommand
in interfaceServerGamePacketListener
-
addPendingMessage
-
sendPlayerChatMessage
-
sendDisguisedChatMessage
-
getRemoteAddress
-
switchToConfig
public void switchToConfig() -
handlePingRequest
- Specified by:
handlePingRequest
in interfaceServerPingPacketListener
-
handleInteract
- Specified by:
handleInteract
in interfaceServerGamePacketListener
-
handleClientCommand
- Specified by:
handleClientCommand
in interfaceServerGamePacketListener
-
handleContainerClose
- Specified by:
handleContainerClose
in interfaceServerGamePacketListener
-
handleContainerClick
- Specified by:
handleContainerClick
in interfaceServerGamePacketListener
-
handlePlaceRecipe
- Specified by:
handlePlaceRecipe
in interfaceServerGamePacketListener
-
handleContainerButtonClick
- Specified by:
handleContainerButtonClick
in interfaceServerGamePacketListener
-
handleSetCreativeModeSlot
- Specified by:
handleSetCreativeModeSlot
in interfaceServerGamePacketListener
-
handleSignUpdate
- Specified by:
handleSignUpdate
in interfaceServerGamePacketListener
-
updateSignText
-
handlePlayerAbilities
- Specified by:
handlePlayerAbilities
in interfaceServerGamePacketListener
-
handleClientInformation
- Specified by:
handleClientInformation
in interfaceServerCommonPacketListener
-
handleChangeDifficulty
- Specified by:
handleChangeDifficulty
in interfaceServerGamePacketListener
-
handleLockDifficulty
- Specified by:
handleLockDifficulty
in interfaceServerGamePacketListener
-
handleChatSessionUpdate
- Specified by:
handleChatSessionUpdate
in interfaceServerGamePacketListener
-
handleConfigurationAcknowledged
- Specified by:
handleConfigurationAcknowledged
in interfaceServerGamePacketListener
-
handleChunkBatchReceived
- Specified by:
handleChunkBatchReceived
in interfaceServerGamePacketListener
-
handleDebugSampleSubscription
- Specified by:
handleDebugSampleSubscription
in interfaceServerGamePacketListener
-
resetPlayerChatState
-
handleCustomPayload
- Specified by:
handleCustomPayload
in interfaceServerCommonPacketListener
- Overrides:
handleCustomPayload
in classServerCommonPacketListenerImpl
-
getPlayer
- Specified by:
getPlayer
in interfaceServerPlayerConnection
-