feat(cli): add construct:verifier command

This commit is contained in:
ForestOfLight
2026-05-20 02:55:30 -07:00
Unverified
parent 609ed4a49e
commit 8184e17b65
4 changed files with 46 additions and 0 deletions
@@ -0,0 +1,37 @@
import { CustomCommandParamType, CustomCommandStatus, system } from '@minecraft/server';
import { Command } from '../classes/Commands/Command';
import { findInstance } from '../classes/Commands/lib/findInstance';
import { commandError } from '../classes/Commands/lib/commandError';
export class VerifierCommand extends Command {
constructor() {
super({
name: 'verifier',
description: 'construct.commands.verifier',
mandatoryParameters: [
{ name: 'instanceName', type: CustomCommandParamType.String },
{ name: 'state', type: CustomCommandParamType.Boolean }
],
callback: (source, instanceName, state) => this.run(source, instanceName, state)
});
}
run(source, instanceName, state) {
try {
const instance = findInstance(source, instanceName);
if (!instance) return { status: CustomCommandStatus.Failure };
system.run(() => {
instance.setVerifierEnabled(state);
source.sendMessage({
rawtext: [{ translate: 'construct.commands.verifier.success',
with: [instanceName, String(state)] }]
});
});
return { status: CustomCommandStatus.Success };
} catch (err) {
return commandError(source, err);
}
}
}
export const verifierCommand = new VerifierCommand();