form start
This commit is contained in:
+3
-2
@@ -1,3 +1,4 @@
|
||||
import { system } from '@minecraft/server';
|
||||
import { FormCancelationReason } from '@minecraft/server-ui';
|
||||
|
||||
export async function forceShow(player, form, timeout = Infinity) {
|
||||
@@ -5,9 +6,9 @@ export async function forceShow(player, form, timeout = Infinity) {
|
||||
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' });
|
||||
player.sendMessage("§8Close your chat window to access the menu.");
|
||||
if (response.cancelationReason !== FormCancelationReason.UserBusy)
|
||||
return response;
|
||||
}
|
||||
throw new Error({ translate: 'commands.canopy.menu.timeout', with: [String(timeout)] });
|
||||
throw new Error("Menu timed out.");
|
||||
};
|
||||
Reference in New Issue
Block a user