From 718b13df46ee6d5c6d667fce7f2db14b67c4b68c Mon Sep 17 00:00:00 2001 From: Brian Neumann-Fopiano Date: Tue, 13 Oct 2026 16:57:30 -0400 Subject: [PATCH] Paced treasure chest interactions - Chest activations respect the server interaction rate limit - Stationary clients finish idle ticks every fifty milliseconds - Missing inventory windows fail within thirty seconds --- .../plugin/src/test/gameplay/treasure-maps.mjs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/adapters/bukkit/plugin/src/test/gameplay/treasure-maps.mjs b/adapters/bukkit/plugin/src/test/gameplay/treasure-maps.mjs index 929187f6a..bf1b57fbe 100644 --- a/adapters/bukkit/plugin/src/test/gameplay/treasure-maps.mjs +++ b/adapters/bukkit/plugin/src/test/gameplay/treasure-maps.mjs @@ -31,10 +31,16 @@ const traceMovement = context => { return write.call(this, name, packet, ...rest) } context.expect(context.bot.supportFeature('sendsClientTickEndPacket'), 'Fixture client supports tick delimiters') - const finishTick = () => client.write('tick_end', {}) + let tickTimer + const finishTick = () => { + clearTimeout(tickTimer) + client.write('tick_end', {}) + tickTimer = setTimeout(finishTick, 50) + } context.bot.on('move', finishTick) finishTick() context.signal.addEventListener('abort', () => { + clearTimeout(tickTimer) client.write = write client.removeListener('position', incoming) client.removeListener('player_rotation', rotation) @@ -63,13 +69,17 @@ export default { await action() return true }, { label, timeoutMs: 10000 }) + let lastActivation = 0 const openChest = async material => { const position = context.bot.entity.position.clone().set(2, 161, 2) await context.waitUntil(() => context.bot.blockAt(position)?.name === material, { label: `${material} reached the client`, timeoutMs: 10000 }) - const opened = context.waitForEvent('windowOpen', undefined, 120000) + const delay = 150 - (performance.now() - lastActivation) + if (delay > 0) await context.sleep(delay) + const opened = context.waitForEvent('windowOpen', undefined, 30000) await bounded(`Activate ${material}`, () => context.bot.activateBlock(context.bot.blockAt(position))) + lastActivation = performance.now() const [window] = await opened return window }