Skip to content

Commit

Permalink
Do not unregister "/2fa" command of other plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ruViolence committed Jan 26, 2024
1 parent 2c60de7 commit dda2b85
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/net/elytrium/limboauth/LimboAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.j256.ormlite.table.TableInfo;
import com.j256.ormlite.table.TableUtils;
import com.velocitypowered.api.command.CommandManager;
import com.velocitypowered.api.command.CommandMeta;
import com.velocitypowered.api.event.EventManager;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
Expand Down Expand Up @@ -343,7 +344,6 @@ public void reload() {
manager.unregister("changepassword");
manager.unregister("forcechangepassword");
manager.unregister("destroysession");
manager.unregister("2fa");
manager.unregister("limboauth");

manager.register("unregister", new UnregisterCommand(this, this.playerDao), "unreg");
Expand All @@ -354,7 +354,13 @@ public void reload() {
manager.register("forcechangepassword", new ForceChangePasswordCommand(this, this.server, this.playerDao), "forcechangepass", "fcp");
manager.register("destroysession", new DestroySessionCommand(this), "logout");
if (Settings.IMP.MAIN.ENABLE_TOTP) {
manager.register("2fa", new TotpCommand(this.playerDao), "totp");
CommandMeta meta = manager.metaBuilder("2fa").aliases("totp").plugin(this).build();
manager.register(meta, new TotpCommand(this.playerDao));
} else {
CommandMeta meta = manager.getCommandMeta("2fa");
if (meta != null && this.equals(meta.getPlugin())) {
manager.unregister("2fa");
}
}
manager.register("limboauth", new LimboAuthCommand(this), "la", "auth", "lauth");

Expand Down

0 comments on commit dda2b85

Please sign in to comment.