diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/api')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt | 11 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/api/event/HandleEvent.kt | 9 |
2 files changed, 17 insertions, 3 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 78769060a..4b4c00852 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/event/EventHandler.kt @@ -130,6 +130,13 @@ class EventHandler<T : SkyHanniEvent> private constructor(val name: String, priv val invoker: Consumer<Any>, val options: HandleEvent, val generic: Class<*>?, - val onlyOnIslandTypes: Set<IslandType> = options.onlyOnIslands.toSet(), - ) + ) { + val onlyOnIslandTypes: Set<IslandType> = getIslands(options) + + companion object { + private fun getIslands(options: HandleEvent): Set<IslandType> = + if (options.onlyOnIslands.isEmpty()) setOf(options.onlyOnIsland) + else 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 c07239dc2..a88f7f337 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/event/HandleEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/event/HandleEvent.kt @@ -12,8 +12,15 @@ annotation class HandleEvent( /** * If the event should only be received while on a specific skyblock island. + * To specify multiple islands, use [onlyOnIslands] instead. */ - vararg val onlyOnIslands: IslandType = [IslandType.ANY], + val onlyOnIsland: IslandType = IslandType.ANY, + + /** + * If the event should only be received while being on specific skyblock islands. + * To specify only one island, use [onlyOnIsland] instead. + */ + vararg val onlyOnIslands: IslandType = [], /** * The priority of when the event will be called, lower priority will be called first, see the companion object. |