Skip to content

Commit e71715c

Browse files
committed
added option to obey interaction delays
1 parent 1b3aced commit e71715c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

common/src/main/kotlin/com/lambda/task/tasks/PacketBreakBlock.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,13 @@ class PacketBreakBlock @Ta5kBuilder constructor(
228228
* and allow for validating the break by waiting for the server to respond
229229
*/
230230
private fun SafeContext.updateBlockBreakingProgress(): Boolean {
231+
if (obeyInteractionDelays && interaction.blockBreakingCooldown > 0) {
232+
interaction.blockBreakingCooldown--;
233+
return true;
234+
}
235+
231236
if (interaction.currentGameMode.isCreative && world.worldBorder.contains(blockPos)) {
237+
interaction.blockBreakingCooldown = 5
232238
interaction.sendSequencedPacket(world) { sequence: Int ->
233239
onBlockBreak()
234240
PlayerActionC2SPacket(Action.START_DESTROY_BLOCK, blockPos, side, sequence)
@@ -308,7 +314,7 @@ class PacketBreakBlock @Ta5kBuilder constructor(
308314
onBlockBreak()
309315
PlayerActionC2SPacket(Action.START_DESTROY_BLOCK, blockPos, side, sequence)
310316
}
311-
317+
interaction.blockBreakingCooldown = 5
312318
return true
313319
}
314320
if (startedBreaking) return false

0 commit comments

Comments
 (0)