diff --git a/packs/BP/items/easy_place.json b/packs/BP/items/easy_place.json index af4ba61..af6b1ee 100644 --- a/packs/BP/items/easy_place.json +++ b/packs/BP/items/easy_place.json @@ -10,7 +10,7 @@ "texture": "construct:easy_place" }, "minecraft:display_name": { - "value": "Easy Place" + "value": "construct.easyPlace.name" }, "minecraft:max_stack_size": 1, "minecraft:wearable": { diff --git a/packs/BP/items/material_grabber.json b/packs/BP/items/material_grabber.json index f3d45fd..2a4a13e 100644 --- a/packs/BP/items/material_grabber.json +++ b/packs/BP/items/material_grabber.json @@ -11,7 +11,7 @@ "texture": "construct:material_grabber" }, "minecraft:display_name": { - "value": "Material Grabber" + "value": "construct.materialGrabber.name" }, "minecraft:wearable": { "dispensable": true, diff --git a/packs/BP/items/menu.json b/packs/BP/items/menu.json index 7994039..cfb3fea 100644 --- a/packs/BP/items/menu.json +++ b/packs/BP/items/menu.json @@ -11,7 +11,7 @@ "texture": "construct:menu" }, "minecraft:display_name": { - "value": "Construct" + "value": "construct.menu.name" }, "minecraft:wearable": { "dispensable": true, diff --git a/packs/BP/scripts/classes/Builder/BuilderForm.js b/packs/BP/scripts/classes/Builder/BuilderForm.js index 174a718..6b9cb3c 100644 --- a/packs/BP/scripts/classes/Builder/BuilderForm.js +++ b/packs/BP/scripts/classes/Builder/BuilderForm.js @@ -20,10 +20,21 @@ export class BuilderForm { for (let i = 0; i < optionIds.length; i++) { const option = BuilderOptions.get(optionIds[i]); const changedToValue = option.setValue(this.player.id, formValues[i]); - if (changedToValue === true) - this.player.sendMessage(`§a${option.displayName} is now enabled!§7 ${option.howToUse}`); - else if (changedToValue === false) - this.player.sendMessage(`§c${option.displayName} is now disabled.`) + if (changedToValue === true) { + this.player.sendMessage({ rawtext: [ + { text: `§a` }, + option.displayName, + { translate: 'construct.option.enabled' }, + { text: `§7 ` }, + { translate: option.howToUse } + ]}); + } else if (changedToValue === false) { + this.player.sendMessage({ rawtext: [ + { text: `§c` }, + option.displayName, + { translate: 'construct.option.disabled' } + ]}); + } } } diff --git a/packs/BP/scripts/classes/Builder/BuilderFormBuilder.js b/packs/BP/scripts/classes/Builder/BuilderFormBuilder.js index dbcef2c..8b1bb37 100644 --- a/packs/BP/scripts/classes/Builder/BuilderFormBuilder.js +++ b/packs/BP/scripts/classes/Builder/BuilderFormBuilder.js @@ -8,9 +8,9 @@ export class BuilderFormBuilder { .title(MenuFormBuilder.menuTitle); for (const optionId of BuilderOptions.getOptionIds()) { const option = BuilderOptions.get(optionId); - form.toggle(`${option.displayName}`, { defaultValue: option.isEnabled(player.id), tooltip: option.description }); + form.toggle(option.displayName, { defaultValue: option.isEnabled(player.id), tooltip: option.description }); } - form.submitButton('§2Apply'); + form.submitButton({ translate: "construct.menu.submit" }); return form; } } \ No newline at end of file diff --git a/packs/BP/scripts/classes/Enums/InstanceButtons.js b/packs/BP/scripts/classes/Enums/InstanceButtons.js index ed8af25..06dc55d 100644 --- a/packs/BP/scripts/classes/Enums/InstanceButtons.js +++ b/packs/BP/scripts/classes/Enums/InstanceButtons.js @@ -1,16 +1,16 @@ export const InstanceButtons = Object.freeze({ - Unknown: 'Unknown', + Unknown: 'construct.menu.instance.button.unknown', MainMenu: '<<', - Place: '§aPlace Instance', - Enable: '§aEnable Instance', - Disable: '§cDisable Instance', - Rename: 'Rename Instance', - Delete: '§cDelete Instance', - NextLayer: 'Increase Layer', - PreviousLayer: 'Decrease Layer', - Move: 'Move Here', - FlexibleMove: 'Flexible Move', - Statistics: 'Statistics', - Settings: 'Settings', - Materials: 'Material List' + Place: 'construct.menu.instance.button.place', + Enable: 'construct.menu.instance.button.enable', + Disable: 'construct.menu.instance.button.disable', + Rename: 'construct.menu.instance.button.rename', + Delete: 'construct.menu.instance.button.delete', + NextLayer: 'construct.menu.instance.button.nextLayer', + PreviousLayer: 'construct.menu.instance.button.previousLayer', + Move: 'construct.menu.instance.button.move', + FlexibleMove: 'construct.menu.instance.button.flexibleMove', + Statistics: 'construct.menu.instance.button.statistics', + Settings: 'construct.menu.instance.button.settings', + Materials: 'construct.menu.instance.button.materials' }); \ No newline at end of file diff --git a/packs/BP/scripts/classes/Instance/FlexibleInstanceMove.js b/packs/BP/scripts/classes/Instance/FlexibleInstanceMove.js index a7def96..ed3820a 100644 --- a/packs/BP/scripts/classes/Instance/FlexibleInstanceMove.js +++ b/packs/BP/scripts/classes/Instance/FlexibleInstanceMove.js @@ -23,7 +23,7 @@ export class FlexibleInstanceMove { tryStart() { if (this.instance.isFlexibleMoving()) { - this.sendFeedback('§cThis instance is already being moved.'); + this.sendFeedback({ translate: 'construct.instance.flexibleMove.alreadyMoving' }); return; } this.start(); @@ -48,7 +48,7 @@ export class FlexibleInstanceMove { this.allowPlayerMovement(false); world.beforeEvents.itemUse.subscribe(this.onPlayerUseItemBound); world.beforeEvents.playerLeave.unsubscribe(this.onPlayerLeaveBound); - this.sendFeedback(`§aNow moving "${this.instance.getName()}". Use the Construct item when finished.`); + this.sendFeedback({ translate: 'construct.instance.flexibleMove.start', with: [this.instance.getName()] }); } onFlexibleMovementTick() { @@ -109,7 +109,10 @@ export class FlexibleInstanceMove { builder.flexibleInstanceMovement = void 0; world.beforeEvents.itemUse.unsubscribe(this.onPlayerUseItemBound); world.beforeEvents.playerLeave.unsubscribe(this.onPlayerLeaveBound); - this.sendFeedback(`§aMoved "${this.instance.getName()}" to ${this.currentInstanceLocation.floor()}.`); + this.sendFeedback({ translate: 'construct.instance.flexibleMove.finish', with: [ + this.instance.getName(), + String(this.currentInstanceLocation.floor()) + ] }); } allowPlayerMovement(enable) { diff --git a/packs/BP/scripts/classes/Instance/InstanceForm.js b/packs/BP/scripts/classes/Instance/InstanceForm.js index e9c7e9b..232b47b 100644 --- a/packs/BP/scripts/classes/Instance/InstanceForm.js +++ b/packs/BP/scripts/classes/Instance/InstanceForm.js @@ -113,7 +113,7 @@ export class InstanceForm { new MenuForm(this.player, { jumpToInstance: false }); break; default: - this.player.sendMessage(`§cUnknown option: ${option}`); + this.player.sendMessage({ translate: 'construct.menu.instance.unknownOption', with: [option] }); break; } } @@ -124,15 +124,14 @@ export class InstanceForm { return; const newName = response.formValues[0]; if (newName === '') { - this.player.sendMessage('§cInstance name cannot be empty.'); + this.player.sendMessage({ translate: 'construct.menu.instance.nameEmpty' }); return; } try { structureCollection.rename(this.instanceName, newName); this.instanceName = newName; } catch (e) { - this.player.sendMessage(`§cError renaming instance: ${e.message}`); - return; + this.player.sendMessage({ translate: 'construct.instance.rename.error', with: [e.message] }); } }); } diff --git a/packs/BP/scripts/classes/Materials/MaterialGrabberForm.js b/packs/BP/scripts/classes/Materials/MaterialGrabberForm.js index 45c05fa..571a8f3 100644 --- a/packs/BP/scripts/classes/Materials/MaterialGrabberForm.js +++ b/packs/BP/scripts/classes/Materials/MaterialGrabberForm.js @@ -23,7 +23,7 @@ export class MaterialGrabberForm { }); } catch (e) { if (e.message === 'Menu timed out.') { - this.player.sendMessage('§8Menu timed out.'); + this.player.sendMessage({ translate: 'construct.menu.open.timeout' }); return; } throw e; diff --git a/packs/BP/scripts/classes/MenuForm.js b/packs/BP/scripts/classes/MenuForm.js index c5c0ea0..29e5aef 100644 --- a/packs/BP/scripts/classes/MenuForm.js +++ b/packs/BP/scripts/classes/MenuForm.js @@ -42,7 +42,7 @@ export class MenuForm { }); } catch (e) { if (e.message === 'Menu timed out.') { - this.player.sendMessage('§8Menu timed out.'); + this.player.sendMessage({ translate: 'construct.menu.open.timeout' }); return; } throw e; diff --git a/packs/BP/scripts/utils.js b/packs/BP/scripts/utils.js index aa8a636..58cce58 100644 --- a/packs/BP/scripts/utils.js +++ b/packs/BP/scripts/utils.js @@ -8,7 +8,7 @@ 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("§8Close your chat window to access the menu."); + player.sendMessage({ translate: 'construct.menu.open.closeChat' }); if (response.cancelationReason !== FormCancelationReason.UserBusy) return response; } diff --git a/packs/RP/texts/en_US.lang b/packs/RP/texts/en_US.lang new file mode 100644 index 0000000..d074c65 --- /dev/null +++ b/packs/RP/texts/en_US.lang @@ -0,0 +1,31 @@ +## Items +construct.menu.name=Construct +construct.easyPlace.name=Easy Place +construct.materialGrabber.name=Material Grabber + +construct.option.enabled=is now enabled! +construct.option.disabled=is now disabled. + +construct.menu.open.closeChat=§8Close your chat window to access the menu. +construct.menu.open.timeout=§8Menu timed out. +construct.menu.submit=§2Apply +construct.menu.instance.button.unknown=Unknown +construct.menu.instance.button.place=§aPlace Instance +construct.menu.instance.button.enable=§aEnable Instance +construct.menu.instance.button.disable=§cDisable Instance +construct.menu.instance.button.rename=Rename Instance +construct.menu.instance.button.delete=§cDelete Instance +construct.menu.instance.button.nextLayer=Increase Layer +construct.menu.instance.button.previousLayer=Decrease Layer +construct.menu.instance.button.move=Move Here +construct.menu.instance.button.flexibleMove=Flexible Move +construct.menu.instance.button.statistics=Statistics +construct.menu.instance.button.settings=Settings +construct.menu.instance.button.materials=Material List +construct.menu.instance.unknownOption=§cUnknown option: %s +construct.menu.instance.nameEmpty=§cInstance name cannot be empty. + +construct.instance.flexibleMove.alreadyMoving=§cThis instance is already being moved. +construct.instance.flexibleMove.start=§aNow moving "%s". Use the Construct item when finished. +construct.instance.flexibleMove.finish=§aMoved "%1" to %2. +construct.instance.rename.error=§cError renaming instance: %s \ No newline at end of file diff --git a/packs/RP/texts/languages.json b/packs/RP/texts/languages.json new file mode 100644 index 0000000..52d2a01 --- /dev/null +++ b/packs/RP/texts/languages.json @@ -0,0 +1,3 @@ +[ + "en_US" +] \ No newline at end of file