From 4cccd48a4cd0b3f898e0b3dd79a0b737284ba42e Mon Sep 17 00:00:00 2001
From: NickAcPT <32451103+NickAcPT@users.noreply.github.com>
Date: Sat, 21 Jul 2018 12:58:48 +0100
Subject: [PATCH 1/4] 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
---
 ...-profile-API-to-support-skin-changes.patch |  27 +++
 ...-profile-API-to-support-skin-changes.patch | 161 ++++++++++++++++++
 2 files changed, 188 insertions(+)
 create mode 100644 Spigot-API-Patches/Extend-player-profile-API-to-support-skin-changes.patch
 create mode 100644 Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch

diff --git a/Spigot-API-Patches/Extend-player-profile-API-to-support-skin-changes.patch b/Spigot-API-Patches/Extend-player-profile-API-to-support-skin-changes.patch
new file mode 100644
index 0000000000..569b4caf8d
--- /dev/null
+++ b/Spigot-API-Patches/Extend-player-profile-API-to-support-skin-changes.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: NickAcPT <32451103+NickAcPT@users.noreply.github.com>
+Date: Sat, 21 Jul 2018 01:30:41 +0100
+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
+
+diff --git a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
+index e060c38a..98eade06 100644
+--- a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
++++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
+@@ -0,0 +0,0 @@ public interface PlayerProfile {
+      * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
+      */
+     boolean complete(boolean textures);
++    /**
++     * If this profile is not complete, then make the API call to complete it.
++     * This is a blocking operation and should be done asynchronously.
++     *
++     * Optionally will also fill textures.
++     * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
++     */
++    boolean complete(boolean textures, boolean force);
+ 
+     /**
+      * Whether or not this Profile has textures associated to it
+--
\ No newline at end of file
diff --git a/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch b/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
new file mode 100644
index 0000000000..3a13f606bd
--- /dev/null
+++ b/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
@@ -0,0 +1,161 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: NickAcPT <32451103+NickAcPT@users.noreply.github.com>
+Date: Sat, 21 Jul 2018 01:30:30 +0100
+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
+
+diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
+index 9ad5853d..dda24052 100644
+--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
++++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
+@@ -0,0 +0,0 @@ public class CraftPlayerProfile implements PlayerProfile {
+     }
+ 
+     public boolean complete(boolean textures) {
++        return complete(textures, false);
++    }
++
++    public boolean complete(boolean textures, boolean force) {
+         MinecraftServer server = MinecraftServer.getServer();
+ 
+         boolean isOnlineMode = server.getOnlineMode() || (SpigotConfig.bungee && PaperConfig.bungeeOnlineMode);
+         boolean isCompleteFromCache = this.completeFromCache(true);
+-        if (isOnlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
++        if ((isOnlineMode || force) && (!isCompleteFromCache || textures && !hasTextures())) {
+             GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
+             if (result != null) {
+                 this.profile = result;
+             }
+         }
+-        return profile.isComplete() && (!isOnlineMode || !textures || hasTextures());
++        return profile.isComplete() && (!(isOnlineMode || force) || !textures || hasTextures());
+     }
+ 
+     private static void copyProfileProperties(GameProfile source, GameProfile target) {
+diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
+index dd78a87b..e3f7be28 100644
+--- a/src/main/java/net/minecraft/server/WorldServer.java
++++ b/src/main/java/net/minecraft/server/WorldServer.java
+@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
+         return this;
+     }
+ 
++    // Paper start - Provide dimension number of world
++    public int getDimension() {
++        return dimension;
++    }
++    // Paper end
++
+     // CraftBukkit start
+     @Override
+     public TileEntity getTileEntity(BlockPosition pos) {
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+index 210e3bc4..b0335684 100644
+--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+     }
+     // Paper end
+ 
++    // Paper start - Provide dimension number of world
++    public int getDimension() {
++        return world.dimension;
++    }
++    // Paper end
++
+     private static final Random rand = new Random();
+ 
+     public CraftWorld(WorldServer world, ChunkGenerator gen, Environment env) {
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+index 6cbf429f..bd743be5 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftStatistic;
+ 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;
+@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
+     public void setPlayerProfile(PlayerProfile profile) {
+         EntityPlayer self = getHandle();
+         self.setProfile(CraftPlayerProfile.asAuthlibCopy(profile));
+-        List<EntityPlayer> players = server.getServer().getPlayerList().players;
+-        for (EntityPlayer player : players) {
+-            player.getBukkitEntity().reregisterPlayer(self);
+-        }
++        refreshPlayer();
+     }
+     public PlayerProfile getPlayerProfile() {
+         return new CraftPlayerProfile(this).clone();
+     }
++
++    private void refreshPlayer() {
++        int dimension = getWorld().getEnvironment().getId();
++        Packet respawn = new PacketPlayOutRespawn(dimension, ((WorldServer)getHandle().getWorld()).worldData.getDifficulty(), ((WorldServer)getHandle().getWorld()).worldData.getType(), EnumGamemode.getById(getHandle().playerInteractManager.getGameMode().getId()));
++        Location l = getLocation();
++
++        Packet pos = new PacketPlayOutPosition(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch(), new HashSet<>(), 0);
++        Packet mainhand = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(getInventory().getItemInMainHand()));
++        Packet offhand = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.OFFHAND, CraftItemStack.asNMSCopy(getInventory().getItemInOffHand()));
++        Packet helm = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(getInventory().getHelmet()));
++        Packet chest = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.CHEST, CraftItemStack.asNMSCopy(getInventory().getChestplate()));
++        Packet legs = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.LEGS, CraftItemStack.asNMSCopy(getInventory().getLeggings()));
++        Packet feet = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.FEET, CraftItemStack.asNMSCopy(getInventory().getBoots()));
++        Packet slot = new PacketPlayOutHeldItemSlot(getInventory().getHeldItemSlot());
++
++        for (Player pOnline : Bukkit.getOnlinePlayers()) {
++            EntityPlayer handle = ((CraftPlayer) pOnline).getHandle();
++            PlayerConnection playerCon = handle.playerConnection;
++            if (pOnline.equals(this)) {
++                reregisterPlayer(handle);
++
++                //Respawn the player then update their position and selected slot
++                handle.playerConnection.sendPacket(respawn);
++                handle.updateAbilities();
++                handle.playerConnection.sendPacket(pos);
++                handle.playerConnection.sendPacket(slot);
++
++                ((CraftPlayer) pOnline).updateScaledHealth();
++                pOnline.updateInventory();
++
++                handle.triggerHealthUpdate();
++
++                if (pOnline.isOp()) {
++                    pOnline.setOp(false);
++                    pOnline.setOp(true);
++                }
++                continue;
++            }
++            if (pOnline.getWorld().equals(getWorld()) && pOnline.canSee(this) && isOnline()) {
++                PacketPlayOutEntityDestroy removeEntity = new PacketPlayOutEntityDestroy(new int[]{getEntityId()});
++                PacketPlayOutNamedEntitySpawn addNamed = new PacketPlayOutNamedEntitySpawn(getHandle());
++
++                //Remove and reregister the player
++                handle.playerConnection.sendPacket(removeEntity);
++                ((CraftPlayer) pOnline).reregisterPlayer(this.getHandle());
++                handle.playerConnection.sendPacket(addNamed);
++
++                //Send hand items
++                handle.playerConnection.sendPacket(mainhand);
++                handle.playerConnection.sendPacket(offhand);
++
++                //Send armor
++                handle.playerConnection.sendPacket(helm);
++                handle.playerConnection.sendPacket(chest);
++                handle.playerConnection.sendPacket(legs);
++                handle.playerConnection.sendPacket(feet);
++            } else {
++                //Just send player update
++                ((CraftPlayer) pOnline).reregisterPlayer(this.getHandle());
++            }
++        }
++
++    }
+     // Paper end
+ 
+     public void removeDisconnectingPlayer(Player player) {
+--
\ No newline at end of file

From a7f45fb1b4bf25314328e1fb01ce234db8bfa303 Mon Sep 17 00:00:00 2001
From: NickAcPT <32451103+NickAcPT@users.noreply.github.com>
Date: Sat, 21 Jul 2018 16:22:10 +0100
Subject: [PATCH 2/4] 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
---
 ...-profile-API-to-support-skin-changes.patch |  27 ----
 ...-profile-API-to-support-skin-changes.patch | 124 +++---------------
 2 files changed, 21 insertions(+), 130 deletions(-)
 delete mode 100644 Spigot-API-Patches/Extend-player-profile-API-to-support-skin-changes.patch

diff --git a/Spigot-API-Patches/Extend-player-profile-API-to-support-skin-changes.patch b/Spigot-API-Patches/Extend-player-profile-API-to-support-skin-changes.patch
deleted file mode 100644
index 569b4caf8d..0000000000
--- a/Spigot-API-Patches/Extend-player-profile-API-to-support-skin-changes.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: NickAcPT <32451103+NickAcPT@users.noreply.github.com>
-Date: Sat, 21 Jul 2018 01:30:41 +0100
-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
-
-diff --git a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
-index e060c38a..98eade06 100644
---- a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
-+++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
-@@ -0,0 +0,0 @@ public interface PlayerProfile {
-      * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
-      */
-     boolean complete(boolean textures);
-+    /**
-+     * If this profile is not complete, then make the API call to complete it.
-+     * This is a blocking operation and should be done asynchronously.
-+     *
-+     * Optionally will also fill textures.
-+     * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
-+     */
-+    boolean complete(boolean textures, boolean force);
- 
-     /**
-      * Whether or not this Profile has textures associated to it
---
\ No newline at end of file
diff --git a/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch b/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
index 3a13f606bd..73e1bbeded 100644
--- a/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
+++ b/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
@@ -5,51 +5,6 @@ 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
 
-diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
-index 9ad5853d..dda24052 100644
---- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
-+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
-@@ -0,0 +0,0 @@ public class CraftPlayerProfile implements PlayerProfile {
-     }
- 
-     public boolean complete(boolean textures) {
-+        return complete(textures, false);
-+    }
-+
-+    public boolean complete(boolean textures, boolean force) {
-         MinecraftServer server = MinecraftServer.getServer();
- 
-         boolean isOnlineMode = server.getOnlineMode() || (SpigotConfig.bungee && PaperConfig.bungeeOnlineMode);
-         boolean isCompleteFromCache = this.completeFromCache(true);
--        if (isOnlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
-+        if ((isOnlineMode || force) && (!isCompleteFromCache || textures && !hasTextures())) {
-             GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
-             if (result != null) {
-                 this.profile = result;
-             }
-         }
--        return profile.isComplete() && (!isOnlineMode || !textures || hasTextures());
-+        return profile.isComplete() && (!(isOnlineMode || force) || !textures || hasTextures());
-     }
- 
-     private static void copyProfileProperties(GameProfile source, GameProfile target) {
-diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
-index dd78a87b..e3f7be28 100644
---- a/src/main/java/net/minecraft/server/WorldServer.java
-+++ b/src/main/java/net/minecraft/server/WorldServer.java
-@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler {
-         return this;
-     }
- 
-+    // Paper start - Provide dimension number of world
-+    public int getDimension() {
-+        return dimension;
-+    }
-+    // Paper end
-+
-     // CraftBukkit start
-     @Override
-     public TileEntity getTileEntity(BlockPosition pos) {
 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 index 210e3bc4..b0335684 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -68,7 +23,7 @@ index 210e3bc4..b0335684 100644
  
      public CraftWorld(WorldServer world, ChunkGenerator gen, Environment env) {
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index 6cbf429f..bd743be5 100644
+index 6cbf429f..57f17120 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftStatistic;
@@ -80,13 +35,9 @@ index 6cbf429f..bd743be5 100644
  import org.bukkit.craftbukkit.map.RenderData;
  import org.bukkit.craftbukkit.scoreboard.CraftScoreboard;
 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
-     public void setPlayerProfile(PlayerProfile profile) {
-         EntityPlayer self = getHandle();
-         self.setProfile(CraftPlayerProfile.asAuthlibCopy(profile));
--        List<EntityPlayer> players = server.getServer().getPlayerList().players;
--        for (EntityPlayer player : players) {
--            player.getBukkitEntity().reregisterPlayer(self);
--        }
+         for (EntityPlayer player : players) {
+             player.getBukkitEntity().reregisterPlayer(self);
+         }
 +        refreshPlayer();
      }
      public PlayerProfile getPlayerProfile() {
@@ -94,64 +45,31 @@ index 6cbf429f..bd743be5 100644
      }
 +
 +    private void refreshPlayer() {
-+        int dimension = getWorld().getEnvironment().getId();
-+        Packet respawn = new PacketPlayOutRespawn(dimension, ((WorldServer)getHandle().getWorld()).worldData.getDifficulty(), ((WorldServer)getHandle().getWorld()).worldData.getType(), EnumGamemode.getById(getHandle().playerInteractManager.getGameMode().getId()));
-+        Location l = getLocation();
++        EntityPlayer entityplayer = getHandle();
 +
++        Packet respawn = new PacketPlayOutRespawn(entityplayer.dimension, entityplayer.world.getDifficulty(), entityplayer.world.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode());
++        Location l = getLocation();
 +        Packet pos = new PacketPlayOutPosition(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch(), new HashSet<>(), 0);
-+        Packet mainhand = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(getInventory().getItemInMainHand()));
-+        Packet offhand = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.OFFHAND, CraftItemStack.asNMSCopy(getInventory().getItemInOffHand()));
-+        Packet helm = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(getInventory().getHelmet()));
-+        Packet chest = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.CHEST, CraftItemStack.asNMSCopy(getInventory().getChestplate()));
-+        Packet legs = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.LEGS, CraftItemStack.asNMSCopy(getInventory().getLeggings()));
-+        Packet feet = new PacketPlayOutEntityEquipment(getEntityId(), EnumItemSlot.FEET, CraftItemStack.asNMSCopy(getInventory().getBoots()));
 +        Packet slot = new PacketPlayOutHeldItemSlot(getInventory().getHeldItemSlot());
 +
-+        for (Player pOnline : Bukkit.getOnlinePlayers()) {
-+            EntityPlayer handle = ((CraftPlayer) pOnline).getHandle();
-+            PlayerConnection playerCon = handle.playerConnection;
-+            if (pOnline.equals(this)) {
-+                reregisterPlayer(handle);
++        EntityPlayer handle = getHandle();
++        PlayerConnection playerCon = handle.playerConnection;
++        reregisterPlayer(handle);
 +
-+                //Respawn the player then update their position and selected slot
-+                handle.playerConnection.sendPacket(respawn);
-+                handle.updateAbilities();
-+                handle.playerConnection.sendPacket(pos);
-+                handle.playerConnection.sendPacket(slot);
++        //Respawn the player then update their position and selected slot
++        playerCon.sendPacket(respawn);
++        handle.updateAbilities();
++        playerCon.sendPacket(pos);
++        playerCon.sendPacket(slot);
 +
-+                ((CraftPlayer) pOnline).updateScaledHealth();
-+                pOnline.updateInventory();
++        updateScaledHealth();
++        this.updateInventory();
 +
-+                handle.triggerHealthUpdate();
++        handle.triggerHealthUpdate();
 +
-+                if (pOnline.isOp()) {
-+                    pOnline.setOp(false);
-+                    pOnline.setOp(true);
-+                }
-+                continue;
-+            }
-+            if (pOnline.getWorld().equals(getWorld()) && pOnline.canSee(this) && isOnline()) {
-+                PacketPlayOutEntityDestroy removeEntity = new PacketPlayOutEntityDestroy(new int[]{getEntityId()});
-+                PacketPlayOutNamedEntitySpawn addNamed = new PacketPlayOutNamedEntitySpawn(getHandle());
-+
-+                //Remove and reregister the player
-+                handle.playerConnection.sendPacket(removeEntity);
-+                ((CraftPlayer) pOnline).reregisterPlayer(this.getHandle());
-+                handle.playerConnection.sendPacket(addNamed);
-+
-+                //Send hand items
-+                handle.playerConnection.sendPacket(mainhand);
-+                handle.playerConnection.sendPacket(offhand);
-+
-+                //Send armor
-+                handle.playerConnection.sendPacket(helm);
-+                handle.playerConnection.sendPacket(chest);
-+                handle.playerConnection.sendPacket(legs);
-+                handle.playerConnection.sendPacket(feet);
-+            } else {
-+                //Just send player update
-+                ((CraftPlayer) pOnline).reregisterPlayer(this.getHandle());
-+            }
++        if (this.isOp()) {
++            this.setOp(false);
++            this.setOp(true);
 +        }
 +
 +    }

From 8672424ca11aa40b75d9ffb26fd02434d8675a79 Mon Sep 17 00:00:00 2001
From: NickAcPT <32451103+NickAcPT@users.noreply.github.com>
Date: Sat, 21 Jul 2018 16:54:52 +0100
Subject: [PATCH 3/4] Remove unsed method

---
 ...er-profile-API-to-support-skin-changes.patch | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch b/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
index 73e1bbeded..157636b288 100644
--- a/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
+++ b/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
@@ -5,23 +5,6 @@ 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
 
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 210e3bc4..b0335684 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
-     }
-     // Paper end
- 
-+    // Paper start - Provide dimension number of world
-+    public int getDimension() {
-+        return world.dimension;
-+    }
-+    // Paper end
-+
-     private static final Random rand = new Random();
- 
-     public CraftWorld(WorldServer world, ChunkGenerator gen, Environment env) {
 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
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java

From 9526c764387f57ed118f0af12d9659f8d8f36c31 Mon Sep 17 00:00:00 2001
From: NickAcPT <32451103+NickAcPT@users.noreply.github.com>
Date: Sat, 21 Jul 2018 18:17:54 +0100
Subject: [PATCH 4/4] Fixed more stuff

---
 ...-profile-API-to-support-skin-changes.patch | 23 +++++--------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch b/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
index 157636b288..5c151536a0 100644
--- a/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
+++ b/Spigot-Server-Patches/Extend-player-profile-API-to-support-skin-changes.patch
@@ -6,17 +6,9 @@ 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
 
 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
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftStatistic;
- 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;
 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
          for (EntityPlayer player : players) {
              player.getBukkitEntity().reregisterPlayer(self);
@@ -30,20 +22,17 @@ index 6cbf429f..57f17120 100644
 +    private void refreshPlayer() {
 +        EntityPlayer entityplayer = getHandle();
 +
-+        Packet respawn = new PacketPlayOutRespawn(entityplayer.dimension, entityplayer.world.getDifficulty(), entityplayer.world.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode());
-+        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());
++        Location loc = getLocation();
 +
 +        EntityPlayer handle = getHandle();
-+        PlayerConnection playerCon = handle.playerConnection;
++        PlayerConnection connection = handle.playerConnection;
 +        reregisterPlayer(handle);
 +
 +        //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();
-+        playerCon.sendPacket(pos);
-+        playerCon.sendPacket(slot);
++        connection.sendPacket(new PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0));
++        connection.sendPacket(new PacketPlayOutHeldItemSlot(getInventory().getHeldItemSlot()));
 +
 +        updateScaledHealth();
 +        this.updateInventory();