mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-02 13:12:03 -07:00
Fix long loading screen when refreshing skins (#10026)
Send `ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START` when refreshing players after player profile changes.
This commit is contained in:
@@ -39,6 +39,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
@@ -179,21 +201,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ //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
|
||||
|
||||
|
Reference in New Issue
Block a user