start reformating strings into RawMessages
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
"texture": "construct:easy_place"
|
||||
},
|
||||
"minecraft:display_name": {
|
||||
"value": "Easy Place"
|
||||
"value": "construct.easyPlace.name"
|
||||
},
|
||||
"minecraft:wearable": {
|
||||
"dispensable": true,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"texture": "construct:material_grabber"
|
||||
},
|
||||
"minecraft:display_name": {
|
||||
"value": "Material Grabber"
|
||||
"value": "construct.materialGrabber.name"
|
||||
},
|
||||
"minecraft:wearable": {
|
||||
"dispensable": true,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"texture": "construct:menu"
|
||||
},
|
||||
"minecraft:display_name": {
|
||||
"value": "Construct"
|
||||
"value": "construct.menu.name"
|
||||
},
|
||||
"minecraft:wearable": {
|
||||
"dispensable": true,
|
||||
|
||||
@@ -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' }
|
||||
]});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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'
|
||||
});
|
||||
@@ -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) {
|
||||
|
||||
@@ -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] });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
[
|
||||
"en_US"
|
||||
]
|
||||
Reference in New Issue
Block a user