Add Formatting (Thank God)

This commit is contained in:
2024-08-29 15:47:58 +02:00
parent 545e47a9f3
commit 1ab45204b9
35 changed files with 2331 additions and 254 deletions

View File

@@ -75,10 +75,11 @@ class Mindkeeper {
for (let i = 0; i < this.registerdStores.length; i++) {
let isAlreadyDefined = true;
try {
let test = this.world.getDynamicProperty(this.registerdStores[i].getName());
const test = this.world.getDynamicProperty(this.registerdStores[i].getName());
if (test === undefined) {
isAlreadyDefined = false;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
isAlreadyDefined = false;
}
@@ -125,12 +126,13 @@ class Mindkeeper {
*/
get(store: string): string | number | boolean | Vector3 | undefined {
try {
let data = this.world.getDynamicProperty(store);
const data = this.world.getDynamicProperty(store);
if (data === undefined) {
this.world.sendMessage(`Store ${store} is not defined`);
return undefined;
}
return data;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (e) {
// this.world.sendMessage(`Store ${store} is not defined`);
return undefined;
@@ -142,7 +144,7 @@ class Mindkeeper {
* @param store The name of the store.
*/
increment(store: string): void {
let data = this.get(store);
const data = this.get(store);
if (typeof data === "number") {
this.set(store, data + 1);
}
@@ -155,6 +157,7 @@ class Mindkeeper {
private secondWarning = false;
chatCommands(event: ChatSendAfterEvent) {
const command = event.message.split(" ")[0];
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const args = event.message.split(" ").slice(1);
if (command === "!get") {
@@ -173,9 +176,8 @@ class Mindkeeper {
this.world.sendMessage(`Please provide a value to set for ${store}`);
return;
}
const type = event.message.split(" ")[3];
let actualType = this.getStores()
const actualType = this.getStores()
.find((s) => s.getName() === store)
?.getType();
@@ -195,10 +197,11 @@ class Mindkeeper {
}
this.set(store, Number(value));
break;
case StoreType.boolean:
case StoreType.boolean: {
const ActualValue = value.toLowerCase();
this.set(store, ActualValue === "true");
break;
}
}
this.world.sendMessage(`Value of ${store} is ${value}`);
}