Fix kit items being thrown away instead of using them
This commit is contained in:
@@ -174,11 +174,18 @@ class KitEventDispatcher(
|
|||||||
val itemInHand = player.inventory.itemInMainHand
|
val itemInHand = player.inventory.itemInMainHand
|
||||||
val active = kit.getActiveAbility( playstyle )
|
val active = kit.getActiveAbility( playstyle )
|
||||||
|
|
||||||
|
// Allow throwable items (potions, ender pearls, etc.) to pass through,
|
||||||
|
// UNLESS the item is the player's own kit item.
|
||||||
|
val isKitAbilityItem = kit.cachedItems[ player.uniqueId ]
|
||||||
|
?.any { it.isSimilar( itemInHand ) } == true
|
||||||
|
|
||||||
// Allow throwable items (potions, ender pearls, etc.) to pass through
|
// Allow throwable items (potions, ender pearls, etc.) to pass through
|
||||||
if ( itemInHand.type == Material.SPLASH_POTION ||
|
if ( !isKitAbilityItem && (
|
||||||
itemInHand.type == Material.LINGERING_POTION ||
|
itemInHand.type == Material.SPLASH_POTION ||
|
||||||
itemInHand.type == Material.MILK_BUCKET ||
|
itemInHand.type == Material.LINGERING_POTION ||
|
||||||
itemInHand.type == Material.ENDER_PEARL ) return
|
itemInHand.type == Material.MILK_BUCKET ||
|
||||||
|
itemInHand.type == Material.ENDER_PEARL
|
||||||
|
)) return
|
||||||
|
|
||||||
if ( itemInHand.type != active.triggerMaterial ) return
|
if ( itemInHand.type != active.triggerMaterial ) return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user