diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-28 18:26:39 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-28 18:26:39 +0100 |
commit | 4c95720f6058d2f5140f91b79d5c506cfe51a9c3 (patch) | |
tree | 222b2c904a3c103d27ec679cdd9a921c539e9ee6 /src/main/java | |
parent | f283110860650130aea7ae42504e0f48fff9b0fb (diff) | |
download | skyhanni-4c95720f6058d2f5140f91b79d5c506cfe51a9c3.tar.gz skyhanni-4c95720f6058d2f5140f91b79d5c506cfe51a9c3.tar.bz2 skyhanni-4c95720f6058d2f5140f91b79d5c506cfe51a9c3.zip |
Using filterNotNull
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt index 96de875f2..645e20510 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -158,8 +158,8 @@ object HarpFeatures { if (!isMenuGui(InventoryUtils.openInventoryName())) return if (event.slot?.slotNumber != closeButtonSlot) return if (openTime.passedSince() > 2.seconds) return - event.container.inventory.indexOfFirst { - songSelectedPattern.anyMatches(it?.getLore() ?: return@indexOfFirst false) + event.container.inventory.filterNotNull().indexOfFirst { + songSelectedPattern.anyMatches(it.getLore()) }.takeIf { it != -1 }?.let { event.isCanceled = true Minecraft.getMinecraft().playerController.windowClick( |