rename /item to /construct and remove ./construct
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { Command } from '../lib/canopy/CanopyExtension';
|
||||
import { extension } from '../config';
|
||||
import { world, system, EntityComponentTypes, ItemStack, CommandPermissionLevel, CustomCommandStatus, Player } from '@minecraft/server';
|
||||
import { MenuForm } from '../classes/MenuForm';
|
||||
import { structureCollection } from '../classes/Structure/StructureCollection'
|
||||
@@ -7,18 +5,10 @@ import { Builders } from '../classes/Builder/Builders';
|
||||
|
||||
export const MENU_ITEM = 'construct:menu';
|
||||
|
||||
const menuCmd = new Command({
|
||||
name: 'construct',
|
||||
description: { translate: 'construct.commands.construct' },
|
||||
usage: 'construct',
|
||||
callback: (sender) => openMenu(sender)
|
||||
});
|
||||
extension.addCommand(menuCmd);
|
||||
|
||||
system.beforeEvents.startup.subscribe((event) => {
|
||||
const command = {
|
||||
name: 'construct:item',
|
||||
description: 'construct.commands.item',
|
||||
name: 'construct:construct',
|
||||
description: 'construct.commands.construct',
|
||||
permissionLevel: CommandPermissionLevel.Any,
|
||||
cheatsRequired: false
|
||||
};
|
||||
@@ -28,13 +18,13 @@ system.beforeEvents.startup.subscribe((event) => {
|
||||
function givePlayerConstructItem(origin) {
|
||||
const player = origin.sourceEntity;
|
||||
if (player instanceof Player === false)
|
||||
return { status: CustomCommandStatus.Failure, message: 'construct.commands.item.denyorigin' };
|
||||
return { status: CustomCommandStatus.Failure, message: 'construct.commands.construct.denyorigin' };
|
||||
system.run(() => {
|
||||
const givenItemStack = player.getComponent(EntityComponentTypes.Inventory)?.container?.addItem(new ItemStack(MENU_ITEM));
|
||||
if (givenItemStack)
|
||||
player.sendMessage({ translate: 'construct.commands.item.fail' });
|
||||
player.sendMessage({ translate: 'construct.commands.construct.fail' });
|
||||
else
|
||||
player.sendMessage({ translate: 'construct.commands.item.success' });
|
||||
player.sendMessage({ translate: 'construct.commands.construct.success' });
|
||||
});
|
||||
return { status: CustomCommandStatus.Success };
|
||||
}
|
||||
|
||||
@@ -85,11 +85,10 @@ construct.mainmenu.howto.remove.header=§cHow to Remove Structures:
|
||||
construct.mainmenu.howto.remove.body=§7- Use the §f/structure delete§7 command to remove a structure from the world.
|
||||
|
||||
## Commands
|
||||
construct.commands.construct=Opens the Construct menu.
|
||||
construct.commands.item=Gives you the Construct item. Use it to open the Construct menu.
|
||||
construct.commands.item.denyorigin=This command can only be used by players.
|
||||
construct.commands.item.fail=§cFailed to give you the Construct item.
|
||||
construct.commands.item.success=§aYou recieved the Construct item! Use it to open the Construct menu.
|
||||
construct.commands.construct=Gives you the Construct item. Use it to open the Construct menu.
|
||||
construct.commands.construct.denyorigin=This command can only be used by players.
|
||||
construct.commands.construct.fail=§cFailed to give you the Construct item.
|
||||
construct.commands.construct.success=§aYou recieved the Construct item! Use it to open the Construct menu.
|
||||
|
||||
## Options
|
||||
construct.option.enabled= is now enabled!
|
||||
|
||||
Reference in New Issue
Block a user