From fd1b6b1ae9246096332f56c08acff27196ddd4ad Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Fri, 20 Dec 2024 03:07:40 +0100 Subject: [PATCH] Readd configurable auth server down kick message --- build-data/paper.at | 1 + .../server/level/ServerPlayerGameMode.java.patch | 2 +- .../network/ServerCommonPacketListenerImpl.java.patch | 4 ++-- .../network/ServerGamePacketListenerImpl.java.patch | 9 +++++---- .../network/ServerLoginPacketListenerImpl.java.patch | 11 ++++------- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/build-data/paper.at b/build-data/paper.at index d47d32c8e3..8e1b527ed3 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -105,6 +105,7 @@ public net.minecraft.server.level.ServerPlayer$RespawnPosAngle public net.minecraft.server.level.ServerPlayerGameMode level public net.minecraft.server.level.Ticket key public net.minecraft.server.network.ServerGamePacketListenerImpl isChatMessageIllegal(Ljava/lang/String;)Z +public net.minecraft.server.network.ServerLoginPacketListenerImpl authenticatedProfile public net.minecraft.server.network.ServerLoginPacketListenerImpl connection public net.minecraft.server.network.ServerLoginPacketListenerImpl state public net.minecraft.server.network.ServerLoginPacketListenerImpl$State diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayerGameMode.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayerGameMode.java.patch index 99bc1d539e..f61fcfdd62 100644 --- a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayerGameMode.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayerGameMode.java.patch @@ -279,7 +279,7 @@ - - return true; - } -+ if (flag && hasCorrectToolForDrops/* && event.isDropItems() */) { // CraftBukkit - Check if block should drop items // Paper - fix drops not preventing stats/food exhaustion ++ if (flag && hasCorrectToolForDrops) { // CraftBukkit - Check if block should drop items // Paper - fix drops not preventing stats/food exhaustion + block.playerDestroy(this.level, this.player, pos, blockState1, blockEntity, itemStack, event.isDropItems(), false); // Paper - fix drops not preventing stats/food exhaustion + } + diff --git a/paper-server/patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch b/paper-server/patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch index 4d1d822b0f..e21dc4c54b 100644 --- a/paper-server/patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/network/ServerCommonPacketListenerImpl.java.patch @@ -111,12 +111,12 @@ + this.player.clientBrandName = brand; + } + // Paper end - Brand support -+ if (!(packet.payload() instanceof net.minecraft.network.protocol.common.custom.DiscardedPayload)) { ++ if (!(packet.payload() instanceof final net.minecraft.network.protocol.common.custom.DiscardedPayload discardedPayload)) { + return; + } + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); + net.minecraft.resources.ResourceLocation identifier = packet.payload().type().id(); -+ io.netty.buffer.ByteBuf payload = ((net.minecraft.network.protocol.common.custom.DiscardedPayload)packet.payload()).data(); ++ io.netty.buffer.ByteBuf payload = discardedPayload.data(); + + if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_REGISTER)) { + try { diff --git a/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 39098db25c..fbea2e5964 100644 --- a/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -167,7 +167,7 @@ this.player.setLastClientInput(packet.input()); } -@@ -390,17 +_,29 @@ +@@ -390,25 +_,84 @@ public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (containsInvalidValues(packet.position().x(), packet.position().y(), packet.position().z(), packet.yRot(), packet.xRot())) { @@ -201,16 +201,17 @@ float f = Mth.wrapDegrees(packet.yRot()); float f1 = Mth.wrapDegrees(packet.xRot()); double d3 = d - this.vehicleFirstGoodX; -@@ -408,7 +_,54 @@ + double d4 = d1 - this.vehicleFirstGoodY; double d5 = d2 - this.vehicleFirstGoodZ; double d6 = rootVehicle.getDeltaMovement().lengthSqr(); - double d7 = d3 * d3 + d4 * d4 + d5 * d5; +- double d7 = d3 * d3 + d4 * d4 + d5 * d5; - if (d7 - d6 > 100.0 && !this.isSingleplayerOwner()) { ++ double d7 = d3 * d3 + d4 * d4 + d5 * d5; final double vehicleFirstGoodDistanceSquared = d7; // Paper - OBFHELPER + // Paper start - fix large move vectors killing the server + double currDeltaX = toX - x; + double currDeltaY = toY - y; + double currDeltaZ = toZ - z; -+ double d10 = Math.max(d7, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1); ++ double d10 = Math.max(vehicleFirstGoodDistanceSquared, (currDeltaX * currDeltaX + currDeltaY * currDeltaY + currDeltaZ * currDeltaZ) - 1); + double otherFieldX = d3 - this.vehicleLastGoodX; + double otherFieldY = d4 - this.vehicleLastGoodY; + double otherFieldZ = d5 - this.vehicleLastGoodZ; diff --git a/paper-server/patches/sources/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch b/paper-server/patches/sources/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch index 579db13c3c..47090dba31 100644 --- a/paper-server/patches/sources/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/network/ServerLoginPacketListenerImpl.java.patch @@ -21,12 +21,8 @@ private static final int MAX_TICKS_BEFORE_LOGIN = 600; private final byte[] challenge; final MinecraftServer server; -@@ -56,9 +_,12 @@ - @Nullable - String requestedUsername; - @Nullable -- private GameProfile authenticatedProfile; -+ public GameProfile authenticatedProfile; // Paper - public +@@ -59,6 +_,9 @@ + public GameProfile authenticatedProfile; private final String serverId = ""; private final boolean transferred; + private net.minecraft.server.level.ServerPlayer player; // CraftBukkit @@ -220,7 +216,8 @@ - ServerLoginPacketListenerImpl.this.startClientVerification(UUIDUtil.createOfflineProfile(string1)); + ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(string1)); // Spigot } else { - ServerLoginPacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.authservers_down")); +- ServerLoginPacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.authservers_down")); ++ ServerLoginPacketListenerImpl.this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown)); // Paper - Configurable kick message ServerLoginPacketListenerImpl.LOGGER.error("Couldn't verify username because servers are unavailable"); } + // CraftBukkit start - catch all exceptions