Move clientBrandName over to ServerPlayer (#9809)

This commit is contained in:
Warrior 2023-10-08 13:07:48 +03:00 committed by GitHub
parent adb4fb4bd3
commit a702a083cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 78 additions and 81 deletions

View file

@ -4,63 +4,60 @@ Date: Sat, 11 Apr 2020 13:10:58 +0200
Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4a4002b666c70c7065cad0743377cd13e443aa37..54d0b44eba475f17a908e09d9b56a94a7f050672 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -271,6 +271,7 @@ public class ServerPlayer extends Player {
public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
+ public @Nullable String clientBrandName = null; // Paper - Brand name
// Paper start - replace player chunk loader
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index d1808bf9dc19fad84da5eb3b4c3d549bc624b00a..f4f410f99b475b9c2f7992a3917e3b5c2a2800ba 100644
index d1808bf9dc19fad84da5eb3b4c3d549bc624b00a..e8133a1ec975b7f63926acc7d6ab9291a2107084 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -54,6 +54,8 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -54,6 +54,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private int latency;
private volatile boolean suspendFlushingOnServerThread = false;
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
+ private @Nullable String clientBrandName = null; // Paper - Brand name
+ protected static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
this.server = minecraftserver;
@@ -109,6 +111,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -109,6 +110,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
+ // Paper start - handle brand payload packet
+ if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload brandPayload) {
+ this.clientBrandName = brandPayload.brand();
+ this.player.clientBrandName = brandPayload.brand();
+ }
+ // Paper end - handle brand payload
if (!(packet.payload() instanceof ServerboundCustomPayloadPacket.UnknownPayload)) {
return;
}
@@ -140,6 +147,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -140,6 +146,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
try {
byte[] data = new byte[payload.readableBytes()];
payload.readBytes(data);
+ // Paper start - Brand support - Retain this incase upstream decides to 'break' the new mechanism in favour of backwards compat...
+ if (identifier.equals(MINECRAFT_BRAND)) {
+ try {
+ this.clientBrandName = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.copiedBuffer(data)).readUtf(256);
+ this.player.clientBrandName = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.copiedBuffer(data)).readUtf(256);
+ } catch (StringIndexOutOfBoundsException ex) {
+ this.clientBrandName = "illegal";
+ this.player.clientBrandName = "illegal";
+ }
+ }
+ // Paper end
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -149,6 +165,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
+ // Paper start - brand support
+ @Nullable
+ public String getClientBrandName() {
+ return this.clientBrandName;
+ }
+ // Paper end
+
public final boolean isDisconnected() {
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f4a15de92c3af88624f337c36fadbea67d339064..28c80b15f83947cf44f71da9f9d971f2d6e5dd5b 100644
index f4a15de92c3af88624f337c36fadbea67d339064..0656ea43e1d508d8f6af308475942c28d77655a4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3007,6 +3007,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -70,7 +67,7 @@ index f4a15de92c3af88624f337c36fadbea67d339064..28c80b15f83947cf44f71da9f9d971f2
+ // Paper start - brand support
+ @Override
+ public String getClientBrandName() {
+ return getHandle().connection != null ? getHandle().connection.getClientBrandName() : null;
+ return getHandle().clientBrandName;
+ }
+ // Paper end
+

View file

@ -25,22 +25,22 @@ index f9d7fec242a059a3b056c569ffaf214a361716d6..33a3c657bd390b9e8bc23af93c1107f5
Connection.LOGGER.debug("Failed to sent packet", throwable);
if (this.getSending() == PacketFlow.CLIENTBOUND) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4a4002b666c70c7065cad0743377cd13e443aa37..576fe4a114c7ad0edde3ce7b2cf1b397a287adcd 100644
index 54d0b44eba475f17a908e09d9b56a94a7f050672..bd944ce3308a931391777e3a468daee06d493c73 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -271,6 +271,7 @@ public class ServerPlayer extends Player {
public boolean isRealPlayer; // Paper
@@ -272,6 +272,7 @@ public class ServerPlayer extends Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public @Nullable String clientBrandName = null; // Paper - Brand name
+ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
// Paper start - replace player chunk loader
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index f4f410f99b475b9c2f7992a3917e3b5c2a2800ba..6e9062656a3b137b3589c43805c8f1d1105ba4db 100644
index e8133a1ec975b7f63926acc7d6ab9291a2107084..95d37df1b51453722d47eb07e2e0247f308fa171 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -310,6 +310,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -302,6 +302,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Reset shield blocking on dimension change
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 576fe4a114c7ad0edde3ce7b2cf1b397a287adcd..717e7d0cd5fd62058d5308fc15070bdf72a03bc4 100644
index bd944ce3308a931391777e3a468daee06d493c73..d942b68c01b202dcad1377e98199bab2f79feebf 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1241,6 +1241,11 @@ public class ServerPlayer extends Player {
@@ -1242,6 +1242,11 @@ public class ServerPlayer extends Player {
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
// CraftBukkit end
}

View file

@ -45,10 +45,10 @@ index aee8618e27b893b72931e925724dd683d2e6d2aa..5cb15e2209d7b315904a1fc6d650ce1e
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 717e7d0cd5fd62058d5308fc15070bdf72a03bc4..327307404d336d0e66a265e79448f2342cc36220 100644
index d942b68c01b202dcad1377e98199bab2f79feebf..6856080fc6195e5f340d64434955c4ea3f0b0ef8 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1886,8 +1886,16 @@ public class ServerPlayer extends Player {
@@ -1887,8 +1887,16 @@ public class ServerPlayer extends Player {
}
public boolean setGameMode(GameType gameMode) {
@ -67,7 +67,7 @@ index 717e7d0cd5fd62058d5308fc15070bdf72a03bc4..327307404d336d0e66a265e79448f234
} else {
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId()));
if (gameMode == GameType.SPECTATOR) {
@@ -1899,7 +1907,7 @@ public class ServerPlayer extends Player {
@@ -1900,7 +1908,7 @@ public class ServerPlayer extends Player {
this.onUpdateAbilities();
this.updateEffectVisibility();
@ -76,7 +76,7 @@ index 717e7d0cd5fd62058d5308fc15070bdf72a03bc4..327307404d336d0e66a265e79448f234
}
}
@@ -2303,6 +2311,16 @@ public class ServerPlayer extends Player {
@@ -2304,6 +2312,16 @@ public class ServerPlayer extends Player {
}
public void loadGameTypes(@Nullable CompoundTag nbt) {
@ -144,7 +144,7 @@ index 73ea4907e81d7fd7830b3a9a368c88ac903428bb..4ba775edd90e716435c9ff5dc5579d96
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7362f0e73533c6b202021b93057cc0a23b5f3e99..944416df4eeed12c3ca0b98db7df8295f7e327ec 100644
index 467ab8fbb335617ef419b35c7881ca5606b3e541..6216a1b2c5fbfeafcce4fee81d7b12a14a8f594b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1564,7 +1564,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View file

@ -88,10 +88,10 @@ index c68bac4727f6b2ca95fc8c438303097af14286f2..bb629ec263959c8268de88ca807bddb6
return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason);
}, true);
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812fea14c496 100644
index 95d37df1b51453722d47eb07e2e0247f308fa171..125a9d1ae394db4b0d5418756d50e32feca83344 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -95,7 +95,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -94,7 +94,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> {
@ -100,7 +100,7 @@ index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812f
});
// Paper endg
}
@@ -131,7 +131,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -130,7 +130,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -109,7 +109,7 @@ index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812f
}
} else if (identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -141,7 +141,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -140,7 +140,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -118,7 +118,7 @@ index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812f
}
} else {
try {
@@ -159,7 +159,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -158,7 +158,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@ -127,7 +127,7 @@ index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812f
}
}
@@ -182,7 +182,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -174,7 +174,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
PacketUtils.ensureRunningOnSameThread(packet, this, (BlockableEventLoop) this.server);
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.playerProfile().getName());
@ -136,7 +136,7 @@ index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812f
}
// Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.getAction().ordinal()];
@@ -202,7 +202,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -194,7 +194,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
@ -145,7 +145,7 @@ index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812f
}
} else {
if (elapsedTime >= 15000L) { // 15 seconds
@@ -255,18 +255,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -247,18 +247,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
}
// CraftBukkit start
@ -178,7 +178,7 @@ index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812f
// Paper end
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
@@ -276,7 +286,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -268,7 +278,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
@ -187,7 +187,7 @@ index 6e9062656a3b137b3589c43805c8f1d1105ba4db..7b57657b204204e2a1971c0e1c63812f
return null;
}
};
@@ -295,7 +305,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -287,7 +297,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
@ -488,7 +488,7 @@ index 6724d0a1af13e97bc1d3bd94fd43fef742a0deab..20ba0a0c9eae28658888a77dd2170f62
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 944416df4eeed12c3ca0b98db7df8295f7e327ec..cbda3c45af426d31dd950ddc03d36ae394d9420e 100644
index 6216a1b2c5fbfeafcce4fee81d7b12a14a8f594b..a068e2ae2e419b8b6a8cc560754613a55717c399 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -586,7 +586,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 327307404d336d0e66a265e79448f2342cc36220..1d8328bc7acde64f3a0cff4d20bdca44baddd409 100644
index 6856080fc6195e5f340d64434955c4ea3f0b0ef8..ec135dca185c0c9cdb5a28c75d44f54681448cf8 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2280,7 +2280,7 @@ public class ServerPlayer extends Player {
@@ -2281,7 +2281,7 @@ public class ServerPlayer extends Player {
if (retainOwnership) {
if (!itemstack1.isEmpty()) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fixes kick event leave message not being sent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 1d8328bc7acde64f3a0cff4d20bdca44baddd409..a75377cf94c70011a967e7ede93f903aae4f9f05 100644
index ec135dca185c0c9cdb5a28c75d44f54681448cf8..56743ae068c4fb665534f3b30545b2323820740b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -266,7 +266,6 @@ public class ServerPlayer extends Player {
@ -17,10 +17,10 @@ index 1d8328bc7acde64f3a0cff4d20bdca44baddd409..a75377cf94c70011a967e7ede93f903a
public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 7b57657b204204e2a1971c0e1c63812fea14c496..231150bac0ae61e9722c2cdfd70d6f7d254681e4 100644
index 125a9d1ae394db4b0d5418756d50e32feca83344..20122bf191ebc74c223310aea1f004fdbb163e57 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -77,6 +77,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -76,6 +76,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void onDisconnect(Component reason) {
@ -32,7 +32,7 @@ index 7b57657b204204e2a1971c0e1c63812fea14c496..231150bac0ae61e9722c2cdfd70d6f7d
if (this.isSingleplayerOwner()) {
ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out");
this.server.halt(false);
@@ -315,7 +320,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -307,7 +312,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
// Do not kick the player
return;
}
@ -40,7 +40,7 @@ index 7b57657b204204e2a1971c0e1c63812fea14c496..231150bac0ae61e9722c2cdfd70d6f7d
// Send the possibly modified leave message
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end
@@ -324,7 +328,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -316,7 +320,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
this.connection.disconnect(ichatbasecomponent);
}));

View file

@ -11,7 +11,7 @@ It does not make a lot of sense to damage players if they get crammed,
For those who really want it a config option is provided.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a75377cf94c70011a967e7ede93f903aae4f9f05..b8f60c2deb7e46f654d0169751c793b3b3408748 100644
index 56743ae068c4fb665534f3b30545b2323820740b..25f6b4e7ac794431f1b6170e9e680e43c44d10cf 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -95,6 +95,7 @@ import net.minecraft.util.Mth;
@ -22,7 +22,7 @@ index a75377cf94c70011a967e7ede93f903aae4f9f05..b8f60c2deb7e46f654d0169751c793b3
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
@@ -1473,7 +1474,7 @@ public class ServerPlayer extends Player {
@@ -1474,7 +1475,7 @@ public class ServerPlayer extends Player {
@Override
public boolean isInvulnerableTo(DamageSource damageSource) {

View file

@ -49,10 +49,10 @@ index a2d0699e8427b2262a2396495111125eccafbb66..d797637f61bdf8a424f56fbb48e28b7c
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b8f60c2deb7e46f654d0169751c793b3b3408748..39515b81fd753c8c6d50d1efa4c5792f9f0abda9 100644
index 25f6b4e7ac794431f1b6170e9e680e43c44d10cf..f612363c1530dd66fd57eaa324e285d481fa30e6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1350,7 +1350,7 @@ public class ServerPlayer extends Player {
@@ -1351,7 +1351,7 @@ public class ServerPlayer extends Player {
} else if (this.bedBlocked(blockposition, enumdirection)) {
return Either.left(Player.BedSleepingProblem.OBSTRUCTED);
} else {
@ -61,7 +61,7 @@ index b8f60c2deb7e46f654d0169751c793b3b3408748..39515b81fd753c8c6d50d1efa4c5792f
if (this.level().isDay()) {
return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
} else {
@@ -2200,44 +2200,50 @@ public class ServerPlayer extends Player {
@@ -2201,44 +2201,50 @@ public class ServerPlayer extends Player {
return this.respawnForced;
}
@ -145,7 +145,7 @@ index b8f60c2deb7e46f654d0169751c793b3b3408748..39515b81fd753c8c6d50d1efa4c5792f
} else {
this.respawnPosition = null;
this.respawnDimension = Level.OVERWORLD;
@@ -2245,6 +2251,7 @@ public class ServerPlayer extends Player {
@@ -2246,6 +2252,7 @@ public class ServerPlayer extends Player {
this.respawnForced = false;
}
@ -187,7 +187,7 @@ index 1a27b7faa22e6b3dc5fce329ed06425de56c4315..b9903c29bdea8d1e3b6fce0e97be6bd9
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index cbda3c45af426d31dd950ddc03d36ae394d9420e..18f37eff3c60c52580d49c3398e5ef01245b4412 100644
index a068e2ae2e419b8b6a8cc560754613a55717c399..0cc3a2949b72cfd3eaced42947c365539087e576 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1323,9 +1323,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View file

@ -28,10 +28,10 @@ index a11bd2d9f5b2fb248cc322ea61886050fa2e73a9..80f2a1204bee79daf0cae9310ce8d552
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 39515b81fd753c8c6d50d1efa4c5792f9f0abda9..5f0ff1b2466469eff0bf78042b9cdd2fcf747dc7 100644
index f612363c1530dd66fd57eaa324e285d481fa30e6..3fdf2908d0f6ac994fa05e285d7bc365890964ac 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1616,6 +1616,18 @@ public class ServerPlayer extends Player {
@@ -1617,6 +1617,18 @@ public class ServerPlayer extends Player {
this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId));
this.doCloseContainer();
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure valid vehicle status
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5f0ff1b2466469eff0bf78042b9cdd2fcf747dc7..981a2b55a58f85f551991945adc7a202b4a4ec72 100644
index 3fdf2908d0f6ac994fa05e285d7bc365890964ac..b5b86613aea368c524ed2544b9836a834ed833ad 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -568,7 +568,7 @@ public class ServerPlayer extends Player {
@@ -569,7 +569,7 @@ public class ServerPlayer extends Player {
}
}

View file

@ -2204,10 +2204,10 @@ index d0a8092bf57a29ab7c00ec0ddf52a9fdb2a33267..392406722b0a040c1d41fdc1154d75d3
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 981a2b55a58f85f551991945adc7a202b4a4ec72..24deceb51bc2892231dcd1745082d7f766eed4b5 100644
index b5b86613aea368c524ed2544b9836a834ed833ad..f5fb414087d4346e7d83b8f3ed847731cb03052d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -461,7 +461,7 @@ public class ServerPlayer extends Player {
@@ -462,7 +462,7 @@ public class ServerPlayer extends Player {
if (blockposition1 != null) {
this.moveTo(blockposition1, 0.0F, 0.0F);
@ -2216,7 +2216,7 @@ index 981a2b55a58f85f551991945adc7a202b4a4ec72..24deceb51bc2892231dcd1745082d7f7
break;
}
}
@@ -469,7 +469,7 @@ public class ServerPlayer extends Player {
@@ -470,7 +470,7 @@ public class ServerPlayer extends Player {
} else {
this.moveTo(blockposition, 0.0F, 0.0F);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] fix player loottables running when mob loot gamerule is false
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 24deceb51bc2892231dcd1745082d7f766eed4b5..d865907d4c5d1428d85e4bb63eb45529802d0c0d 100644
index f5fb414087d4346e7d83b8f3ed847731cb03052d..6f7d2990a8562fb670c6800144d67e3becc56c6d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -916,12 +916,14 @@ public class ServerPlayer extends Player {
@@ -917,12 +917,14 @@ public class ServerPlayer extends Player {
}
}
}

View file

@ -24,10 +24,10 @@ index d4a673a9fb604876c554f955ed13ad31a2adb217..e75b3df4db9cb618aef4837acb8cde92
} else {
BlockPos blockPos = BlockPos.containing(x, y, z);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d865907d4c5d1428d85e4bb63eb45529802d0c0d..fc70531c97ce292a9964512008278bcf9377feb6 100644
index 6f7d2990a8562fb670c6800144d67e3becc56c6d..dfc4b41df11a5ce74e490303f56db65cd1df4d9a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1315,6 +1315,12 @@ public class ServerPlayer extends Player {
@@ -1316,6 +1316,12 @@ public class ServerPlayer extends Player {
ResourceKey<Level> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(origin);
ResourceKey<Level> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level());

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerInventorySlotChangeEvent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index fc70531c97ce292a9964512008278bcf9377feb6..d882295abf739967fa5f8621945a5dcd0b730ee4 100644
index dfc4b41df11a5ce74e490303f56db65cd1df4d9a..a9cd91adcdbe8589e8662426af8477473326b957 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -371,6 +371,25 @@ public class ServerPlayer extends Player {
@@ -372,6 +372,25 @@ public class ServerPlayer extends Player {
}
}

View file

@ -8,10 +8,10 @@ offhand slot isn't sent. This is not correct because you *can* put stuff into th
by pressing the offhand swap item
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d882295abf739967fa5f8621945a5dcd0b730ee4..1021872e3ee489bc38e64bdea8bbe53284c87183 100644
index a9cd91adcdbe8589e8662426af8477473326b957..06b455632ce3fc495cd41a61ce5a8a9f06461b1d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -340,6 +340,13 @@ public class ServerPlayer extends Player {
@@ -341,6 +341,13 @@ public class ServerPlayer extends Player {
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add titleOverride to InventoryOpenEvent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d2729c381632bc32ca915bf60614847db07e488b..261d0cc1812831fa99358ec1c6438a4e89629bde 100644
index cacf251db5d60583fe05f571d0fe7844c44900a1..5d32ce8112562f368e6ebea064181622b22823ed 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1559,12 +1559,17 @@ public class ServerPlayer extends Player {
@@ -1560,12 +1560,17 @@ public class ServerPlayer extends Player {
this.nextContainerCounter();
AbstractContainerMenu container = factory.createMenu(this.containerCounter, this.getInventory(), this);
@ -27,7 +27,7 @@ index d2729c381632bc32ca915bf60614847db07e488b..261d0cc1812831fa99358ec1c6438a4e
if (container == null && !cancelled) { // Let pre-cancelled events fall through
// SPIGOT-5263 - close chest if cancelled
if (factory instanceof Container) {
@@ -1586,7 +1591,7 @@ public class ServerPlayer extends Player {
@@ -1587,7 +1592,7 @@ public class ServerPlayer extends Player {
} else {
// CraftBukkit start
this.containerMenu = container;

View file

@ -359,10 +359,10 @@ index aaaf3a60696389b4e27a45de69743311c58e5829..17b6925b46f8386dcfc561483693de51
gameprofilerfiller.pop();
this.chunkMap.tick();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 261d0cc1812831fa99358ec1c6438a4e89629bde..d4aec99cac3f83d764e21946cc904c00e084704e 100644
index 5d32ce8112562f368e6ebea064181622b22823ed..76157319b79d7fefe38cb2cc10b2d79c12667e3d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -317,6 +317,9 @@ public class ServerPlayer extends Player {
@@ -318,6 +318,9 @@ public class ServerPlayer extends Player {
});
}
// Paper end - replace player chunk loader