diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-09-11 23:24:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-11 23:24:00 +0200 |
commit | 5151e1a0a73e9e194f0b5ec06c49be2c853cc23f (patch) | |
tree | 09578f03cff8eb081ab3af1ff39247535005f6bb /src/main/java/at/hannibal2/skyhanni/api | |
parent | c48d82d06f375139f1e0a0a32ffd6d2f4aa98546 (diff) | |
download | skyhanni-5151e1a0a73e9e194f0b5ec06c49be2c853cc23f.tar.gz skyhanni-5151e1a0a73e9e194f0b5ec06c49be2c853cc23f.tar.bz2 skyhanni-5151e1a0a73e9e194f0b5ec06c49be2c853cc23f.zip |
Technical: Make HandleEvent Islands take in a vararg (#2502)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/api')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt | 7 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/api/event/HandleEvent.kt | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt b/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt index cfc8e63b8..78769060a 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland +import at.hannibal2.skyhanni.utils.LorenzUtils.inAnyIsland import at.hannibal2.skyhanni.utils.chat.Text import java.lang.invoke.LambdaMetafactory import java.lang.invoke.MethodHandles @@ -113,7 +113,7 @@ class EventHandler<T : SkyHanniEvent> private constructor(val name: String, priv private fun shouldInvoke(event: SkyHanniEvent, listener: Listener): Boolean { if (SkyHanniEvents.isDisabledInvoker(listener.name)) return false if (listener.options.onlyOnSkyblock && !LorenzUtils.inSkyBlock) return false - if (listener.options.onlyOnIsland != IslandType.ANY && !listener.options.onlyOnIsland.isInIsland()) return false + if (IslandType.ANY !in listener.onlyOnIslandTypes && !inAnyIsland(listener.onlyOnIslandTypes)) return false if (event.isCancelled && !listener.options.receiveCancelled) return false if ( event is GenericSkyHanniEvent<*> && @@ -129,6 +129,7 @@ class EventHandler<T : SkyHanniEvent> private constructor(val name: String, priv val name: String, val invoker: Consumer<Any>, val options: HandleEvent, - val generic: Class<*>? + val generic: Class<*>?, + val onlyOnIslandTypes: Set<IslandType> = options.onlyOnIslands.toSet(), ) } diff --git a/src/main/java/at/hannibal2/skyhanni/api/event/HandleEvent.kt b/src/main/java/at/hannibal2/skyhanni/api/event/HandleEvent.kt index 39b047a6e..c07239dc2 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/event/HandleEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/event/HandleEvent.kt @@ -13,7 +13,7 @@ annotation class HandleEvent( /** * If the event should only be received while on a specific skyblock island. */ - val onlyOnIsland: IslandType = IslandType.ANY, + vararg val onlyOnIslands: IslandType = [IslandType.ANY], /** * The priority of when the event will be called, lower priority will be called first, see the companion object. |