mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Add command auto-unregister mechanism (#1492)
* Add command auto-unregister mechanism * Improve logic
This commit is contained in:
parent
4853871ea1
commit
62c985376e
2 changed files with 30 additions and 2 deletions
|
|
@ -629,6 +629,26 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregister a console command
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// There is no check for the command is registered by above method or is embedded command.
|
||||
/// Which mean this can unload any command
|
||||
/// </remarks>
|
||||
/// <param name="cmdName">The name of command to be unregistered</param>
|
||||
/// <returns></returns>
|
||||
public bool UnregisterCommand(string cmdName)
|
||||
{
|
||||
if (cmds.ContainsKey(cmdName.ToLower()))
|
||||
{
|
||||
cmds.Remove(cmdName.ToLower());
|
||||
cmd_names.Remove(cmdName.ToLower());
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
#region Management: Load/Unload ChatBots and Enable/Disable settings
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue