Fix kit items being thrown away instead of using them

This commit is contained in:
TDSTOS
2026-04-17 03:33:13 +02:00
parent 95e366c365
commit f30108ca1d

View File

@@ -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.SPLASH_POTION ||
itemInHand.type == Material.LINGERING_POTION || itemInHand.type == Material.LINGERING_POTION ||
itemInHand.type == Material.MILK_BUCKET || itemInHand.type == Material.MILK_BUCKET ||
itemInHand.type == Material.ENDER_PEARL ) return itemInHand.type == Material.ENDER_PEARL
)) return
if ( itemInHand.type != active.triggerMaterial ) return if ( itemInHand.type != active.triggerMaterial ) return