Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

Commit 888aa76

Browse files
committed
Removed plugin property from the SimpleListener class.
1 parent 426f48c commit 888aa76

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/main/kotlin/lirand/api/coroutines/flow/EventFlowOperators.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
package lirand.api.coroutines.flow
22

33
import kotlinx.coroutines.currentCoroutineContext
4-
import kotlinx.coroutines.flow.Flow
54
import kotlinx.coroutines.flow.emitAll
65
import kotlinx.coroutines.flow.flow
7-
import kotlinx.coroutines.flow.onCompletion
86
import kotlinx.coroutines.job
97
import lirand.api.extensions.events.SimpleListener
10-
import lirand.api.extensions.events.events
118
import lirand.api.extensions.events.listen
129
import lirand.api.extensions.events.unregister
1310
import org.bukkit.entity.Player
@@ -22,7 +19,7 @@ import org.bukkit.event.player.PlayerQuitEvent
2219
*/
2320
fun <T : Event> SharedEventFlow<T>.assign(
2421
player: Player,
25-
listener: Listener = SimpleListener(plugin)
22+
listener: Listener = SimpleListener()
2623
) = flow {
2724
val job = currentCoroutineContext().job
2825

src/main/kotlin/lirand/api/coroutines/flow/SharedEventFlow.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ inline fun <reified T : Event> Plugin.eventFlow(
4040
onBufferOverflow: BufferOverflow = BufferOverflow.DROP_OLDEST,
4141
priority: EventPriority = EventPriority.NORMAL,
4242
ignoreCancelled: Boolean = false,
43-
listener: Listener = SimpleListener(this)
43+
listener: Listener = SimpleListener()
4444
): SharedEventFlow<T> = eventFlow(
4545
T::class, considerSubscriptionCount,
4646
replay, extraBufferCapacity, onBufferOverflow,
@@ -62,7 +62,7 @@ fun <T : Event> Plugin.eventFlow(
6262
onBufferOverflow: BufferOverflow = BufferOverflow.DROP_OLDEST,
6363
priority: EventPriority = EventPriority.NORMAL,
6464
ignoreCancelled: Boolean = false,
65-
listener: Listener = SimpleListener(this)
65+
listener: Listener = SimpleListener()
6666
): SharedEventFlow<T> {
6767

6868
val mutableEventFlow = MutableSharedFlow<T>(replay, extraBufferCapacity, onBufferOverflow)

src/main/kotlin/lirand/api/extensions/events/ListenerExtensions.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import kotlin.reflect.KClass
1010

1111
data class ListenerWithPlugin(val listener: Listener, val plugin: Plugin)
1212

13-
open class SimpleListener(open val plugin: Plugin) : Listener
13+
class SimpleListener : Listener
1414

1515

1616

@@ -60,7 +60,7 @@ fun <T : Event> ListenerWithPlugin.listen(
6060

6161

6262
inline fun <reified T : Event> Plugin.listen(
63-
listener: Listener = SimpleListener(this),
63+
listener: Listener = SimpleListener(),
6464
priority: EventPriority = EventPriority.NORMAL,
6565
ignoreCancelled: Boolean = false,
6666
noinline block: (event: T) -> Unit,
@@ -70,7 +70,7 @@ inline fun <reified T : Event> Plugin.listen(
7070

7171

7272
inline fun Plugin.events(
73-
listener: Listener = SimpleListener(this),
73+
listener: Listener = SimpleListener(),
7474
crossinline block: ListenerWithPlugin.() -> Unit
7575
) = listener.apply {
7676
ListenerWithPlugin(listener, this@events).apply(block)

0 commit comments

Comments
 (0)