Fix Player.setPlayerListOrder to send update to clients (#11729)

This commit is contained in:
96DarkCode96 2024-12-11 19:29:51 +01:00 committed by GitHub
parent 8dc76e7152
commit 4803421326
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 29 additions and 4 deletions

View file

@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: 96DarkCode96 <96darkcode96@gmail.com>
Date: Tue, 10 Dec 2024 15:45:47 +0100
Subject: [PATCH] Fix Player.setPlayerListOrder to send update to clients
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d5dc10cf9440f2394e6548c6a3e0160df13c9cae..e9df37ff66700278bc94ea1e42135b92d97d03f7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -606,6 +606,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Preconditions.checkArgument(order >= 0, "order cannot be negative");
this.getHandle().listOrder = order;
+ // Paper start - Send update packet
+ if (getHandle().connection == null) return; // Updates are possible before the player has fully joined
+ for (ServerPlayer player : server.getHandle().players) {
+ if (player.getBukkitEntity().canSee(this)) {
+ player.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LIST_ORDER, getHandle()));
+ }
+ }
+ // Paper end - Send update packet
}
private net.kyori.adventure.text.Component playerListHeader; // Paper - Adventure

View file

@ -36227,10 +36227,10 @@ index ca62105a0ff0aa69385cbf2018f8fe6a4bb69fd4..92d9f0ea8f7810ae20d3996f49aefa53
// Paper start - implement pointers // Paper start - implement pointers
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d5dc10cf9440f2394e6548c6a3e0160df13c9cae..20f64850cb42d986358f01ffcdb42187e1684bca 100644 index e9df37ff66700278bc94ea1e42135b92d97d03f7..6a647cab8b2e476987931486e290703b8726f2c7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3519,7 +3519,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3527,7 +3527,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void setViewDistance(final int viewDistance) { public void setViewDistance(final int viewDistance) {
@ -36241,7 +36241,7 @@ index d5dc10cf9440f2394e6548c6a3e0160df13c9cae..20f64850cb42d986358f01ffcdb42187
} }
@Override @Override
@@ -3529,7 +3531,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3537,7 +3539,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void setSimulationDistance(final int simulationDistance) { public void setSimulationDistance(final int simulationDistance) {
@ -36252,7 +36252,7 @@ index d5dc10cf9440f2394e6548c6a3e0160df13c9cae..20f64850cb42d986358f01ffcdb42187
} }
@Override @Override
@@ -3539,7 +3543,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3547,7 +3551,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void setSendViewDistance(final int viewDistance) { public void setSendViewDistance(final int viewDistance) {