mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-22 15:05:18 +01:00
Added respawn to ArmorListener
This commit is contained in:
parent
3ea77bb1e6
commit
bbc10a67ef
@ -19,6 +19,7 @@ import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemBreakEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
@ -165,6 +166,17 @@ public class ArmorListener implements Listener {
|
||||
Bukkit.getPluginManager().callEvent(armorEquipEvent);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerRespawnEvent(PlayerRespawnEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
for (ItemStack i : p.getInventory().getArmorContents()) {
|
||||
if (!isAirOrNull(i)) {
|
||||
Bukkit.getPluginManager().callEvent(new ArmorEquipEvent(p, EquipMethod.DEATH, ArmorType.matchType(i), i, null));
|
||||
// No way to cancel a death event.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void itemBreakEvent(PlayerItemBreakEvent e) {
|
||||
ArmorType type = ArmorType.matchType(e.getBrokenItem());
|
||||
|
Loading…
Reference in New Issue
Block a user