rename /item to /construct and remove ./construct

This commit is contained in:
ForestOfLight
2025-12-29 22:36:43 -08:00
Unverified
parent bdfe4ebd00
commit 2f39c32629
3 changed files with 10 additions and 24 deletions
+1 -4
View File
@@ -52,12 +52,9 @@ Construct uses Minecraft's vanilla structure system so that you can easily creat
### Commands ### Commands
**Usage: `/construct:item`** **Usage: `/construct:construct`**
Gives you the Construct item. Use it to open the Construct menu. Gives you the Construct item. Use it to open the Construct menu.
**Usage: `./construct`**
Shows the Construct menu. Only available while **Canopy** is installed.
## Join the Community ## Join the Community
Need help, want to discuss technical Minecraft, or follow future updates? [**Join our Discord!**](https://discord.gg/9KGche8fxm) Need help, want to discuss technical Minecraft, or follow future updates? [**Join our Discord!**](https://discord.gg/9KGche8fxm)
+5 -15
View File
@@ -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 { world, system, EntityComponentTypes, ItemStack, CommandPermissionLevel, CustomCommandStatus, Player } from '@minecraft/server';
import { MenuForm } from '../classes/MenuForm'; import { MenuForm } from '../classes/MenuForm';
import { structureCollection } from '../classes/Structure/StructureCollection' import { structureCollection } from '../classes/Structure/StructureCollection'
@@ -7,18 +5,10 @@ import { Builders } from '../classes/Builder/Builders';
export const MENU_ITEM = 'construct:menu'; 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) => { system.beforeEvents.startup.subscribe((event) => {
const command = { const command = {
name: 'construct:item', name: 'construct:construct',
description: 'construct.commands.item', description: 'construct.commands.construct',
permissionLevel: CommandPermissionLevel.Any, permissionLevel: CommandPermissionLevel.Any,
cheatsRequired: false cheatsRequired: false
}; };
@@ -28,13 +18,13 @@ system.beforeEvents.startup.subscribe((event) => {
function givePlayerConstructItem(origin) { function givePlayerConstructItem(origin) {
const player = origin.sourceEntity; const player = origin.sourceEntity;
if (player instanceof Player === false) 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(() => { system.run(() => {
const givenItemStack = player.getComponent(EntityComponentTypes.Inventory)?.container?.addItem(new ItemStack(MENU_ITEM)); const givenItemStack = player.getComponent(EntityComponentTypes.Inventory)?.container?.addItem(new ItemStack(MENU_ITEM));
if (givenItemStack) if (givenItemStack)
player.sendMessage({ translate: 'construct.commands.item.fail' }); player.sendMessage({ translate: 'construct.commands.construct.fail' });
else else
player.sendMessage({ translate: 'construct.commands.item.success' }); player.sendMessage({ translate: 'construct.commands.construct.success' });
}); });
return { status: CustomCommandStatus.Success }; return { status: CustomCommandStatus.Success };
} }
+4 -5
View File
@@ -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. construct.mainmenu.howto.remove.body=§7- Use the §f/structure delete§7 command to remove a structure from the world.
## Commands ## Commands
construct.commands.construct=Opens the Construct menu. construct.commands.construct=Gives you the Construct item. Use it to open the Construct menu.
construct.commands.item=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.item.denyorigin=This command can only be used by players. construct.commands.construct.fail=§cFailed to give you the Construct item.
construct.commands.item.fail=§cFailed to give you the Construct item. construct.commands.construct.success=§aYou recieved the Construct item! Use it to open the Construct menu.
construct.commands.item.success=§aYou recieved the Construct item! Use it to open the Construct menu.
## Options ## Options
construct.option.enabled= is now enabled! construct.option.enabled= is now enabled!