aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0180-Player.setPlayerProfile-API.patch
diff options
context:
space:
mode:
authorAlex <[email protected]>2023-12-28 00:22:44 +0100
committerGitHub <[email protected]>2023-12-28 00:22:44 +0100
commit88d28d6bdd4333c55c75b56913eb879e9cb354bc (patch)
tree0b2c15cd0b7e8ccb9dc0e22f7f010b62cbf7a960 /patches/server/0180-Player.setPlayerProfile-API.patch
parenta401585cfaabf8ce9c2f1770fd36ba12d1cfb704 (diff)
downloadPaper-88d28d6bdd4333c55c75b56913eb879e9cb354bc.tar.gz
Paper-88d28d6bdd4333c55c75b56913eb879e9cb354bc.zip
Fix long loading screen when refreshing skins (#10026)
Send `ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START` when refreshing players after player profile changes.
Diffstat (limited to 'patches/server/0180-Player.setPlayerProfile-API.patch')
-rw-r--r--patches/server/0180-Player.setPlayerProfile-API.patch38
1 files changed, 29 insertions, 9 deletions
diff --git a/patches/server/0180-Player.setPlayerProfile-API.patch b/patches/server/0180-Player.setPlayerProfile-API.patch
index c4a8f2025f..9825aafe1a 100644
--- a/patches/server/0180-Player.setPlayerProfile-API.patch
+++ b/patches/server/0180-Player.setPlayerProfile-API.patch
@@ -39,6 +39,28 @@ index 827774b02136ec1862bc9ffabc76ba3a4eb87716..96ae1fd95956f5e5a1542dcce3fbd9d4
gameprofile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
playerName = gameprofile.getName();
uniqueId = gameprofile.getId();
+diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
+index 6e0a21935f9d5f35cbce72b32e0a89bb636804e2..782cc6d910efe5bc5498d0083afab42fad6c4fa2 100644
+--- a/src/main/java/net/minecraft/server/players/PlayerList.java
++++ b/src/main/java/net/minecraft/server/players/PlayerList.java
+@@ -862,10 +862,16 @@ public abstract class PlayerList {
+ }
+
+ public void sendPlayerPermissionLevel(ServerPlayer player) {
++ // Paper start - avoid recalculating permissions if possible
++ this.sendPlayerPermissionLevel(player, true);
++ }
++
++ public void sendPlayerPermissionLevel(ServerPlayer player, boolean recalculatePermissions) {
++ // Paper end - avoid recalculating permissions if possible
+ GameProfile gameprofile = player.getGameProfile();
+ int i = this.server.getProfilePermissions(gameprofile);
+
+- this.sendPlayerPermissionLevel(player, i);
++ this.sendPlayerPermissionLevel(player, i, recalculatePermissions); // Paper - avoid recalculating permissions if possible
+ }
+
+ public void tick() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index 477d3245facb5ae59c786d4f696f64226cb540a6..e8490a58dd4d9bc39a5bb2f9fc109526e031b971 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
@@ -55,7 +77,7 @@ index 477d3245facb5ae59c786d4f696f64226cb540a6..e8490a58dd4d9bc39a5bb2f9fc109526
public Server getServer() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index 7021921980b20a8c61016a021b281af58ed72b51..44b98fc01ce1879f08987c6544b77b442e7bfad6 100644
+index 8dd7e875d0e2ac3c10cce9b7045b5dbc742e9fb7..d296e1687fd596d6674e18b316603d08cd9057df 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -272,11 +272,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -162,7 +184,7 @@ index 7021921980b20a8c61016a021b281af58ed72b51..44b98fc01ce1879f08987c6544b77b44
void resetAndShowEntity(org.bukkit.entity.Entity entity) {
// SPIGOT-7312: Can't show/hide self
-@@ -1799,6 +1845,36 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
+@@ -1799,6 +1845,34 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.trackAndShowEntity(entity);
}
}
@@ -179,21 +201,19 @@ index 7021921980b20a8c61016a021b281af58ed72b51..44b98fc01ce1879f08987c6544b77b44
+
+ //Respawn the player then update their position and selected slot
+ ServerLevel worldserver = handle.serverLevel();
-+ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(new net.minecraft.network.protocol.game.CommonPlayerSpawnInfo(worldserver.dimensionTypeId(), worldserver.dimension(), net.minecraft.world.level.biome.BiomeManager.obfuscateSeed(worldserver.getSeed()), handle.gameMode.getGameModeForPlayer(), handle.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), handle.getLastDeathLocation(), handle.getPortalCooldown()), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA));
++ connection.send(new net.minecraft.network.protocol.game.ClientboundRespawnPacket(handle.createCommonSpawnInfo(worldserver), net.minecraft.network.protocol.game.ClientboundRespawnPacket.KEEP_ALL_DATA));
+ handle.onUpdateAbilities();
+ connection.internalTeleport(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), java.util.Collections.emptySet());
-+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().sendAllPlayerInfo(handle);
++ net.minecraft.server.players.PlayerList playerList = handle.server.getPlayerList();
++ playerList.sendPlayerPermissionLevel(handle, false);
++ playerList.sendLevelInfo(handle, worldserver);
++ playerList.sendAllPlayerInfo(handle);
+
+ // Resend their XP and effects because the respawn packet resets it
+ connection.send(new net.minecraft.network.protocol.game.ClientboundSetExperiencePacket(handle.experienceProgress, handle.totalExperience, handle.experienceLevel));
+ for (net.minecraft.world.effect.MobEffectInstance mobEffect : handle.getActiveEffects()) {
+ connection.send(new net.minecraft.network.protocol.game.ClientboundUpdateMobEffectPacket(handle.getId(), mobEffect));
+ }
-+
-+ if (this.isOp()) {
-+ this.setOp(false);
-+ this.setOp(true);
-+ }
+ }
+ // Paper end