8000 Fix floating warning log when the kick event is canceled (#12374) · PaperMC/Paper@df42993 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit df42993

Browse files
authored
Fix floating warning log when the kick event is canceled (#12374)
1 parent d22644a commit df42993

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

paper-server/patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
if (packet.isTerminal()) {
249249
this.close();
250250
}
251-
@@ -165,19 +_,108 @@
251+
@@ -165,19 +_,115 @@
252252
}
253253
}
254254

@@ -315,6 +315,13 @@
315315
+ // Do not kick the player
316316
+ return;
317317
+ }
318+
+
319+
+ // Log kick to console *after* event was processed.
320+
+ switch (cause) {
321+
+ case FLYING_PLAYER -> LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
322+
+ case FLYING_VEHICLE -> LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
323+
+ }
324+
+
318325
+ // Send the possibly modified leave message
319326
+ this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionDetails.report(), disconnectionDetails.bugReportLink()), event.leaveMessage()); // Paper - Adventure & use kick event leave message
320327
+ }

paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,24 @@
9595
}
9696

9797
@Override
98-
@@ -285,7 +_,7 @@
98+
@@ -284,8 +_,8 @@
99+
this.knownMovePacketCount = this.receivedMovePacketCount;
99100
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
100101
if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) {
101-
LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
102+
- LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
102103
- this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
104+
+ // LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); // Paper - Logging moved to net.minecraft.server.network.ServerCommonPacketListenerImpl.disconnect()
103105
+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause
104106
return;
105107
}
106108
} else {
107-
@@ -304,7 +_,7 @@
109+
@@ -303,8 +_,8 @@
110+
this.vehicleLastGoodZ = this.lastVehicle.getZ();
108111
if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) {
109112
if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) {
110-
LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
113+
- LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
111114
- this.disconnect(Component.translatable("multiplayer.disconnect.flying"));
115+
+ // LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); // Paper - Logging moved to net.minecraft.server.network.ServerCommonPacketListenerImpl.disconnect()
112116
+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause
113117
return;
114118
}

0 commit comments

Comments
 (0)
0