Skip to content

Commit 77744a9

Browse files
committed
cleanup pending interactions on tick
1 parent 6424ec2 commit 77744a9

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ object BreakManager : RequestHandler<BreakRequest>(), PositionBlocking {
113113
listen<TickEvent.Pre>(priority = Int.MIN_VALUE + 1) {
114114
preEvent()
115115

116+
pendingBreaks.cleanUp()
116117
breakingInfos.forEach {
117118
it?.simulate(player)
118119
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ object PlaceManager : RequestHandler<PlaceRequest>(), PositionBlocking {
9898
listen<TickEvent.Pre>(priority = Int.MIN_VALUE) {
9999
preEvent()
100100

101+
pendingPlacements.cleanUp()
102+
101103
if (!updateRequest()) {
102104
postEvent()
103105
return@listen

common/src/main/kotlin/com/lambda/util/collections/LimitedDecayQueue.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class LimitedDecayQueue<E>(
125125
cleanUp()
126126
}
127127

128-
private fun cleanUp() {
128+
fun cleanUp() {
129129
val now = Instant.now()
130130
while (queue.isNotEmpty() && now.minusMillis(maxAge).isAfter(queue.peek().second)) {
131131
onDecay(queue.poll().first)

0 commit comments

Comments
 (0)