Readd configurable auth server down kick message

This commit is contained in:
Bjarne Koll 2024-12-20 03:07:40 +01:00
parent 68bbd2e202
commit fd1b6b1ae9
No known key found for this signature in database
GPG key ID: 9576DAF3FDDB088F
5 changed files with 13 additions and 14 deletions

View file

@ -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

View file

@ -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
+ }
+

View file

@ -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 {

View file

@ -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;

View file

@ -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