mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-26 15:47:13 +09:00
Wait for exp_discord_auth with plugins.waitFor
Clusterio 2.1.2 loads plugins concurrently and lets them wait for each other, so exp_discord_sync gets exp_discord_auth in its entrypoint and attaches the link hooks there instead of looking it up on the first sync. Without exp_discord_auth it logs an error and does not connect. DiscordAuth.get() and its WeakMap had no other users and are removed, the README shows waitFor instead. The sync tests load both plugins through lib.PluginLoader with sync listed first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2c55cb796e
commit
cf968c02bb
5 files changed
+60
-52
No files matched your search
@@ -50,14 +50,7 @@ export class DiscordAuthHooks extends lib.AsyncHookCollection {
|
||||
readonly unlinked = this.newHook<[playerName: string, discordUser: DiscordUser]>();
|
||||
}
|
||||
|
||||
const loaded = new WeakMap<Controller, ControllerPlugin>();
|
||||
|
||||
export class ControllerPlugin {
|
||||
/** The plugin loaded on a controller, for other plugins to read links from. */
|
||||
static get(controller: Controller) {
|
||||
return loaded.get(controller);
|
||||
}
|
||||
|
||||
hooks: DiscordAuthHooks;
|
||||
/** Logins which have been through Discord, by session id */
|
||||
sessions = new Map<string, Session>();
|
||||
@@ -118,9 +111,7 @@ export class ControllerPlugin {
|
||||
messages.DiscordAccountRecord.fromJSON.bind(messages.DiscordAccountRecord),
|
||||
));
|
||||
|
||||
const plugin = new ControllerPlugin(controller, context.logger, context.plugin.name, accounts);
|
||||
loaded.set(controller, plugin);
|
||||
return plugin;
|
||||
return new ControllerPlugin(controller, context.logger, context.plugin.name, accounts);
|
||||
}
|
||||
|
||||
async onSave() {
|
||||
|
||||
Reference in new issue
Block a user