mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Optimize ChatBot loading.
This commit is contained in:
parent
096ea0c70c
commit
87026e1bfb
13 changed files with 264 additions and 249 deletions
|
|
@ -19,7 +19,7 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
|||
McClient? client = CmdResult.currentHandler;
|
||||
if (client != null)
|
||||
{
|
||||
var botList = client.GetLoadedChatBots();
|
||||
Scripting.ChatBot[] botList = client.GetLoadedChatBots();
|
||||
foreach (var bot in botList)
|
||||
builder.Suggest(bot.GetType().Name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,15 +21,18 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
|||
McClient? client = CmdResult.currentHandler;
|
||||
if (client != null)
|
||||
{
|
||||
var bot = (Map?)client.GetLoadedChatBots().Find(bot => bot.GetType().Name == "Map");
|
||||
if (bot != null)
|
||||
foreach (var bot in client.GetLoadedChatBots())
|
||||
{
|
||||
var mapList = bot.cachedMaps;
|
||||
foreach (var map in mapList)
|
||||
if (bot.GetType() == typeof(Map))
|
||||
{
|
||||
string mapName = map.Key.ToString();
|
||||
if (mapName.StartsWith(builder.RemainingLowerCase, StringComparison.InvariantCultureIgnoreCase))
|
||||
builder.Suggest(mapName);
|
||||
var mapList = ((Map)bot).cachedMaps;
|
||||
foreach (var map in mapList)
|
||||
{
|
||||
string mapName = map.Key.ToString();
|
||||
if (mapName.StartsWith(builder.RemainingLowerCase, StringComparison.InvariantCultureIgnoreCase))
|
||||
builder.Suggest(mapName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue