Skip to content

Commit adb1751

Browse files
committed
reset break manager on connect
1 parent 239930d commit adb1751

File tree

1 file changed

+8
-0
lines changed
  • common/src/main/kotlin/com/lambda/interaction/request/breaking

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ import com.lambda.Lambda.mc
2121
import com.lambda.config.groups.BuildConfig
2222
import com.lambda.context.SafeContext
2323
import com.lambda.event.EventFlow.post
24+
import com.lambda.event.events.ConnectionEvent
2425
import com.lambda.event.events.EntityEvent
2526
import com.lambda.event.events.TickEvent
2627
import com.lambda.event.events.UpdateManagerEvent
2728
import com.lambda.event.events.WorldEvent
2829
import com.lambda.event.listener.SafeListener.Companion.listen
30+
import com.lambda.event.listener.UnsafeListener.Companion.listenUnsafe
2931
import com.lambda.interaction.construction.context.BreakContext
3032
import com.lambda.interaction.construction.verify.TargetState
3133
import com.lambda.interaction.request.PositionBlocking
@@ -239,6 +241,12 @@ object BreakManager : RequestHandler<BreakRequest>(), PositionBlocking {
239241
.firstOrNull { info -> matchesBlockItem(info, it.entity) }
240242
?.internalOnItemDrop(it.entity)
241243
}
244+
245+
listenUnsafe<ConnectionEvent.Connect.Pre> {
246+
breakingInfos.forEach { it?.nullify() }
247+
pendingBreaks.clear()
248+
setBreakCooldown(0)
249+
}
242250
}
243251

244252
private fun matchesBlockItem(info: BreakInfo, entity: ItemEntity): Boolean {

0 commit comments

Comments
 (0)