Package net.minecraft.server.network
Class ServerGamePacketListenerImpl
java.lang.Object
net.minecraft.server.network.ServerGamePacketListenerImpl
- All Implemented Interfaces:
PacketListener
,ServerGamePacketListener
,ServerPacketListener
,TickablePacketListener
,ServerPlayerConnection
- Direct Known Subclasses:
FakePlayer.FakePlayerNetHandler
public class ServerGamePacketListenerImpl
extends Object
implements ServerPlayerConnection, TickablePacketListener, ServerGamePacketListener
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static interface
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
private int
private int
private Vec3
private int
private int
private final FutureChain
private final ChatPreviewCache
private final ChatPreviewThrottler
private int
private boolean
private boolean
final Connection
private int
private double
private double
private double
private long
private boolean
private long
private int
private final AtomicReference<Instant>
private double
private double
private double
private final LastSeenMessagesValidator
private Entity
private static final int
(package private) static final org.slf4j.Logger
static final double
Deprecated.private static final int
private static final int
private int
private final MinecraftServer
private final SignedMessageChain.Decoder
private int
private double
private double
private double
private double
private double
private double
-
Constructor Summary
ConstructorDescriptionServerGamePacketListenerImpl
(MinecraftServer p_9770_, Connection p_9771_, ServerPlayer p_9772_) -
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 Map<String,
PlayerChatMessage> collectSignedArguments
(ServerboundChatCommandPacket p_242876_, PreviewableCommand<?> p_242848_) private static boolean
containsInvalidValues
(double p_143664_, double p_143665_, double p_143666_, float p_143667_, float p_143668_) private void
void
disconnect
(Component p_9943_) void
dismount
(double p_143612_, double p_143613_, double p_143614_, float p_143615_, float p_143616_) 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 CompletableFuture<Component>
getPreviewedArgument
(CommandSourceStack p_242862_, PreviewableCommand<CommandSourceStack> p_242851_) private ChatMessageContent
getSignedContent
(ServerboundChatPacket p_242906_) private PlayerChatMessage
getSignedMessage
(ServerboundChatPacket p_242875_) void
void
handleAnimate
(ServerboundSwingPacket p_9926_) void
void
void
handleChat
(ServerboundChatPacket p_9841_) void
handleChatAck
(ServerboundChatAckPacket p_242387_) void
handleChatCommand
(ServerboundChatCommandPacket p_215225_) void
handleChatPreview
(ServerboundChatPreviewPacket p_215230_) void
void
void
void
void
void
void
void
handleEditBook
(ServerboundEditBookPacket p_9862_) void
void
handleInteract
(ServerboundInteractPacket p_9866_) void
void
void
void
void
void
void
handlePickItem
(ServerboundPickItemPacket p_9880_) void
void
void
void
void
void
handlePong
(ServerboundPongPacket p_143652_) void
void
void
void
void
void
void
void
void
void
void
void
void
void
private boolean
void
void
handleUseItem
(ServerboundUseItemPacket p_9932_) void
private void
private static boolean
isChatMessageIllegal
(String p_215215_) private boolean
isPlayerCollidingWithAnythingNew
(LevelReader p_9796_, AABB p_9797_) private boolean
private boolean
noBlocksAround
(Entity p_9794_) void
onDisconnect
(Component p_9825_) private com.mojang.brigadier.ParseResults<CommandSourceStack>
parseCommand
(String p_242938_) private void
performChatCommand
(ServerboundChatCommandPacket p_242859_) private CompletableFuture<Component>
queryChatPreview
(String p_215247_) private CompletableFuture<Component>
queryCommandPreview
(String p_215249_) private CompletableFuture<Component>
queryPreview
(String p_215235_) void
void
void
send
(Packet<?> p_243227_, PacketSendListener p_243273_) private void
sendPreviewResponse
(int p_238389_, Component p_238390_) private void
signBook
(FilteredText p_215209_, List<FilteredText> p_215210_, int p_215211_) 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<ClientboundPlayerPositionPacket.RelativeArgument> p_9786_) void
teleport
(double p_143618_, double p_143619_, double p_143620_, float p_143621_, float p_143622_, Set<ClientboundPlayerPositionPacket.RelativeArgument> p_143623_, boolean p_143624_) void
tick()
private boolean
tryHandleChat
(String p_242372_, Instant p_242311_, LastSeenMessages.Update p_242217_) private void
updateBookContents
(List<FilteredText> p_9813_, int p_9814_) private void
updateBookPages
(List<FilteredText> p_143635_, UnaryOperator<String> p_143636_, ItemStack p_143637_) private boolean
updateChatOrder
(Instant p_215237_) private void
updateSignText
(ServerboundSignUpdatePacket p_9923_, List<FilteredText> p_9924_) private boolean
verifyChatMessage
(PlayerChatMessage p_242942_) private static boolean
wasBlockPlacementAttempt
(ServerPlayer p_9791_, ItemStack p_9792_) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.network.protocol.game.ServerPacketListener
shouldPropagateHandlingExceptions
-
Field Details
-
LOGGER
static final org.slf4j.Logger LOGGER -
LATENCY_CHECK_INTERVAL
private static final int LATENCY_CHECK_INTERVAL- See Also:
-
MAX_INTERACTION_DISTANCE
Deprecated.Forge: Deprecated in favor of range/reach attributes.- See Also:
-
NO_BLOCK_UPDATES_TO_ACK
private static final int NO_BLOCK_UPDATES_TO_ACK- See Also:
-
PENDING_MESSAGE_DISCONNECT_THRESHOLD
private static final int PENDING_MESSAGE_DISCONNECT_THRESHOLD- See Also:
-
connection
-
server
-
player
-
tickCount
private int tickCount -
ackBlockChangesUpTo
private int ackBlockChangesUpTo -
keepAliveTime
private long keepAliveTime -
keepAlivePending
private boolean keepAlivePending -
keepAliveChallenge
private long keepAliveChallenge -
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 -
chatPreviewCache
-
chatPreviewThrottler
-
lastChatTimeStamp
-
signedMessageDecoder
-
lastSeenMessagesValidator
-
chatMessageChain
-
-
Constructor Details
-
ServerGamePacketListenerImpl
public ServerGamePacketListenerImpl(MinecraftServer p_9770_, Connection p_9771_, ServerPlayer p_9772_)
-
-
Method Details
-
tick
public void tick()- Specified by:
tick
in interfaceTickablePacketListener
-
resetPosition
public void resetPosition() -
getConnection
- Specified by:
getConnection
in interfacePacketListener
-
isSingleplayerOwner
private boolean isSingleplayerOwner() -
disconnect
-
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
-
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
-
updateBookPages
private void updateBookPages(List<FilteredText> p_143635_, UnaryOperator<String> p_143636_, ItemStack p_143637_) -
handleEntityTagQuery
- Specified by:
handleEntityTagQuery
in interfaceServerGamePacketListener
-
handleBlockEntityTagQuery
- Specified by:
handleBlockEntityTagQuery
in interfaceServerGamePacketListener
-
handleMovePlayer
- Specified by:
handleMovePlayer
in interfaceServerGamePacketListener
-
isPlayerCollidingWithAnythingNew
-
dismount
public void dismount(double p_143612_, double p_143613_, double p_143614_, float p_143615_, float p_143616_) -
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<ClientboundPlayerPositionPacket.RelativeArgument> p_9786_) -
teleport
public void teleport(double p_143618_, double p_143619_, double p_143620_, float p_143621_, float p_143622_, Set<ClientboundPlayerPositionPacket.RelativeArgument> p_143623_, boolean p_143624_) -
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
-
handleResourcePackResponse
- Specified by:
handleResourcePackResponse
in interfaceServerGamePacketListener
-
handlePaddleBoat
- Specified by:
handlePaddleBoat
in interfaceServerGamePacketListener
-
handlePong
- Specified by:
handlePong
in interfaceServerGamePacketListener
-
onDisconnect
- Specified by:
onDisconnect
in interfacePacketListener
-
ackBlockChangesUpTo
public void ackBlockChangesUpTo(int p_215202_) -
send
- Specified by:
send
in interfaceServerPlayerConnection
-
send
-
handleSetCarriedItem
- Specified by:
handleSetCarriedItem
in interfaceServerGamePacketListener
-
handleChat
- Specified by:
handleChat
in interfaceServerGamePacketListener
-
handleChatCommand
- Specified by:
handleChatCommand
in interfaceServerGamePacketListener
-
performChatCommand
-
collectSignedArguments
private Map<String,PlayerChatMessage> collectSignedArguments(ServerboundChatCommandPacket p_242876_, PreviewableCommand<?> p_242848_) -
parseCommand
-
tryHandleChat
private boolean tryHandleChat(String p_242372_, Instant p_242311_, LastSeenMessages.Update p_242217_) -
updateChatOrder
-
isChatMessageIllegal
-
getSignedMessage
-
getSignedContent
-
broadcastChatMessage
-
verifyChatMessage
-
detectRateSpam
private void detectRateSpam() -
handleChatPreview
- Specified by:
handleChatPreview
in interfaceServerGamePacketListener
-
handlesPreviewRequests
private boolean handlesPreviewRequests() -
sendPreviewResponse
-
queryPreview
-
queryChatPreview
-
queryCommandPreview
-
getPreviewedArgument
private CompletableFuture<Component> getPreviewedArgument(CommandSourceStack p_242862_, PreviewableCommand<CommandSourceStack> p_242851_) -
handleChatAck
- Specified by:
handleChatAck
in interfaceServerGamePacketListener
-
handleValidationFailure
-
handleAnimate
- Specified by:
handleAnimate
in interfaceServerGamePacketListener
-
handlePlayerCommand
- Specified by:
handlePlayerCommand
in interfaceServerGamePacketListener
-
signedMessageDecoder
-
addPendingMessage
-
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
-
handleKeepAlive
- Specified by:
handleKeepAlive
in interfaceServerGamePacketListener
-
handlePlayerAbilities
- Specified by:
handlePlayerAbilities
in interfaceServerGamePacketListener
-
handleClientInformation
- Specified by:
handleClientInformation
in interfaceServerGamePacketListener
-
handleCustomPayload
- Specified by:
handleCustomPayload
in interfaceServerGamePacketListener
-
handleChangeDifficulty
- Specified by:
handleChangeDifficulty
in interfaceServerGamePacketListener
-
handleLockDifficulty
- Specified by:
handleLockDifficulty
in interfaceServerGamePacketListener
-
getPlayer
- Specified by:
getPlayer
in interfaceServerPlayerConnection
-