feat: rename /list -> /instances
This commit is contained in:
+11
-11
@@ -2,11 +2,11 @@ import { CommandPermissionLevel, CustomCommandStatus, system } from '@minecraft/
|
||||
import { Command } from '../classes/Commands/Command';
|
||||
import { structureCollection } from '../classes/Structure/StructureCollection';
|
||||
|
||||
export class ListCommand extends Command {
|
||||
export class InstancesCommand extends Command {
|
||||
constructor() {
|
||||
super({
|
||||
name: 'list',
|
||||
description: 'construct.commands.list',
|
||||
name: 'instances',
|
||||
description: 'construct.commands.instances',
|
||||
permissionLevel: CommandPermissionLevel.Any,
|
||||
callback: (source) => this.run(source)
|
||||
});
|
||||
@@ -15,16 +15,16 @@ export class ListCommand extends Command {
|
||||
run(source) {
|
||||
const names = structureCollection.getInstanceNames();
|
||||
if (names.length === 0)
|
||||
return { status: CustomCommandStatus.Success, message: 'construct.commands.list.empty' };
|
||||
return { status: CustomCommandStatus.Success, message: 'construct.commands.instances.empty' };
|
||||
const rawtext = [
|
||||
{ translate: 'construct.commands.list.header', with: [String(names.length)] },
|
||||
{ translate: 'construct.commands.instances.header', with: [String(names.length)] },
|
||||
{ text: '\n' }
|
||||
];
|
||||
for (const name of names) {
|
||||
const instance = structureCollection.get(name);
|
||||
const status = this.formatStatus(instance);
|
||||
rawtext.push({
|
||||
translate: 'construct.commands.list.row',
|
||||
translate: 'construct.commands.instances.row',
|
||||
with: { rawtext: [{ text: name }, { text: instance.getStructureId() }, status] }
|
||||
});
|
||||
rawtext.push({ text: '\n' });
|
||||
@@ -36,17 +36,17 @@ export class ListCommand extends Command {
|
||||
formatStatus(instance) {
|
||||
const statusMessage = { rawtext: [] };
|
||||
if (instance.isEnabled())
|
||||
statusMessage.rawtext.push({ translate: 'construct.commands.list.row.enabled' });
|
||||
statusMessage.rawtext.push({ translate: 'construct.commands.instances.row.enabled' });
|
||||
else
|
||||
statusMessage.rawtext.push({ translate: 'construct.commands.list.row.disabled' });
|
||||
statusMessage.rawtext.push({ translate: 'construct.commands.instances.row.disabled' });
|
||||
if (instance.hasLocation()) {
|
||||
const { dimensionId, location } = instance.getLocation();
|
||||
statusMessage.rawtext.push({ translate: 'construct.commands.list.row.location', with: [location.toString(), dimensionId.replace('minecraft:', '')] });
|
||||
statusMessage.rawtext.push({ translate: 'construct.commands.instances.row.location', with: [location.toString(), dimensionId.replace('minecraft:', '')] });
|
||||
} else {
|
||||
statusMessage.rawtext.push({ translate: 'construct.commands.list.row.nolocation' });
|
||||
statusMessage.rawtext.push({ translate: 'construct.commands.instances.row.nolocation' });
|
||||
}
|
||||
return statusMessage;
|
||||
}
|
||||
}
|
||||
|
||||
export const listCommand = new ListCommand();
|
||||
export const instancesCommand = new InstancesCommand();
|
||||
@@ -14,7 +14,7 @@ import './commands/ConstructCommand';
|
||||
import './commands/CreateCommand';
|
||||
import './commands/DeleteCommand';
|
||||
import './commands/RenameCommand';
|
||||
import './commands/ListCommand';
|
||||
import './commands/InstancesCommand';
|
||||
import './commands/PlaceCommand';
|
||||
import './commands/MoveCommand';
|
||||
import './commands/ActiveCommand';
|
||||
|
||||
@@ -117,15 +117,15 @@ construct.commands.delete.success=§aDeleted instance "%1".
|
||||
construct.commands.rename=Rename an existing Construct instance.
|
||||
construct.commands.rename.success=§aRenamed instance "%1" to "%2".
|
||||
|
||||
## construct:list
|
||||
construct.commands.list=List all registered Construct instances.
|
||||
construct.commands.list.empty=§7No instances registered.
|
||||
construct.commands.list.header=§aRegistered instances (%1):§r
|
||||
construct.commands.list.row=§a%1§r §8[§r%2§8]§r §7%3§r
|
||||
construct.commands.list.row.enabled=enabled
|
||||
construct.commands.list.row.disabled=disabled
|
||||
construct.commands.list.row.location= at %1 in %2
|
||||
construct.commands.list.row.nolocation= (no location)
|
||||
## construct:instances
|
||||
construct.commands.instances=List all registered Construct instances.
|
||||
construct.commands.instances.empty=§7No instances registered.
|
||||
construct.commands.instances.header=§aRegistered instances (%1):§r
|
||||
construct.commands.instances.row=§a%1§r §8[§r%2§8]§r §7%3§r
|
||||
construct.commands.instances.row.enabled=enabled
|
||||
construct.commands.instances.row.disabled=disabled
|
||||
construct.commands.instances.row.location= at %1 in %2
|
||||
construct.commands.instances.row.nolocation= (no location)
|
||||
|
||||
## construct:place
|
||||
construct.commands.place=Place a Construct instance in the world.
|
||||
|
||||
Reference in New Issue
Block a user