mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Merge some upgrades from AsyncMCC branch
This commit is contained in:
parent
1298654693
commit
b4d7d64cdd
2 changed files with 59 additions and 37 deletions
|
|
@ -21,14 +21,20 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
|||
public override WindowActionType Parse(IStringReader reader)
|
||||
{
|
||||
reader.SkipWhitespace();
|
||||
string inputStr = reader.ReadString();
|
||||
foreach (var action in SupportActions)
|
||||
string inputStr = reader.ReadString().ToLower();
|
||||
return inputStr switch
|
||||
{
|
||||
string actionStr = action.ToString();
|
||||
if (string.Compare(inputStr, actionStr, true) == 0)
|
||||
return action;
|
||||
}
|
||||
throw CommandSyntaxException.BuiltInExceptions.LiteralIncorrect().CreateWithContext(reader, inputStr);
|
||||
"left" => WindowActionType.LeftClick,
|
||||
"leftclick" => WindowActionType.LeftClick,
|
||||
"right" => WindowActionType.RightClick,
|
||||
"rightclick" => WindowActionType.RightClick,
|
||||
"mid" => WindowActionType.MiddleClick,
|
||||
"middle" => WindowActionType.MiddleClick,
|
||||
"middleclick" => WindowActionType.MiddleClick,
|
||||
"shift" => WindowActionType.ShiftClick,
|
||||
"shiftclick" => WindowActionType.ShiftClick,
|
||||
_ => throw CommandSyntaxException.BuiltInExceptions.LiteralIncorrect().CreateWithContext(reader, inputStr)
|
||||
};
|
||||
}
|
||||
|
||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue