Fixed more stuff

This commit is contained in:
NickAcPT 2018-07-21 18:17:54 +01:00
parent 09f013532a
commit 7dd5837dd0

View File

@ -1,4 +1,4 @@
From 95e357f7dd549b278714a9ea76bf6d11d6c2b5fd Mon Sep 17 00:00:00 2001 From 8a9ff94f0db13f56873de8e6f555bc7893cffc31 Mon Sep 17 00:00:00 2001
From: NickAcPT <32451103+NickAcPT@users.noreply.github.com> From: NickAcPT <32451103+NickAcPT@users.noreply.github.com>
Date: Sat, 21 Jul 2018 01:30:30 +0100 Date: Sat, 21 Jul 2018 01:30:30 +0100
Subject: [PATCH] Extend player profile API to support skin changes Subject: [PATCH] Extend player profile API to support skin changes
@ -6,18 +6,10 @@ Subject: [PATCH] Extend player profile API to support skin changes
Added code that refreshes the player's skin by sending packets with a special order, telling the client to respawn the player and re-apply the game profile Added code that refreshes the player's skin by sending packets with a special order, telling the client to respawn the player and re-apply the game profile
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 6cbf429f..57f17120 100644 index 6cbf429f..01335b6b 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
@@ -55,6 +55,7 @@ import org.bukkit.craftbukkit.CraftStatistic; @@ -1176,10 +1176,38 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.advancement.CraftAdvancement;
import org.bukkit.craftbukkit.advancement.CraftAdvancementProgress;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.map.CraftMapView;
import org.bukkit.craftbukkit.map.RenderData;
import org.bukkit.craftbukkit.scoreboard.CraftScoreboard;
@@ -1176,10 +1177,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
for (EntityPlayer player : players) { for (EntityPlayer player : players) {
player.getBukkitEntity().reregisterPlayer(self); player.getBukkitEntity().reregisterPlayer(self);
} }
@ -30,20 +22,17 @@ index 6cbf429f..57f17120 100644
+ private void refreshPlayer() { + private void refreshPlayer() {
+ EntityPlayer entityplayer = getHandle(); + EntityPlayer entityplayer = getHandle();
+ +
+ Packet respawn = new PacketPlayOutRespawn(entityplayer.dimension, entityplayer.world.getDifficulty(), entityplayer.world.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode()); + Location loc = getLocation();
+ Location l = getLocation();
+ Packet pos = new PacketPlayOutPosition(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch(), new HashSet<>(), 0);
+ Packet slot = new PacketPlayOutHeldItemSlot(getInventory().getHeldItemSlot());
+ +
+ EntityPlayer handle = getHandle(); + EntityPlayer handle = getHandle();
+ PlayerConnection playerCon = handle.playerConnection; + PlayerConnection connection = handle.playerConnection;
+ reregisterPlayer(handle); + reregisterPlayer(handle);
+ +
+ //Respawn the player then update their position and selected slot + //Respawn the player then update their position and selected slot
+ playerCon.sendPacket(respawn); + connection.sendPacket(new PacketPlayOutRespawn(entityplayer.dimension, entityplayer.world.getDifficulty(), entityplayer.world.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode()));
+ handle.updateAbilities(); + handle.updateAbilities();
+ playerCon.sendPacket(pos); + connection.sendPacket(new PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0));
+ playerCon.sendPacket(slot); + connection.sendPacket(new PacketPlayOutHeldItemSlot(getInventory().getHeldItemSlot()));
+ +
+ updateScaledHealth(); + updateScaledHealth();
+ this.updateInventory(); + this.updateInventory();