From 53fb753284d4d1e570f135a2414698437b87a6aa Mon Sep 17 00:00:00 2001 From: Mats Date: Sun, 13 Mar 2016 15:22:23 +0100 Subject: [PATCH] Fix armor not showing on Respawn (With keepinventory true) & world change --- .../us/myles/ViaVersion/armor/ArmorListener.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/us/myles/ViaVersion/armor/ArmorListener.java b/src/main/java/us/myles/ViaVersion/armor/ArmorListener.java index 1e7001977..d1b9be1dc 100644 --- a/src/main/java/us/myles/ViaVersion/armor/ArmorListener.java +++ b/src/main/java/us/myles/ViaVersion/armor/ArmorListener.java @@ -11,8 +11,10 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.CraftingInventory; import us.myles.ViaVersion.ViaVersionPlugin; import us.myles.ViaVersion.api.ViaVersion; @@ -89,6 +91,16 @@ public class ArmorListener implements Listener { sendDelayedArmorUpdate(e.getPlayer()); } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onRespawn(PlayerRespawnEvent e) { + sendDelayedArmorUpdate(e.getPlayer()); + } + + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) + public void onWorldChange(PlayerChangedWorldEvent e){ + sendArmorUpdate(e.getPlayer()); + } + public void sendDelayedArmorUpdate(final Player player) { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override