Skip to content

Commit a9663e8

Browse files
committed
cleanup on tick pre in the post action handlers
1 parent a5dc330 commit a9663e8

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

common/src/main/kotlin/com/lambda/interaction/request/PostActionHandler.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ package com.lambda.interaction.request
1919

2020
import com.lambda.config.groups.BuildConfig
2121
import com.lambda.event.events.ConnectionEvent
22+
import com.lambda.event.events.TickEvent
23+
import com.lambda.event.listener.SafeListener.Companion.listen
2224
import com.lambda.event.listener.UnsafeListener.Companion.listenUnsafe
2325
import com.lambda.interaction.request.breaking.BrokenBlockHandler
2426
import com.lambda.util.collections.LimitedDecayQueue
@@ -27,6 +29,10 @@ abstract class PostActionHandler<T : ActionInfo> {
2729
abstract val pendingActions: LimitedDecayQueue<T>
2830

2931
init {
32+
listen<TickEvent.Pre>(priority = Int.MAX_VALUE) {
33+
pendingActions.cleanUp()
34+
}
35+
3036
listenUnsafe<ConnectionEvent.Connect.Pre>(priority = Int.MIN_VALUE) {
3137
pendingActions.clear()
3238
}

common/src/main/kotlin/com/lambda/interaction/request/breaking/BreakManager.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ object BreakManager : RequestHandler<BreakRequest>(
256256
* @see updateBreakProgress
257257
*/
258258
private fun SafeContext.processRequest(breakRequest: BreakRequest?) {
259-
pendingActions.cleanUp()
260-
261259
repeat(2) {
262260
breakRequest?.let { request ->
263261
if (request.fresh) populateFrom(request)

common/src/main/kotlin/com/lambda/interaction/request/interacting/InteractionManager.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ object InteractionManager : RequestHandler<InteractRequest>(
8383
}
8484

8585
fun SafeContext.processRequest(request: InteractRequest) {
86-
pendingActions.cleanUp()
87-
8886
if (request.fresh) populateFrom(request)
8987

9088
if (player.isSneaking) return

common/src/main/kotlin/com/lambda/interaction/request/placing/PlaceManager.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ object PlaceManager : RequestHandler<PlaceRequest>(
135135
* @see placeBlock
136136
*/
137137
fun SafeContext.processRequest(request: PlaceRequest) {
138-
pendingActions.cleanUp()
139-
140138
if (request.fresh) populateFrom(request)
141139

142140
val iterator = potentialPlacements.iterator()

0 commit comments

Comments
 (0)