Skip to content

Commit

Permalink
Fixed ArmorEquipEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
NichtStudioCode committed Jun 28, 2022
1 parent fdd4336 commit 50037a5
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import org.bukkit.event.inventory.InventoryAction
import org.bukkit.event.inventory.InventoryClickEvent
import org.bukkit.event.inventory.InventoryDragEvent
import org.bukkit.event.inventory.InventoryType.SlotType
import org.bukkit.event.player.PlayerInteractEvent
import org.bukkit.event.player.PlayerItemBreakEvent
import org.bukkit.inventory.ItemStack
import org.bukkit.inventory.meta.Damageable
import xyz.xenondevs.nova.LOGGER
import xyz.xenondevs.nova.NOVA
import xyz.xenondevs.nova.initialize.Initializable
import xyz.xenondevs.nova.player.WrappedPlayerInteractEvent
import xyz.xenondevs.nova.util.isCompletelyDenied
import xyz.xenondevs.nova.util.isPlayerView
import xyz.xenondevs.nova.util.isRightClick
Expand Down Expand Up @@ -84,7 +84,7 @@ internal object ArmorEquipListener : Initializable(), Listener {
InventoryAction.HOTBAR_SWAP -> {
if (slotType == SlotType.ARMOR) {
val hotbarItem = player.inventory.getItem(event.hotbarButton)
if (creative || ArmorType.fitsOnSlot(hotbarItem, event.rawSlot)) {
if (creative || (hotbarItem == null || ArmorType.fitsOnSlot(hotbarItem, event.rawSlot))) {
equipEvent = ArmorEquipEvent(player, EquipMethod.HOTBAR_SWAP, currentItem, hotbarItem)
}
}
Expand Down Expand Up @@ -122,8 +122,7 @@ internal object ArmorEquipListener : Initializable(), Listener {
}

@EventHandler(priority = EventPriority.HIGHEST)
private fun handleInteract(e: WrappedPlayerInteractEvent) {
val event = e.event
private fun handleInteract(event: PlayerInteractEvent) {
if (event.isCompletelyDenied()) return

val item = event.item
Expand Down

0 comments on commit 50037a5

Please sign in to comment.