From d9d2c41f34a10d7aef6ecba7474e1ad1ae283cf3 Mon Sep 17 00:00:00 2001 From: games647 Date: Fri, 10 Jun 2016 12:32:56 +0200 Subject: [PATCH] Fix client chunk loading on instant updates (Fixes #15) --- .../games647/changeskin/bukkit/tasks/SkinUpdater.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/com/github/games647/changeskin/bukkit/tasks/SkinUpdater.java b/bukkit/src/main/java/com/github/games647/changeskin/bukkit/tasks/SkinUpdater.java index 2290587a..72a2bf16 100644 --- a/bukkit/src/main/java/com/github/games647/changeskin/bukkit/tasks/SkinUpdater.java +++ b/bukkit/src/main/java/com/github/games647/changeskin/bukkit/tasks/SkinUpdater.java @@ -21,6 +21,7 @@ import java.util.logging.Level; import org.bukkit.Bukkit; +import org.bukkit.Chunk; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -107,8 +108,12 @@ private void sendUpdateSelf(WrappedGameProfile gameProfile) throws FieldAccessEx //notify the client that it should update the own skin protocolManager.sendServerPacket(receiver, respawn); + //refresh the chunk + Chunk chunk = receiver.getWorld().getChunkAt(receiver.getLocation()); + receiver.getWorld().refreshChunk(chunk.getX(), chunk.getZ()); + //prevent the moved too quickly message - receiver.teleport(receiver); + receiver.teleport(receiver.getLocation().clone()); //send the current inventory - otherwise player would have an empty inventory receiver.updateInventory();