Skip to content

Commit 904e0fd

Browse files
committed
Reformat events
1 parent 938eacc commit 904e0fd

File tree

8 files changed

+18
-33
lines changed

8 files changed

+18
-33
lines changed

common/src/main/kotlin/com/lambda/event/EventFlow.kt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,9 @@ import com.lambda.event.callback.ICancellable
2222
import com.lambda.event.listener.Listener
2323
import com.lambda.threading.runConcurrent
2424
import com.lambda.threading.runSafe
25-
import kotlinx.coroutines.CoroutineScope
26-
import kotlinx.coroutines.Dispatchers
27-
import kotlinx.coroutines.Job
28-
import kotlinx.coroutines.SupervisorJob
25+
import kotlinx.coroutines.*
2926
import kotlinx.coroutines.channels.BufferOverflow
30-
import kotlinx.coroutines.flow.Flow
31-
import kotlinx.coroutines.flow.MutableSharedFlow
32-
import kotlinx.coroutines.flow.filter
33-
import kotlinx.coroutines.flow.filterIsInstance
34-
import kotlinx.coroutines.flow.filterNot
35-
import kotlinx.coroutines.flow.first
36-
import kotlinx.coroutines.flow.flow
37-
import kotlinx.coroutines.runBlocking
38-
import kotlinx.coroutines.withTimeout
27+
import kotlinx.coroutines.flow.*
3928

4029

4130
/**

common/src/main/kotlin/com/lambda/event/events/EntityEvent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ sealed class EntityEvent {
5151
* @property entity The entity that is being spawned.
5252
*/
5353
data class EntitySpawn(
54-
val entity: Entity
54+
val entity: Entity,
5555
) : ICancellable by Cancellable()
5656

5757
/**

common/src/main/kotlin/com/lambda/event/events/InventoryEvent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ sealed class InventoryEvent {
7777
val syncId: Int,
7878
val revision: Int,
7979
val slot: Int,
80-
val stack: ItemStack
80+
val stack: ItemStack,
8181
) : Event
8282

8383
/**

common/src/main/kotlin/com/lambda/event/events/MouseEvent.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ sealed class MouseEvent {
3535
val button: Mouse.Button,
3636
val action: Mouse.Action,
3737
val modifiers: Int,
38-
val position: Vec2d
38+
val position: Vec2d,
3939
) : ICancellable by Cancellable() {
4040
constructor(button: Int, action: Int, modifiers: Int, position: Vec2d) : this(
4141
Mouse.Button.fromMouseCode(button),
@@ -51,7 +51,7 @@ sealed class MouseEvent {
5151
* @property delta The amount of scrolling in the x and y directions
5252
*/
5353
data class Scroll(
54-
val delta: Vec2d
54+
val delta: Vec2d,
5555
) : ICancellable by Cancellable()
5656

5757
/**
@@ -60,6 +60,6 @@ sealed class MouseEvent {
6060
* @property position The x and y position of the mouse on the screen.
6161
*/
6262
data class Move(
63-
val position: Vec2d
63+
val position: Vec2d,
6464
) : ICancellable by Cancellable()
6565
}

common/src/main/kotlin/com/lambda/event/events/PacketEvent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import com.lambda.event.Event
2121
import com.lambda.event.EventFlow
2222
import com.lambda.event.callback.Cancellable
2323
import com.lambda.event.callback.ICancellable
24+
import com.lambda.event.events.PacketEvent.Receive
25+
import com.lambda.event.events.PacketEvent.Send
2426
import com.lambda.util.ClientPacket
2527
import com.lambda.util.ServerPacket
2628

common/src/main/kotlin/com/lambda/event/events/PlayerEvent.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package com.lambda.event.events
1919

2020
import com.lambda.event.callback.Cancellable
2121
import com.lambda.event.callback.ICancellable
22-
import net.minecraft.entity.Entity
2322
import net.minecraft.entity.damage.DamageSource
2423
import net.minecraft.screen.ScreenHandler
2524
import net.minecraft.screen.slot.SlotActionType
@@ -49,7 +48,7 @@ sealed class PlayerEvent {
4948
* Represents the player swinging its hand
5049
*/
5150
data class SwingHand(
52-
val hand: Hand
51+
val hand: Hand,
5352
) : ICancellable by Cancellable()
5453

5554
/**
@@ -72,7 +71,7 @@ sealed class PlayerEvent {
7271
*/
7372
data class Block(
7473
val hand: Hand,
75-
val blockHitResult: BlockHitResult
74+
val blockHitResult: BlockHitResult,
7675
) : ICancellable by Cancellable()
7776

7877
/**
@@ -85,7 +84,7 @@ sealed class PlayerEvent {
8584
data class Entity(
8685
val hand: Hand,
8786
val entity: net.minecraft.entity.Entity,
88-
val entityHitResult: EntityHitResult
87+
val entityHitResult: EntityHitResult,
8988
) : ICancellable by Cancellable()
9089

9190
/**
@@ -94,7 +93,7 @@ sealed class PlayerEvent {
9493
* @param hand The hand used to interact with the item
9594
*/
9695
data class Item(
97-
val hand: Hand
96+
val hand: Hand,
9897
) : ICancellable by Cancellable()
9998
}
10099

@@ -104,14 +103,14 @@ sealed class PlayerEvent {
104103
*/
105104
data class Block(
106105
val pos: BlockPos,
107-
val side: Direction
106+
val side: Direction,
108107
) : ICancellable by Cancellable()
109108

110109
/**
111110
* Represents the player attacking an entity
112111
*/
113112
data class Entity(
114-
val entity: net.minecraft.entity.Entity
113+
val entity: net.minecraft.entity.Entity,
115114
) : ICancellable by Cancellable()
116115
}
117116

common/src/main/kotlin/com/lambda/event/events/WorldEvent.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
package com.lambda.event.events
1919

2020
import com.lambda.event.Event
21-
import com.lambda.event.callback.Cancellable
22-
import com.lambda.event.callback.ICancellable
2321
import net.minecraft.block.BlockState
24-
import net.minecraft.entity.Entity
25-
import net.minecraft.entity.data.TrackedData
2622
import net.minecraft.util.math.BlockPos
2723
import net.minecraft.util.shape.VoxelShape
2824
import net.minecraft.world.chunk.WorldChunk
@@ -50,15 +46,15 @@ sealed class WorldEvent {
5046
* Event triggering upon chunk loading
5147
*/
5248
data class Load(
53-
val chunk: WorldChunk
49+
val chunk: WorldChunk,
5450
) : Event
5551

5652
/**
5753
* Event triggering upon chunk unloading
5854
* Does not trigger when leaving the world
5955
*/
6056
data class Unload(
61-
val chunk: WorldChunk
57+
val chunk: WorldChunk,
6258
) : Event
6359
}
6460

@@ -87,6 +83,6 @@ sealed class WorldEvent {
8783
data class Collision(
8884
val pos: BlockPos,
8985
val state: BlockState,
90-
var shape: VoxelShape
86+
var shape: VoxelShape,
9187
) : Event
9288
}

common/src/main/kotlin/com/lambda/event/listener/SafeListener.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import com.lambda.context.SafeContext
2121
import com.lambda.event.Event
2222
import com.lambda.event.EventFlow
2323
import com.lambda.event.Muteable
24-
import com.lambda.task.Task
2524
import com.lambda.threading.runConcurrent
2625
import com.lambda.threading.runSafe
2726
import com.lambda.util.Pointer

0 commit comments

Comments
 (0)