Skip to content

Commit

Permalink
Add API for unregistering multiple commands
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Dec 15, 2022
1 parent 1b3f66d commit 62355c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions MCGalaxy/Commands/Command.cs
Expand Up @@ -123,6 +123,10 @@ public abstract partial class Command
return removed;
}

public static void Unregister(params Command[] cmds) {
foreach (Command cmd in cmds) { Unregister(cmd); }
}


public static string GetColoredName(Command cmd) {
LevelPermission perm = CommandPerms.MinPerm(cmd);
Expand Down
3 changes: 2 additions & 1 deletion MCGalaxy/Commands/Information/CmdCommands.cs
Expand Up @@ -79,7 +79,8 @@ public sealed class CmdCommands : Command2

static void PrintRankCommands(Player p, string sort, string modifier, Group group, bool own) {
List<Command> cmds = new List<Command>();
foreach (Command c in Command.allCmds) {
foreach (Command c in Command.allCmds)
{
string disabled = Command.GetDisabledReason(c.Enabled);
if (disabled == null && group.Commands.Contains(c)) cmds.Add(c);
}
Expand Down
3 changes: 1 addition & 2 deletions MCGalaxy/Modules/Moderation/Notes/NotesPlugin.cs
Expand Up @@ -36,8 +36,7 @@ public sealed class NotesPlugin : Plugin

public override void Unload(bool shutdown) {
OnModActionEvent.Unregister(HandleModerationAction);
Command.Unregister(notesCmd);
Command.Unregister(myNotesCmd);
Command.Unregister(notesCmd, myNotesCmd);
}


Expand Down

0 comments on commit 62355c7

Please sign in to comment.