diff options
author | nea <nea@nea.moe> | 2023-05-16 03:42:06 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-05-16 03:42:06 +0200 |
commit | 01f39819599fd89200a44a28da5597a2308e27d0 (patch) | |
tree | 851e9ac0d5e53b4ab1c1a21e6708e81664b0d5fe /src/main/kotlin | |
parent | fbe8bc680b742177ae54c8be1df5c33fb1635575 (diff) | |
download | firmament-01f39819599fd89200a44a28da5597a2308e27d0.tar.gz firmament-01f39819599fd89200a44a28da5597a2308e27d0.tar.bz2 firmament-01f39819599fd89200a44a28da5597a2308e27d0.zip |
Rename event bus
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/FirmamentEvent.kt (renamed from src/main/kotlin/moe/nea/firmament/events/NEUEvent.kt) | 8 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/FirmamentEventBus.kt (renamed from src/main/kotlin/moe/nea/firmament/events/NEUEventBus.kt) | 4 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/ParticleSpawnEvent.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/ServerChatLineReceivedEvent.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/SkyblockServerUpdateEvent.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/WorldReadyEvent.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/events/WorldRenderLastEvent.kt | 4 |
8 files changed, 18 insertions, 18 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/events/NEUEvent.kt b/src/main/kotlin/moe/nea/firmament/events/FirmamentEvent.kt index 722ea64..6ac2a4b 100644 --- a/src/main/kotlin/moe/nea/firmament/events/NEUEvent.kt +++ b/src/main/kotlin/moe/nea/firmament/events/FirmamentEvent.kt @@ -1,7 +1,7 @@ package moe.nea.firmament.events /** - * An event that can be fired by a [NEUEventBus]. + * An event that can be fired by a [FirmamentEventBus]. * * Typically, that event bus is implemented as a companion object * @@ -11,11 +11,11 @@ package moe.nea.firmament.events * } * ``` */ -abstract class NEUEvent { +abstract class FirmamentEvent { /** - * A [NEUEvent] that can be [cancelled] + * A [FirmamentEvent] that can be [cancelled] */ - abstract class Cancellable : NEUEvent() { + abstract class Cancellable : FirmamentEvent() { /** * Cancels this is event. * diff --git a/src/main/kotlin/moe/nea/firmament/events/NEUEventBus.kt b/src/main/kotlin/moe/nea/firmament/events/FirmamentEventBus.kt index b3b9152..842cdf1 100644 --- a/src/main/kotlin/moe/nea/firmament/events/NEUEventBus.kt +++ b/src/main/kotlin/moe/nea/firmament/events/FirmamentEventBus.kt @@ -9,7 +9,7 @@ import moe.nea.firmament.Firmament * [subscribe] to events [publish]ed on this event bus. * Subscriptions may not necessarily be delivered in the order or registering. */ -open class NEUEventBus<T : NEUEvent> { +open class FirmamentEventBus<T : FirmamentEvent> { data class Handler<T>(val invocation: (T) -> Unit, val receivesCancelled: Boolean) private val toHandle: MutableList<Handler<T>> = CopyOnWriteArrayList() @@ -23,7 +23,7 @@ open class NEUEventBus<T : NEUEvent> { fun publish(event: T): T { for (function in toHandle) { - if (function.receivesCancelled || event !is NEUEvent.Cancellable || !event.cancelled) { + if (function.receivesCancelled || event !is FirmamentEvent.Cancellable || !event.cancelled) { try { function.invocation(event) } catch (e: Exception) { diff --git a/src/main/kotlin/moe/nea/firmament/events/ParticleSpawnEvent.kt b/src/main/kotlin/moe/nea/firmament/events/ParticleSpawnEvent.kt index bbf7289..bb73325 100644 --- a/src/main/kotlin/moe/nea/firmament/events/ParticleSpawnEvent.kt +++ b/src/main/kotlin/moe/nea/firmament/events/ParticleSpawnEvent.kt @@ -8,6 +8,6 @@ data class ParticleSpawnEvent( val position: Vec3d, val offset: Vec3d, val longDistance: Boolean, -) : NEUEvent() { - companion object : NEUEventBus<ParticleSpawnEvent>() +) : FirmamentEvent() { + companion object : FirmamentEventBus<ParticleSpawnEvent>() } diff --git a/src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt b/src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt index ee162ab..9c4a28c 100644 --- a/src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt +++ b/src/main/kotlin/moe/nea/firmament/events/ScreenOpenEvent.kt @@ -2,6 +2,6 @@ package moe.nea.firmament.events import net.minecraft.client.gui.screen.Screen -data class ScreenOpenEvent(val old: Screen?, val new: Screen?) : NEUEvent.Cancellable() { - companion object : NEUEventBus<ScreenOpenEvent>() +data class ScreenOpenEvent(val old: Screen?, val new: Screen?) : FirmamentEvent.Cancellable() { + companion object : FirmamentEventBus<ScreenOpenEvent>() } diff --git a/src/main/kotlin/moe/nea/firmament/events/ServerChatLineReceivedEvent.kt b/src/main/kotlin/moe/nea/firmament/events/ServerChatLineReceivedEvent.kt index 7e8531c..345ac0e 100644 --- a/src/main/kotlin/moe/nea/firmament/events/ServerChatLineReceivedEvent.kt +++ b/src/main/kotlin/moe/nea/firmament/events/ServerChatLineReceivedEvent.kt @@ -6,8 +6,8 @@ import moe.nea.firmament.util.unformattedString /** * This event gets published whenever the client receives a chat message from the server. */ -data class ServerChatLineReceivedEvent(val text: Text) : NEUEvent.Cancellable() { - companion object : NEUEventBus<ServerChatLineReceivedEvent>() +data class ServerChatLineReceivedEvent(val text: Text) : FirmamentEvent.Cancellable() { + companion object : FirmamentEventBus<ServerChatLineReceivedEvent>() val unformattedString = text.unformattedString } diff --git a/src/main/kotlin/moe/nea/firmament/events/SkyblockServerUpdateEvent.kt b/src/main/kotlin/moe/nea/firmament/events/SkyblockServerUpdateEvent.kt index ae3227f..c505bf2 100644 --- a/src/main/kotlin/moe/nea/firmament/events/SkyblockServerUpdateEvent.kt +++ b/src/main/kotlin/moe/nea/firmament/events/SkyblockServerUpdateEvent.kt @@ -8,6 +8,6 @@ import moe.nea.firmament.util.Locraw * **N.B.:** This event may get fired multiple times while on the server (for example, first to null, then to the * correct location). */ -data class SkyblockServerUpdateEvent(val oldLocraw: Locraw?, val newLocraw: Locraw?) : NEUEvent() { - companion object : NEUEventBus<SkyblockServerUpdateEvent>() +data class SkyblockServerUpdateEvent(val oldLocraw: Locraw?, val newLocraw: Locraw?) : FirmamentEvent() { + companion object : FirmamentEventBus<SkyblockServerUpdateEvent>() } diff --git a/src/main/kotlin/moe/nea/firmament/events/WorldReadyEvent.kt b/src/main/kotlin/moe/nea/firmament/events/WorldReadyEvent.kt index 5b01258..e0bcd79 100644 --- a/src/main/kotlin/moe/nea/firmament/events/WorldReadyEvent.kt +++ b/src/main/kotlin/moe/nea/firmament/events/WorldReadyEvent.kt @@ -1,5 +1,5 @@ package moe.nea.firmament.events -class WorldReadyEvent : NEUEvent() { - companion object : NEUEventBus<WorldReadyEvent>() +class WorldReadyEvent : FirmamentEvent() { + companion object : FirmamentEventBus<WorldReadyEvent>() } diff --git a/src/main/kotlin/moe/nea/firmament/events/WorldRenderLastEvent.kt b/src/main/kotlin/moe/nea/firmament/events/WorldRenderLastEvent.kt index c23d923..e5fac8a 100644 --- a/src/main/kotlin/moe/nea/firmament/events/WorldRenderLastEvent.kt +++ b/src/main/kotlin/moe/nea/firmament/events/WorldRenderLastEvent.kt @@ -17,6 +17,6 @@ data class WorldRenderLastEvent( val gameRenderer: GameRenderer, val lightmapTextureManager: LightmapTextureManager, val positionMatrix: Matrix4f, -) : NEUEvent() { - companion object : NEUEventBus<WorldRenderLastEvent>() +) : FirmamentEvent() { + companion object : FirmamentEventBus<WorldRenderLastEvent>() } |