From 9dc5577175c30b34024afab8a39c59291b9946f2 Mon Sep 17 00:00:00 2001 From: William Date: Mon, 26 Dec 2022 16:06:22 +0000 Subject: [PATCH] Clear the player's cursor when setting inventory contents --- .../main/java/net/william278/husksync/player/BukkitPlayer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java b/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java index a7f9ff0d..54fb75f5 100644 --- a/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java +++ b/bukkit/src/main/java/net/william278/husksync/player/BukkitPlayer.java @@ -157,7 +157,9 @@ public class BukkitPlayer extends OnlineUser { return BukkitSerializer.deserializeInventory(itemData.serializedItems).thenApplyAsync(contents -> { final CompletableFuture inventorySetFuture = new CompletableFuture<>(); Bukkit.getScheduler().runTask(BukkitHuskSync.getInstance(), () -> { + player.setItemOnCursor(null); player.getInventory().setContents(contents.getContents()); + player.updateInventory(); inventorySetFuture.complete(null); }); return inventorySetFuture.join();