Add and remove structure with outline
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { FormCancelationReason } from '@minecraft/server-ui';
|
||||
|
||||
export async function forceShow(player, form, timeout = Infinity) {
|
||||
const startTick = system.currentTick;
|
||||
while ((system.currentTick - startTick) < timeout) {
|
||||
const response = await form.show(player);
|
||||
if (startTick + 1 === system.currentTick && response.cancelationReason === FormCancelationReason.UserBusy)
|
||||
player.sendMessage({ translate: 'commands.canopy.menu.busy' });
|
||||
if (response.cancelationReason !== FormCancelationReason.UserBusy)
|
||||
return response;
|
||||
}
|
||||
throw new Error({ translate: 'commands.canopy.menu.timeout', with: [String(timeout)] });
|
||||
};
|
||||
Reference in New Issue
Block a user