diff --git a/src/mods/mod.d.ts b/src/mods/mod.d.ts index 5d32ef4..cd9b7fc 100644 --- a/src/mods/mod.d.ts +++ b/src/mods/mod.d.ts @@ -1,6 +1,6 @@ declare global { // DONT FORGET TO UPDATE CONSTRUCTORS WHEN MOD SIGNATURE CHANGES - type Mod = { + type TrackedMod = { id: string name: string fileName: string, diff --git a/src/mods/mods.ts b/src/mods/mods.ts index 2d44a0b..9cdded3 100644 --- a/src/mods/mods.ts +++ b/src/mods/mods.ts @@ -71,7 +71,7 @@ export default class Mods { } } - public static trackMod(mod: Mod): void { + public static trackMod(mod: TrackedMod): void { // Read current file const mods = this.getTrackedMods(); @@ -82,17 +82,17 @@ export default class Mods { this.writeToModFile(mods); } - public static getTrackedMods(): Array { + public static getTrackedMods(): Array { const file = readFileSync(ModManager.FilePaths.MOD_FILE_PATH, "utf-8"); return JSON.parse(file); } - public static writeToModFile(mods: Array): void { + public static writeToModFile(mods: Array): void { writeFileSync(ModManager.FilePaths.MOD_FILE_PATH, JSON.stringify(mods, null, 4)); } private static isModInstalled(id: string): boolean { - const modsWithId: Array = this.getTrackedMods().filter(mod => mod.id == id); + const modsWithId: Array = this.getTrackedMods().filter(mod => mod.id == id); return !Util.isArrayEmpty(modsWithId) } @@ -111,8 +111,8 @@ export default class Mods { } } - static silentUninstall(mod: Mod) { - let mods: Array = this.getTrackedMods(); + static silentUninstall(mod: TrackedMod) { + let mods: Array = this.getTrackedMods(); // Remove mod from list and uninstall it unlinkSync(path.join(ModManager.FilePaths.MODS_FOLDER_PATH, mod.fileName)); @@ -120,7 +120,7 @@ export default class Mods { this.writeToModFile(mods); } - static areModsEqual(mod1: Mod, mod2: Mod): boolean { + static areModsEqual(mod1: TrackedMod, mod2: TrackedMod): boolean { return mod1.id === mod2.id; } @@ -147,11 +147,11 @@ export default class Mods { } } - private static findMod(mod: string): Mod | undefined { + private static findMod(mod: string): TrackedMod | undefined { // Replace underscores with spaces mod = mod.replaceAll("_", " "); - let mods: Array = this.getTrackedMods(); + let mods: Array = this.getTrackedMods(); for (let modEle of mods) { const id = modEle.id.toLowerCase(); const name = modEle.name.toLowerCase();