From f30108ca1d87ae54219b294013c2eb101f27fdae Mon Sep 17 00:00:00 2001 From: TDSTOS Date: Fri, 17 Apr 2026 03:33:13 +0200 Subject: [PATCH] Fix kit items being thrown away instead of using them --- .../speedhg/kit/listener/KitEventDispatcher.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/club/mcscrims/speedhg/kit/listener/KitEventDispatcher.kt b/src/main/kotlin/club/mcscrims/speedhg/kit/listener/KitEventDispatcher.kt index f02d77d..f37a890 100644 --- a/src/main/kotlin/club/mcscrims/speedhg/kit/listener/KitEventDispatcher.kt +++ b/src/main/kotlin/club/mcscrims/speedhg/kit/listener/KitEventDispatcher.kt @@ -174,11 +174,18 @@ class KitEventDispatcher( val itemInHand = player.inventory.itemInMainHand 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 - if ( itemInHand.type == Material.SPLASH_POTION || - itemInHand.type == Material.LINGERING_POTION || - itemInHand.type == Material.MILK_BUCKET || - itemInHand.type == Material.ENDER_PEARL ) return + if ( !isKitAbilityItem && ( + itemInHand.type == Material.SPLASH_POTION || + itemInHand.type == Material.LINGERING_POTION || + itemInHand.type == Material.MILK_BUCKET || + itemInHand.type == Material.ENDER_PEARL + )) return if ( itemInHand.type != active.triggerMaterial ) return