mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-18 12:48:53 +01:00
Add missing UPDATE_HAT and UPDATE_LIST_ORDER to some paper-added functions in ClientboundPlayerInfoUpdatePacket (#11731)
This commit is contained in:
parent
4803421326
commit
b746d9df0b
1 changed files with 24 additions and 6 deletions
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add Listing API for Player
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java
|
||||
index 6bfb83434a184e6fdba932f692281f0303ada65f..e2541a3886504b143f858a4e75ac4746d4d39e28 100644
|
||||
index 6bfb83434a184e6fdba932f692281f0303ada65f..91e71d282855c472bf81ff97ae830e5321f69e66 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java
|
||||
@@ -38,6 +38,17 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke
|
||||
|
@ -26,13 +26,22 @@ index 6bfb83434a184e6fdba932f692281f0303ada65f..e2541a3886504b143f858a4e75ac4746
|
|||
|
||||
public static ClientboundPlayerInfoUpdatePacket createPlayerInitializing(Collection<ServerPlayer> players) {
|
||||
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.of(
|
||||
@@ -53,6 +64,28 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke
|
||||
@@ -53,6 +64,46 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke
|
||||
return new ClientboundPlayerInfoUpdatePacket(enumSet, players);
|
||||
}
|
||||
|
||||
+ // Paper start - Add Listing API for Player
|
||||
+ public static ClientboundPlayerInfoUpdatePacket createPlayerInitializing(Collection<ServerPlayer> players, ServerPlayer forPlayer) {
|
||||
+ final EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME);
|
||||
+ final EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.of(
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_HAT,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LIST_ORDER
|
||||
+ );
|
||||
+ final List<ClientboundPlayerInfoUpdatePacket.Entry> entries = new java.util.ArrayList<>(players.size());
|
||||
+ final org.bukkit.craftbukkit.entity.CraftPlayer bukkitEntity = forPlayer.getBukkitEntity();
|
||||
+ for (final ServerPlayer player : players) {
|
||||
|
@ -42,7 +51,16 @@ index 6bfb83434a184e6fdba932f692281f0303ada65f..e2541a3886504b143f858a4e75ac4746
|
|||
+ }
|
||||
+
|
||||
+ public static ClientboundPlayerInfoUpdatePacket createSinglePlayerInitializing(ServerPlayer player, boolean listed) {
|
||||
+ final EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME);
|
||||
+ final EnumSet<ClientboundPlayerInfoUpdatePacket.Action> enumSet = EnumSet.of(
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_HAT,
|
||||
+ ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LIST_ORDER
|
||||
+ );
|
||||
+ final List<ClientboundPlayerInfoUpdatePacket.Entry> entries = List.of(new Entry(player, listed));
|
||||
+ return new ClientboundPlayerInfoUpdatePacket(enumSet, entries);
|
||||
+ }
|
||||
|
@ -55,7 +73,7 @@ index 6bfb83434a184e6fdba932f692281f0303ada65f..e2541a3886504b143f858a4e75ac4746
|
|||
private ClientboundPlayerInfoUpdatePacket(RegistryFriendlyByteBuf buf) {
|
||||
this.actions = buf.readEnumSet(ClientboundPlayerInfoUpdatePacket.Action.class);
|
||||
this.entries = buf.readList(buf2 -> {
|
||||
@@ -165,10 +198,15 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke
|
||||
@@ -165,10 +216,15 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke
|
||||
@Nullable RemoteChatSession.Data chatSession
|
||||
) {
|
||||
Entry(ServerPlayer player) {
|
||||
|
@ -72,7 +90,7 @@ index 6bfb83434a184e6fdba932f692281f0303ada65f..e2541a3886504b143f858a4e75ac4746
|
|||
player.connection.latency(),
|
||||
player.gameMode.getGameModeForPlayer(),
|
||||
player.getTabListDisplayName(),
|
||||
@@ -177,6 +215,11 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke
|
||||
@@ -177,6 +233,11 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet<ClientGamePacke
|
||||
Optionull.map(player.getChatSession(), RemoteChatSession::asData)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue