Skip to content

Commit

Permalink
fix plugin init, update version
Browse files Browse the repository at this point in the history
  • Loading branch information
MashiroShiinaX committed Nov 18, 2023
1 parent 0f928c3 commit 2864815
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions classes/MTZ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MTZ {

subscribe("/lol-gameflow/v1/gameflow-phase", "phase", (message: { data: string }) => this.phase = JSON.parse(message.data)[2]?.data?.toUpperCase() || null)

this.getPlugins().forEach(plugin => this.initPlugin(plugin))
this.getPlugins().forEach(plugin => !plugin.initialized && this.initPlugin(plugin))

this.on("screen", this.#onScreen.bind(this))
this.on("phase", this.#onPhase.bind(this))
Expand All @@ -88,7 +88,7 @@ class MTZ {
*/
initPlugin(plugin: MTZPlugin) {
plugin.initialized = true
plugin.init()
plugin.onInit()
plugin.log("Initialized")
}

Expand All @@ -98,7 +98,7 @@ class MTZ {
*/
addPlugin(plugin: MTZPlugin) {
this.plugins.push(plugin)
if (this.isReady())
if (!plugin.initialized && this.isReady())
this.initPlugin(plugin)
}

Expand All @@ -115,7 +115,7 @@ class MTZ {
* Returns an array of plugins.
* @returns {Array} An array of plugins.
*/
getPlugins(): Array<any> {
getPlugins(): Array<MTZPlugin> {
return this.plugins.sort((a, b) => {
if (a.priority === b.priority)
return a.name.localeCompare(b.name)
Expand Down
2 changes: 1 addition & 1 deletion classes/MTZPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class MTZPlugin {
/**
* Called when the plugin is initialized.
*/
init() { }
onInit() { }

/**
* Logs a message to the console.
Expand Down
2 changes: 1 addition & 1 deletion src/AutoAccept/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ new class extends MTZPlugin {
super(import("./package.json"))
}

override init(): void {
override onInit(): void {

this.options = {
parent: ".open-party-toggle",
Expand Down
2 changes: 1 addition & 1 deletion src/AutoAccept/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"displayName": "AutoAccept",
"name": "autoaccept",
"version": "1.0.11",
"version": "1.0.12",
"author": "Sakurasou"
}
2 changes: 1 addition & 1 deletion src/AutoHonor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ new class extends MTZPlugin {
super(import("./package.json"))
}

override init(): void {
override onInit(): void {
this.options = {
parent: ".open-party-toggle",
name: this.name,
Expand Down
2 changes: 1 addition & 1 deletion src/AutoHonor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"displayName": "AutoHonor",
"name": "autohonor",
"priority": 1,
"version": "1.0.11",
"version": "1.0.12",
"author": "Sakurasou"
}
2 changes: 1 addition & 1 deletion src/GroupInviter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"displayName": "GroupInviter",
"name": "groupinviter",
"version": "1.0.11",
"version": "1.0.12",
"author": "Sakurasou"
}
2 changes: 1 addition & 1 deletion src/HideFriends/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ new class extends MTZPlugin {
super(import("./package.json"))
}

override init(): void {
override onInit(): void {
this.addCSS("https://cdn.mashtoolz.xyz/lolclient/css/HideFriends.css")
}

Expand Down
2 changes: 1 addition & 1 deletion src/HideFriends/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"displayName": "HideFriends",
"name": "hidefriends",
"version": "1.0.11",
"version": "1.0.12",
"author": "Sakurasou"
}
2 changes: 1 addition & 1 deletion src/ProfileSkinUnlocker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"displayName": "ProfileSkinUnlocker",
"name": "profileskinunlocker",
"version": "1.0.11",
"version": "1.0.12",
"author": "Sakurasou"
}
2 changes: 1 addition & 1 deletion src/RandomIconSelector/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"displayName": "RandomIconSelector",
"name": "randomiconselector",
"version": "1.0.11",
"version": "1.0.12",
"author": "Sakurasou"
}

0 comments on commit 2864815

Please sign in to comment.