start reformating strings into RawMessages
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
"texture": "construct:easy_place"
|
"texture": "construct:easy_place"
|
||||||
},
|
},
|
||||||
"minecraft:display_name": {
|
"minecraft:display_name": {
|
||||||
"value": "Easy Place"
|
"value": "construct.easyPlace.name"
|
||||||
},
|
},
|
||||||
"minecraft:max_stack_size": 1,
|
"minecraft:max_stack_size": 1,
|
||||||
"minecraft:wearable": {
|
"minecraft:wearable": {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"texture": "construct:material_grabber"
|
"texture": "construct:material_grabber"
|
||||||
},
|
},
|
||||||
"minecraft:display_name": {
|
"minecraft:display_name": {
|
||||||
"value": "Material Grabber"
|
"value": "construct.materialGrabber.name"
|
||||||
},
|
},
|
||||||
"minecraft:wearable": {
|
"minecraft:wearable": {
|
||||||
"dispensable": true,
|
"dispensable": true,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"texture": "construct:menu"
|
"texture": "construct:menu"
|
||||||
},
|
},
|
||||||
"minecraft:display_name": {
|
"minecraft:display_name": {
|
||||||
"value": "Construct"
|
"value": "construct.menu.name"
|
||||||
},
|
},
|
||||||
"minecraft:wearable": {
|
"minecraft:wearable": {
|
||||||
"dispensable": true,
|
"dispensable": true,
|
||||||
|
|||||||
@@ -20,10 +20,21 @@ export class BuilderForm {
|
|||||||
for (let i = 0; i < optionIds.length; i++) {
|
for (let i = 0; i < optionIds.length; i++) {
|
||||||
const option = BuilderOptions.get(optionIds[i]);
|
const option = BuilderOptions.get(optionIds[i]);
|
||||||
const changedToValue = option.setValue(this.player.id, formValues[i]);
|
const changedToValue = option.setValue(this.player.id, formValues[i]);
|
||||||
if (changedToValue === true)
|
if (changedToValue === true) {
|
||||||
this.player.sendMessage(`§a${option.displayName} is now enabled!§7 ${option.howToUse}`);
|
this.player.sendMessage({ rawtext: [
|
||||||
else if (changedToValue === false)
|
{ text: `§a` },
|
||||||
this.player.sendMessage(`§c${option.displayName} is now disabled.`)
|
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);
|
.title(MenuFormBuilder.menuTitle);
|
||||||
for (const optionId of BuilderOptions.getOptionIds()) {
|
for (const optionId of BuilderOptions.getOptionIds()) {
|
||||||
const option = BuilderOptions.get(optionId);
|
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;
|
return form;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
export const InstanceButtons = Object.freeze({
|
export const InstanceButtons = Object.freeze({
|
||||||
Unknown: 'Unknown',
|
Unknown: 'construct.menu.instance.button.unknown',
|
||||||
MainMenu: '<<',
|
MainMenu: '<<',
|
||||||
Place: '§aPlace Instance',
|
Place: 'construct.menu.instance.button.place',
|
||||||
Enable: '§aEnable Instance',
|
Enable: 'construct.menu.instance.button.enable',
|
||||||
Disable: '§cDisable Instance',
|
Disable: 'construct.menu.instance.button.disable',
|
||||||
Rename: 'Rename Instance',
|
Rename: 'construct.menu.instance.button.rename',
|
||||||
Delete: '§cDelete Instance',
|
Delete: 'construct.menu.instance.button.delete',
|
||||||
NextLayer: 'Increase Layer',
|
NextLayer: 'construct.menu.instance.button.nextLayer',
|
||||||
PreviousLayer: 'Decrease Layer',
|
PreviousLayer: 'construct.menu.instance.button.previousLayer',
|
||||||
Move: 'Move Here',
|
Move: 'construct.menu.instance.button.move',
|
||||||
FlexibleMove: 'Flexible Move',
|
FlexibleMove: 'construct.menu.instance.button.flexibleMove',
|
||||||
Statistics: 'Statistics',
|
Statistics: 'construct.menu.instance.button.statistics',
|
||||||
Settings: 'Settings',
|
Settings: 'construct.menu.instance.button.settings',
|
||||||
Materials: 'Material List'
|
Materials: 'construct.menu.instance.button.materials'
|
||||||
});
|
});
|
||||||
@@ -23,7 +23,7 @@ export class FlexibleInstanceMove {
|
|||||||
|
|
||||||
tryStart() {
|
tryStart() {
|
||||||
if (this.instance.isFlexibleMoving()) {
|
if (this.instance.isFlexibleMoving()) {
|
||||||
this.sendFeedback('§cThis instance is already being moved.');
|
this.sendFeedback({ translate: 'construct.instance.flexibleMove.alreadyMoving' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.start();
|
this.start();
|
||||||
@@ -48,7 +48,7 @@ export class FlexibleInstanceMove {
|
|||||||
this.allowPlayerMovement(false);
|
this.allowPlayerMovement(false);
|
||||||
world.beforeEvents.itemUse.subscribe(this.onPlayerUseItemBound);
|
world.beforeEvents.itemUse.subscribe(this.onPlayerUseItemBound);
|
||||||
world.beforeEvents.playerLeave.unsubscribe(this.onPlayerLeaveBound);
|
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() {
|
onFlexibleMovementTick() {
|
||||||
@@ -109,7 +109,10 @@ export class FlexibleInstanceMove {
|
|||||||
builder.flexibleInstanceMovement = void 0;
|
builder.flexibleInstanceMovement = void 0;
|
||||||
world.beforeEvents.itemUse.unsubscribe(this.onPlayerUseItemBound);
|
world.beforeEvents.itemUse.unsubscribe(this.onPlayerUseItemBound);
|
||||||
world.beforeEvents.playerLeave.unsubscribe(this.onPlayerLeaveBound);
|
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) {
|
allowPlayerMovement(enable) {
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export class InstanceForm {
|
|||||||
new MenuForm(this.player, { jumpToInstance: false });
|
new MenuForm(this.player, { jumpToInstance: false });
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.player.sendMessage(`§cUnknown option: ${option}`);
|
this.player.sendMessage({ translate: 'construct.menu.instance.unknownOption', with: [option] });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,15 +124,14 @@ export class InstanceForm {
|
|||||||
return;
|
return;
|
||||||
const newName = response.formValues[0];
|
const newName = response.formValues[0];
|
||||||
if (newName === '') {
|
if (newName === '') {
|
||||||
this.player.sendMessage('§cInstance name cannot be empty.');
|
this.player.sendMessage({ translate: 'construct.menu.instance.nameEmpty' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
structureCollection.rename(this.instanceName, newName);
|
structureCollection.rename(this.instanceName, newName);
|
||||||
this.instanceName = newName;
|
this.instanceName = newName;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.player.sendMessage(`§cError renaming instance: ${e.message}`);
|
this.player.sendMessage({ translate: 'construct.instance.rename.error', with: [e.message] });
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class MaterialGrabberForm {
|
|||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message === 'Menu timed out.') {
|
if (e.message === 'Menu timed out.') {
|
||||||
this.player.sendMessage('§8Menu timed out.');
|
this.player.sendMessage({ translate: 'construct.menu.open.timeout' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class MenuForm {
|
|||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message === 'Menu timed out.') {
|
if (e.message === 'Menu timed out.') {
|
||||||
this.player.sendMessage('§8Menu timed out.');
|
this.player.sendMessage({ translate: 'construct.menu.open.timeout' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export async function forceShow(player, form, timeout = Infinity) {
|
|||||||
while ((system.currentTick - startTick) < timeout) {
|
while ((system.currentTick - startTick) < timeout) {
|
||||||
const response = await form.show(player);
|
const response = await form.show(player);
|
||||||
if (startTick + 1 === system.currentTick && response.cancelationReason === FormCancelationReason.UserBusy)
|
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)
|
if (response.cancelationReason !== FormCancelationReason.UserBusy)
|
||||||
return response;
|
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