Upstream update

This commit is contained in:
Bjarne Koll 2024-10-24 19:29:35 +02:00
parent fc05430719
commit 9047541397
No known key found for this signature in database
GPG key ID: 27F6CCCF55D2EE62
174 changed files with 468 additions and 468 deletions

View file

@ -229,10 +229,10 @@ index f8ae8c8eff73e4e87eb34d0f2635517f1688a6f1..59d20fd62e850a38380d877cef95ed69
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146ed4bd2b52 100644
index 674149f3a392a600a506e55f20db044619328cd2..0fb16f3193c88c5f58d16aaf85129bbfd01fdfcd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -357,7 +357,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -359,7 +359,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
@ -241,7 +241,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
return;
}
} else {
@@ -376,7 +376,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -378,7 +378,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
@ -250,7 +250,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
return;
}
} else {
@@ -396,7 +396,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -398,7 +398,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.dropSpamThrottler.tick();
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) {
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
@ -259,7 +259,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
}
}
@@ -478,7 +478,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -486,7 +486,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
@ -268,7 +268,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
} else if (!this.updateAwaitingTeleport()) {
Entity entity = this.player.getRootVehicle();
@@ -684,7 +684,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -692,7 +692,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
@ -277,7 +277,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
return;
}
@@ -748,7 +748,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -756,7 +756,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async
// CraftBukkit start
if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - configurable tab spam limits
@ -286,7 +286,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
return;
}
// CraftBukkit end
@@ -913,7 +913,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -921,7 +921,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start - validate pick item position
if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -295,7 +295,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
return;
}
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -1116,14 +1116,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1124,14 +1124,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (byteTotal > byteAllowed) {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to send a book too large. Book size: {} - Allowed: {} - Pages: {}", this.player.getScoreboardName(), byteTotal, byteAllowed, pageList.size());
@ -312,7 +312,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
return;
}
this.lastBookTick = MinecraftServer.currentTick;
@@ -1232,7 +1232,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1240,7 +1240,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
@ -321,7 +321,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
} else {
ServerLevel worldserver = this.player.serverLevel();
@@ -1671,7 +1671,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1679,7 +1679,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.dropCount++;
if (this.dropCount >= 20) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
@ -330,7 +330,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
return;
}
}
@@ -1968,7 +1968,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1976,7 +1976,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.resetLastActionTime();
} else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -339,7 +339,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
}
}
@@ -2166,7 +2166,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2174,7 +2174,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void tryHandleChat(String s, Runnable runnable, boolean sync) { // CraftBukkit
if (ServerGamePacketListenerImpl.isChatMessageIllegal(s)) {
@ -348,7 +348,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
} else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
} else {
@@ -2189,7 +2189,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2197,7 +2197,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (optional.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -357,7 +357,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
}
return optional;
@@ -2373,7 +2373,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2381,7 +2381,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// this.chatSpamThrottler.increment();
if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) {
// CraftBukkit end
@ -366,7 +366,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
}
}
@@ -2385,7 +2385,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2393,7 +2393,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
synchronized (this.lastSeenMessages) {
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
@ -375,7 +375,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
}
}
@@ -2533,7 +2533,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2541,7 +2541,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (i > 4096) {
@ -384,7 +384,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
}
}
@@ -2591,7 +2591,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2599,7 +2599,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
@ -393,7 +393,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
return;
}
// Spigot End
@@ -2707,7 +2707,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2715,7 +2715,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
}
@ -402,7 +402,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
});
@@ -3106,7 +3106,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3114,7 +3114,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start - auto recipe limit
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (!this.recipeSpamPackets.isIncrementAndUnderThreshold()) {
@ -411,7 +411,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
return;
}
}
@@ -3377,7 +3377,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3385,7 +3385,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
@ -420,7 +420,7 @@ index 7990bd0279839558bed18a3dca7739ef74ecb74a..f4d92374f7865a39a0442d79eb5f146e
} else {
try {
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
@@ -3390,7 +3390,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3398,7 +3398,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
@ -495,10 +495,10 @@ index 9e2ad78b12cadbf0e2bda1e12fe844120529c347..6a7d7fad990fc44fdda6849d43dad141
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b54b773a4e1472f94c5c28188f706fbeb2cfb067..5347ad30130d598644902cdc8902e0b77ac4dfb1 100644
index 3cb6f46492a3441c09a452836d01c15d1837f6ea..4b28318dbdeb3fa5935949740343c996d30aa2dd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -276,7 +276,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -280,7 +280,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
void sendPacket(Packet<?> packet);
@ -507,7 +507,7 @@ index b54b773a4e1472f94c5c28188f706fbeb2cfb067..5347ad30130d598644902cdc8902e0b7
}
public record CookieFuture(ResourceLocation key, CompletableFuture<byte[]> future) {
@@ -648,7 +648,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -652,7 +652,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kickPlayer(String message) {
org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot
@ -516,7 +516,7 @@ index b54b773a4e1472f94c5c28188f706fbeb2cfb067..5347ad30130d598644902cdc8902e0b7
}
// Paper start
@@ -660,10 +660,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -664,10 +664,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kick(final net.kyori.adventure.text.Component message) {
@ -533,7 +533,7 @@ index b54b773a4e1472f94c5c28188f706fbeb2cfb067..5347ad30130d598644902cdc8902e0b7
}
}
@@ -722,7 +727,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -726,7 +731,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper start - Improve chat handling
if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) {