mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Bug fix
This commit is contained in:
parent
127978615c
commit
94a3c92b36
62 changed files with 371 additions and 297 deletions
|
|
@ -296,7 +296,7 @@ namespace MinecraftClient.ChatBots
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
|
|
@ -310,7 +310,7 @@ namespace MinecraftClient.ChatBots
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => OnCommandList(r.Source)))
|
.Executes(r => OnCommandList(r.Source)))
|
||||||
.Then(l => l.Literal("start")
|
.Then(l => l.Literal("start")
|
||||||
|
|
@ -319,14 +319,14 @@ namespace MinecraftClient.ChatBots
|
||||||
.Then(l => l.Literal("stop")
|
.Then(l => l.Literal("stop")
|
||||||
.Executes(r => OnCommandStop(r.Source)))
|
.Executes(r => OnCommandStop(r.Source)))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||||
|
|
@ -339,7 +339,7 @@ namespace MinecraftClient.ChatBots
|
||||||
"stop" => Translations.bot_autoCraft_help_stop,
|
"stop" => Translations.bot_autoCraft_help_stop,
|
||||||
"help" => Translations.bot_autoCraft_help_help,
|
"help" => Translations.bot_autoCraft_help_help,
|
||||||
_ => string.Format(Translations.bot_autoCraft_available_cmd, "load, list, reload, resetcfg, start, stop, help")
|
_ => string.Format(Translations.bot_autoCraft_available_cmd, "load, list, reload, resetcfg, start, stop, help")
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ namespace MinecraftClient.ChatBots
|
||||||
if (!inventoryEnabled && Config.Auto_Tool_Switch)
|
if (!inventoryEnabled && Config.Auto_Tool_Switch)
|
||||||
LogToConsole(Translations.bot_autodig_no_inv_handle);
|
LogToConsole(Translations.bot_autodig_no_inv_handle);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
.Then(l => l.Literal("start")
|
.Then(l => l.Literal("start")
|
||||||
|
|
@ -135,25 +135,25 @@ namespace MinecraftClient.ChatBots
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
var cmd = Handler.dispatcher.Register(l => l.Literal(CommandName)
|
var cmd = McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("start")
|
.Then(l => l.Literal("start")
|
||||||
.Executes(r => OnCommandStart(r.Source)))
|
.Executes(r => OnCommandStart(r.Source)))
|
||||||
.Then(l => l.Literal("stop")
|
.Then(l => l.Literal("stop")
|
||||||
.Executes(r => OnCommandStop(r.Source)))
|
.Executes(r => OnCommandStop(r.Source)))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("digbot")
|
McClient.dispatcher.Register(l => l.Literal("digbot")
|
||||||
.Redirect(cmd)
|
.Redirect(cmd)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister("digbot");
|
McClient.dispatcher.Unregister("digbot");
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||||
|
|
@ -165,7 +165,7 @@ namespace MinecraftClient.ChatBots
|
||||||
"stop" => Translations.bot_autodig_help_stop,
|
"stop" => Translations.bot_autodig_help_stop,
|
||||||
"help" => Translations.bot_autodig_help_help,
|
"help" => Translations.bot_autodig_help_help,
|
||||||
_ => string.Format(Translations.bot_autodig_available_cmd, "start, stop, help")
|
_ => string.Format(Translations.bot_autodig_available_cmd, "start, stop, help")
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace MinecraftClient.ChatBots
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
.Then(l => l.Literal("add")
|
.Then(l => l.Literal("add")
|
||||||
|
|
@ -66,7 +66,7 @@ namespace MinecraftClient.ChatBots
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("on")
|
.Then(l => l.Literal("on")
|
||||||
.Executes(r => OnCommandEnable(r.Source, true)))
|
.Executes(r => OnCommandEnable(r.Source, true)))
|
||||||
.Then(l => l.Literal("off")
|
.Then(l => l.Literal("off")
|
||||||
|
|
@ -87,14 +87,14 @@ namespace MinecraftClient.ChatBots
|
||||||
.Then(l => l.Literal("everything")
|
.Then(l => l.Literal("everything")
|
||||||
.Executes(r => OnCommandMode(r.Source, DropMode.everything))))
|
.Executes(r => OnCommandMode(r.Source, DropMode.everything))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||||
|
|
@ -106,7 +106,7 @@ namespace MinecraftClient.ChatBots
|
||||||
"remove" => Translations.cmd_inventory_help_usage + ": remove <item name>",
|
"remove" => Translations.cmd_inventory_help_usage + ": remove <item name>",
|
||||||
"mode" => Translations.bot_autoDrop_unknown_mode,
|
"mode" => Translations.bot_autoDrop_unknown_mode,
|
||||||
_ => string.Format(Translations.general_available_cmd, "on, off, add, remove, list, mode")
|
_ => string.Format(Translations.general_available_cmd, "on, off, add, remove, list, mode")
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ namespace MinecraftClient.ChatBots
|
||||||
if (!inventoryEnabled)
|
if (!inventoryEnabled)
|
||||||
LogToConsole(Translations.bot_autoFish_no_inv_handle);
|
LogToConsole(Translations.bot_autoFish_no_inv_handle);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
.Then(l => l.Literal("start")
|
.Then(l => l.Literal("start")
|
||||||
|
|
@ -201,7 +201,7 @@ namespace MinecraftClient.ChatBots
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("start")
|
.Then(l => l.Literal("start")
|
||||||
.Executes(r => OnCommandStart(r.Source)))
|
.Executes(r => OnCommandStart(r.Source)))
|
||||||
.Then(l => l.Literal("stop")
|
.Then(l => l.Literal("stop")
|
||||||
|
|
@ -211,14 +211,14 @@ namespace MinecraftClient.ChatBots
|
||||||
.Then(l => l.Literal("clear")
|
.Then(l => l.Literal("clear")
|
||||||
.Executes(r => OnCommandStatusClear(r.Source))))
|
.Executes(r => OnCommandStatusClear(r.Source))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||||
|
|
@ -231,7 +231,7 @@ namespace MinecraftClient.ChatBots
|
||||||
"status" => Translations.bot_autoFish_help_status,
|
"status" => Translations.bot_autoFish_help_status,
|
||||||
"help" => Translations.bot_autoFish_help_help,
|
"help" => Translations.bot_autoFish_help_help,
|
||||||
_ => string.Format(Translations.bot_autoFish_available_cmd, "start, stop, status, help")
|
_ => string.Format(Translations.bot_autoFish_available_cmd, "start, stop, status, help")
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,13 +76,13 @@ namespace MinecraftClient.ChatBots
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("direction")
|
.Then(l => l.Literal("direction")
|
||||||
.Then(l => l.Literal("both")
|
.Then(l => l.Literal("both")
|
||||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Both)))
|
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Both)))
|
||||||
|
|
@ -92,7 +92,7 @@ namespace MinecraftClient.ChatBots
|
||||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Discord)))
|
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Discord)))
|
||||||
)
|
)
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
|
|
||||||
Task.Run(async () => await MainAsync());
|
Task.Run(async () => await MainAsync());
|
||||||
|
|
@ -100,8 +100,8 @@ namespace MinecraftClient.ChatBots
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
Disconnect();
|
Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
#pragma warning disable format // @formatter:off
|
#pragma warning disable format // @formatter:off
|
||||||
_ => "dscbridge direction <both|mc|discord>"
|
_ => "dscbridge direction <both|mc|discord>"
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,13 +90,13 @@ namespace MinecraftClient.ChatBots
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("stop")
|
.Then(l => l.Literal("stop")
|
||||||
.Executes(r => OnCommandStop(r.Source)))
|
.Executes(r => OnCommandStop(r.Source)))
|
||||||
.Then(l => l.Literal("start")
|
.Then(l => l.Literal("start")
|
||||||
|
|
@ -105,14 +105,14 @@ namespace MinecraftClient.ChatBots
|
||||||
.Then(l => l.Argument("OtherArgs", Arguments.GreedyString())
|
.Then(l => l.Argument("OtherArgs", Arguments.GreedyString())
|
||||||
.Executes(r => OnCommandStart(r.Source, MccArguments.GetFarmerCropType(r, "CropType"), Arguments.GetString(r, "OtherArgs"))))))
|
.Executes(r => OnCommandStart(r.Source, MccArguments.GetFarmerCropType(r, "CropType"), Arguments.GetString(r, "OtherArgs"))))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||||
|
|
@ -121,7 +121,7 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
#pragma warning disable format // @formatter:off
|
#pragma warning disable format // @formatter:off
|
||||||
_ => Translations.bot_farmer_desc + ": " + commandDescription
|
_ => Translations.bot_farmer_desc + ": " + commandDescription
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,13 +62,13 @@ namespace MinecraftClient.ChatBots
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("start")
|
.Then(l => l.Literal("start")
|
||||||
.Then(l => l.Argument("PlayerName", MccArguments.PlayerName())
|
.Then(l => l.Argument("PlayerName", MccArguments.PlayerName())
|
||||||
.Executes(r => OnCommandStart(r.Source, Arguments.GetString(r, "PlayerName"), takeRisk: false))
|
.Executes(r => OnCommandStart(r.Source, Arguments.GetString(r, "PlayerName"), takeRisk: false))
|
||||||
|
|
@ -77,14 +77,14 @@ namespace MinecraftClient.ChatBots
|
||||||
.Then(l => l.Literal("stop")
|
.Then(l => l.Literal("stop")
|
||||||
.Executes(r => OnCommandStop(r.Source)))
|
.Executes(r => OnCommandStop(r.Source)))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||||
|
|
@ -93,7 +93,7 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
#pragma warning disable format // @formatter:off
|
#pragma warning disable format // @formatter:off
|
||||||
_ => Translations.cmd_follow_desc + ": " + Translations.cmd_follow_usage
|
_ => Translations.cmd_follow_desc + ": " + Translations.cmd_follow_usage
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -257,12 +257,12 @@ namespace MinecraftClient.ChatBots
|
||||||
mailDbFileMonitor = new FileMonitor(Path.GetDirectoryName(Config.DatabaseFile)!, Path.GetFileName(Config.DatabaseFile), FileMonitorCallback);
|
mailDbFileMonitor = new FileMonitor(Path.GetDirectoryName(Config.DatabaseFile)!, Path.GetFileName(Config.DatabaseFile), FileMonitorCallback);
|
||||||
ignoreListFileMonitor = new FileMonitor(Path.GetDirectoryName(Config.IgnoreListFile)!, Path.GetFileName(Config.IgnoreListFile), FileMonitorCallback);
|
ignoreListFileMonitor = new FileMonitor(Path.GetDirectoryName(Config.IgnoreListFile)!, Path.GetFileName(Config.IgnoreListFile), FileMonitorCallback);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(string.Empty)))
|
.Executes(r => OnCommandHelp(string.Empty)))
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("getmails")
|
.Then(l => l.Literal("getmails")
|
||||||
.Executes(r => OnCommandGetMails()))
|
.Executes(r => OnCommandGetMails()))
|
||||||
.Then(l => l.Literal("getignored")
|
.Then(l => l.Literal("getignored")
|
||||||
|
|
@ -274,14 +274,14 @@ namespace MinecraftClient.ChatBots
|
||||||
.Then(l => l.Argument("username", Arguments.String())
|
.Then(l => l.Argument("username", Arguments.String())
|
||||||
.Executes(r => OnCommandRemoveIgnored(Arguments.GetString(r, "username")))))
|
.Executes(r => OnCommandRemoveIgnored(Arguments.GetString(r, "username")))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OnCommandHelp(string cmd)
|
private int OnCommandHelp(string cmd)
|
||||||
|
|
@ -290,7 +290,7 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
#pragma warning disable format // @formatter:off
|
#pragma warning disable format // @formatter:off
|
||||||
_ => Translations.bot_mailer_cmd_help + ": /mailer <getmails|addignored|getignored|removeignored>"
|
_ => Translations.bot_mailer_cmd_help + ": /mailer <getmails|addignored|getignored|removeignored>"
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -80,13 +80,13 @@ namespace MinecraftClient.ChatBots
|
||||||
|
|
||||||
DeleteRenderedMaps();
|
DeleteRenderedMaps();
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandList(r.Source))
|
.Executes(r => OnCommandList(r.Source))
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => OnCommandList(r.Source)))
|
.Executes(r => OnCommandList(r.Source)))
|
||||||
|
|
@ -94,14 +94,14 @@ namespace MinecraftClient.ChatBots
|
||||||
.Then(l => l.Argument("MapID", MccArguments.MapBotMapId())
|
.Then(l => l.Argument("MapID", MccArguments.MapBotMapId())
|
||||||
.Executes(r => OnCommandRender(r.Source, Arguments.GetInteger(r, "MapID")))))
|
.Executes(r => OnCommandRender(r.Source, Arguments.GetInteger(r, "MapID")))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
DeleteRenderedMaps();
|
DeleteRenderedMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
#pragma warning disable format // @formatter:off
|
#pragma warning disable format // @formatter:off
|
||||||
_ => Translations.error_usage + ": /maps <list/render <id>>"
|
_ => Translations.error_usage + ": /maps <list/render <id>>"
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,26 +46,26 @@ namespace MinecraftClient.ChatBots
|
||||||
replay.MetaData.serverName = GetServerHost() + GetServerPort();
|
replay.MetaData.serverName = GetServerHost() + GetServerPort();
|
||||||
backupCounter = Settings.DoubleToTick(Config.Backup_Interval);
|
backupCounter = Settings.DoubleToTick(Config.Backup_Interval);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("save")
|
.Then(l => l.Literal("save")
|
||||||
.Executes(r => OnCommandSave(r.Source)))
|
.Executes(r => OnCommandSave(r.Source)))
|
||||||
.Then(l => l.Literal("stop")
|
.Then(l => l.Literal("stop")
|
||||||
.Executes(r => OnCommandStop(r.Source)))
|
.Executes(r => OnCommandStop(r.Source)))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||||
|
|
@ -74,7 +74,7 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
#pragma warning disable format // @formatter:off
|
#pragma warning disable format // @formatter:off
|
||||||
_ => string.Format(Translations.general_available_cmd, "save, stop")
|
_ => string.Format(Translations.general_available_cmd, "save, stop")
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,13 +76,13 @@ namespace MinecraftClient.ChatBots
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Register(l => l.Literal("help")
|
McClient.dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CommandName)
|
.Then(l => l.Literal(CommandName)
|
||||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
McClient.dispatcher.Register(l => l.Literal(CommandName)
|
||||||
.Then(l => l.Literal("direction")
|
.Then(l => l.Literal("direction")
|
||||||
.Then(l => l.Literal("both")
|
.Then(l => l.Literal("both")
|
||||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Both)))
|
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Both)))
|
||||||
|
|
@ -91,7 +91,7 @@ namespace MinecraftClient.ChatBots
|
||||||
.Then(l => l.Literal("telegram")
|
.Then(l => l.Literal("telegram")
|
||||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Telegram))))
|
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Telegram))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
.Redirect(McClient.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||||
);
|
);
|
||||||
|
|
||||||
Task.Run(async () => await MainAsync());
|
Task.Run(async () => await MainAsync());
|
||||||
|
|
@ -99,8 +99,8 @@ namespace MinecraftClient.ChatBots
|
||||||
|
|
||||||
public override void OnUnload()
|
public override void OnUnload()
|
||||||
{
|
{
|
||||||
Handler.dispatcher.Unregister(CommandName);
|
McClient.dispatcher.Unregister(CommandName);
|
||||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
McClient.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||||
Disconnect();
|
Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ namespace MinecraftClient.ChatBots
|
||||||
{
|
{
|
||||||
#pragma warning disable format // @formatter:off
|
#pragma warning disable format // @formatter:off
|
||||||
_ => Translations.error_usage + ": /tgbridge direction <both|mc|telegram>"
|
_ => Translations.error_usage + ": /tgbridge direction <both|mc|telegram>"
|
||||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||||
#pragma warning restore format // @formatter:on
|
#pragma warning restore format // @formatter:on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace MinecraftClient
|
||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
string s = (string.IsNullOrEmpty(CmdUsage) || string.IsNullOrEmpty(CmdDesc)) ? string.Empty : ": "; // If either one is empty, no colon :
|
string s = (string.IsNullOrEmpty(CmdUsage) || string.IsNullOrEmpty(CmdDesc)) ? string.Empty : ": "; // If either one is empty, no colon :
|
||||||
sb.Append("§e").Append(cmdChar).Append(CmdUsage).Append("§r").Append(s).AppendLine(CmdDesc);
|
sb.Append("§e").Append(cmdChar).Append(CmdUsage).Append("§r").Append(s).AppendLine(CmdDesc);
|
||||||
sb.Append(CmdResult.client!.dispatcher.GetAllUsageString(CmdName, false));
|
sb.Append(McClient.dispatcher.GetAllUsageString(CmdName, false));
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace MinecraftClient
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register the command.
|
/// Register the command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher);
|
public abstract void RegisterCommand(CommandDispatcher<CmdResult> dispatcher);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if at least one argument has been passed to the command
|
/// Check if at least one argument has been passed to the command
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
||||||
|
|
||||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||||
{
|
{
|
||||||
McClient? client = CmdResult.client;
|
McClient? client = CmdResult.currentHandler;
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
var botList = client.GetLoadedChatBots();
|
var botList = client.GetLoadedChatBots();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
||||||
|
|
||||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||||
{
|
{
|
||||||
McClient? client = CmdResult.client;
|
McClient? client = CmdResult.currentHandler;
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Inventory.Container? inventory = client.GetInventory(0);
|
Inventory.Container? inventory = client.GetInventory(0);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
||||||
|
|
||||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||||
{
|
{
|
||||||
McClient? client = CmdResult.client;
|
McClient? client = CmdResult.currentHandler;
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
var invList = client.GetInventories();
|
var invList = client.GetInventories();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
||||||
|
|
||||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||||
{
|
{
|
||||||
McClient? client = CmdResult.client;
|
McClient? client = CmdResult.currentHandler;
|
||||||
if (client != null && context.Nodes.Count >= 2)
|
if (client != null && context.Nodes.Count >= 2)
|
||||||
{
|
{
|
||||||
string invName = context.Nodes[1].Range.Get(builder.Input);
|
string invName = context.Nodes[1].Range.Get(builder.Input);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
||||||
|
|
||||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||||
{
|
{
|
||||||
McClient? client = CmdResult.client;
|
McClient? client = CmdResult.currentHandler;
|
||||||
string[] args = builder.Remaining.Split(' ', StringSplitOptions.TrimEntries);
|
string[] args = builder.Remaining.Split(' ', StringSplitOptions.TrimEntries);
|
||||||
if (args.Length == 0 || (args.Length == 1 && string.IsNullOrWhiteSpace(args[0])))
|
if (args.Length == 0 || (args.Length == 1 && string.IsNullOrWhiteSpace(args[0])))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
||||||
|
|
||||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||||
{
|
{
|
||||||
McClient? client = CmdResult.client;
|
McClient? client = CmdResult.currentHandler;
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
var bot = (Map?)client.GetLoadedChatBots().Find(bot => bot.GetType().Name == "Map");
|
var bot = (Map?)client.GetLoadedChatBots().Find(bot => bot.GetType().Name == "Map");
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace MinecraftClient.CommandHandler.ArgumentType
|
||||||
|
|
||||||
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
public override Task<Suggestions> ListSuggestions<TSource>(CommandContext<TSource> context, SuggestionsBuilder builder)
|
||||||
{
|
{
|
||||||
McClient? client = CmdResult.client;
|
McClient? client = CmdResult.currentHandler;
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
var entityList = client.GetEntities().Values.ToList();
|
var entityList = client.GetEntities().Values.ToList();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ namespace MinecraftClient.CommandHandler
|
||||||
{
|
{
|
||||||
public static readonly CmdResult Empty = new();
|
public static readonly CmdResult Empty = new();
|
||||||
|
|
||||||
internal static McClient? client;
|
internal static McClient? currentHandler;
|
||||||
|
|
||||||
public enum Status
|
public enum Status
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "animation <mainhand|offhand>"; } }
|
public override string CmdUsage { get { return "animation <mainhand|offhand>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_animation_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_animation_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -23,11 +23,11 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => DoAnimation(r.Source, handler, mainhand: true))
|
.Executes(r => DoAnimation(r.Source, mainhand: true))
|
||||||
.Then(l => l.Literal("mainhand")
|
.Then(l => l.Literal("mainhand")
|
||||||
.Executes(r => DoAnimation(r.Source, handler, mainhand: true)))
|
.Executes(r => DoAnimation(r.Source, mainhand: true)))
|
||||||
.Then(l => l.Literal("offhand")
|
.Then(l => l.Literal("offhand")
|
||||||
.Executes(r => DoAnimation(r.Source, handler, mainhand: false)))
|
.Executes(r => DoAnimation(r.Source, mainhand: false)))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -45,8 +45,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int DoAnimation(CmdResult r, McClient handler, bool mainhand)
|
private static int DoAnimation(CmdResult r, bool mainhand)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
return r.SetAndReturn(handler.DoAnimation(mainhand ? 1 : 0));
|
return r.SetAndReturn(handler.DoAnimation(mainhand ? 1 : 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "bed leave|sleep <x> <y> <z>|sleep <radius>"; } }
|
public override string CmdUsage { get { return "bed leave|sleep <x> <y> <z>|sleep <radius>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_bed_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_bed_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -30,12 +30,12 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Literal("leave")
|
.Then(l => l.Literal("leave")
|
||||||
.Executes(r => DoLeaveBed(r.Source, handler)))
|
.Executes(r => DoLeaveBed(r.Source)))
|
||||||
.Then(l => l.Literal("sleep")
|
.Then(l => l.Literal("sleep")
|
||||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||||
.Executes(r => DoSleepBedWithLocation(r.Source, handler, MccArguments.GetLocation(r, "Location"))))
|
.Executes(r => DoSleepBedWithLocation(r.Source, MccArguments.GetLocation(r, "Location"))))
|
||||||
.Then(l => l.Argument("Radius", Arguments.Double())
|
.Then(l => l.Argument("Radius", Arguments.Double())
|
||||||
.Executes(r => DoSleepBedWithRadius(r.Source, handler, Arguments.GetDouble(r, "Radius")))))
|
.Executes(r => DoSleepBedWithRadius(r.Source, Arguments.GetDouble(r, "Radius")))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -53,13 +53,15 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int DoLeaveBed(CmdResult r, McClient handler)
|
private static int DoLeaveBed(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
return r.SetAndReturn(Translations.cmd_bed_leaving, handler.SendEntityAction(Protocol.EntityActionType.LeaveBed));
|
return r.SetAndReturn(Translations.cmd_bed_leaving, handler.SendEntityAction(Protocol.EntityActionType.LeaveBed));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int DoSleepBedWithRadius(CmdResult r, McClient handler, double radius)
|
private static int DoSleepBedWithRadius(CmdResult r, double radius)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -153,8 +155,9 @@ namespace MinecraftClient.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int DoSleepBedWithLocation(CmdResult r, McClient handler, Location block)
|
private static int DoSleepBedWithLocation(CmdResult r, Location block)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "blockinfo <x> <y> <z> [-s]"; } }
|
public override string CmdUsage { get { return "blockinfo <x> <y> <z> [-s]"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_blockinfo_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_blockinfo_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -24,13 +24,13 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => LogBlockInfo(r.Source, handler, handler.GetCurrentLocation(), false))
|
.Executes(r => LogBlockInfo(r.Source, null, false))
|
||||||
.Then(l => l.Literal("-s")
|
.Then(l => l.Literal("-s")
|
||||||
.Executes(r => LogBlockInfo(r.Source, handler, handler.GetCurrentLocation(), true)))
|
.Executes(r => LogBlockInfo(r.Source, null, true)))
|
||||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||||
.Executes(r => LogBlockInfo(r.Source, handler, MccArguments.GetLocation(r, "Location"), false))
|
.Executes(r => LogBlockInfo(r.Source, MccArguments.GetLocation(r, "Location"), false))
|
||||||
.Then(l => l.Literal("-s")
|
.Then(l => l.Literal("-s")
|
||||||
.Executes(r => LogBlockInfo(r.Source, handler, MccArguments.GetLocation(r, "Location"), true))))
|
.Executes(r => LogBlockInfo(r.Source, MccArguments.GetLocation(r, "Location"), true))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -47,13 +47,18 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int LogBlockInfo(CmdResult r, McClient handler, Location targetBlock, bool reportSurrounding)
|
private static int LogBlockInfo(CmdResult r, Location? targetBlock, bool reportSurrounding)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
targetBlock.ToAbsolute(handler.GetCurrentLocation());
|
if (targetBlock.HasValue)
|
||||||
Block block = handler.GetWorld().GetBlock(targetBlock);
|
targetBlock.Value.ToAbsolute(handler.GetCurrentLocation());
|
||||||
|
else
|
||||||
|
targetBlock = handler.GetCurrentLocation();
|
||||||
|
|
||||||
|
Block block = handler.GetWorld().GetBlock(targetBlock.Value);
|
||||||
|
|
||||||
handler.Log.Info($"{Translations.cmd_blockinfo_BlockType}: {block.GetTypeString()}");
|
handler.Log.Info($"{Translations.cmd_blockinfo_BlockType}: {block.GetTypeString()}");
|
||||||
if (reportSurrounding)
|
if (reportSurrounding)
|
||||||
|
|
@ -61,12 +66,13 @@ namespace MinecraftClient.Commands
|
||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
sb.AppendLine($"{Translations.cmd_blockinfo_BlocksAround}:");
|
sb.AppendLine($"{Translations.cmd_blockinfo_BlocksAround}:");
|
||||||
|
|
||||||
Block blockXPositive = handler.GetWorld().GetBlock(new Location(targetBlock.X + 1, targetBlock.Y, targetBlock.Z));
|
double X = targetBlock.Value.X, Y = targetBlock.Value.Y, Z = targetBlock.Value.Z;
|
||||||
Block blockXNegative = handler.GetWorld().GetBlock(new Location(targetBlock.X - 1, targetBlock.Y, targetBlock.Z));
|
Block blockXPositive = handler.GetWorld().GetBlock(new Location(X + 1, Y, Z));
|
||||||
Block blockYPositive = handler.GetWorld().GetBlock(new Location(targetBlock.X, targetBlock.Y + 1, targetBlock.Z));
|
Block blockXNegative = handler.GetWorld().GetBlock(new Location(X - 1, Y, Z));
|
||||||
Block blockYNegative = handler.GetWorld().GetBlock(new Location(targetBlock.X, targetBlock.Y - 1, targetBlock.Z));
|
Block blockYPositive = handler.GetWorld().GetBlock(new Location(X, Y + 1, Z));
|
||||||
Block blockZPositive = handler.GetWorld().GetBlock(new Location(targetBlock.X, targetBlock.Y, targetBlock.Z + 1));
|
Block blockYNegative = handler.GetWorld().GetBlock(new Location(X, Y - 1, Z));
|
||||||
Block blockZNegative = handler.GetWorld().GetBlock(new Location(targetBlock.X, targetBlock.Y, targetBlock.Z - 1));
|
Block blockZPositive = handler.GetWorld().GetBlock(new Location(X, Y, Z + 1));
|
||||||
|
Block blockZNegative = handler.GetWorld().GetBlock(new Location(X, Y, Z - 1));
|
||||||
|
|
||||||
sb.AppendLine($"[X {Translations.cmd_blockinfo_Positive}] {Translations.cmd_blockinfo_BlockType}: {blockXPositive.GetTypeString()}");
|
sb.AppendLine($"[X {Translations.cmd_blockinfo_Positive}] {Translations.cmd_blockinfo_BlockType}: {blockXPositive.GetTypeString()}");
|
||||||
sb.AppendLine($"[X {Translations.cmd_blockinfo_Negative}] {Translations.cmd_blockinfo_BlockType}: {blockXNegative.GetTypeString()}");
|
sb.AppendLine($"[X {Translations.cmd_blockinfo_Negative}] {Translations.cmd_blockinfo_BlockType}: {blockXNegative.GetTypeString()}");
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "bots [list|unload <bot name|all>]"; } }
|
public override string CmdUsage { get { return "bots [list|unload <bot name|all>]"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_bots_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_bots_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -26,12 +26,12 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => DoListBot(r.Source, handler))
|
.Executes(r => DoListBot(r.Source))
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => DoListBot(r.Source, handler)))
|
.Executes(r => DoListBot(r.Source)))
|
||||||
.Then(l => l.Literal("unload")
|
.Then(l => l.Literal("unload")
|
||||||
.Then(l => l.Argument("BotName", MccArguments.BotName())
|
.Then(l => l.Argument("BotName", MccArguments.BotName())
|
||||||
.Executes(r => DoUnloadBot(r.Source, handler, Arguments.GetString(r, "BotName")))))
|
.Executes(r => DoUnloadBot(r.Source, Arguments.GetString(r, "BotName")))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -49,8 +49,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoListBot(CmdResult r, McClient handler)
|
private int DoListBot(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
int length = handler.GetLoadedChatBots().Count;
|
int length = handler.GetLoadedChatBots().Count;
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
return r.SetAndReturn(CmdResult.Status.Fail, Translations.cmd_bots_noloaded);
|
return r.SetAndReturn(CmdResult.Status.Fail, Translations.cmd_bots_noloaded);
|
||||||
|
|
@ -66,8 +67,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_bots_list + ": " + sb.ToString());
|
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_bots_list + ": " + sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoUnloadBot(CmdResult r, McClient handler, string botName)
|
private int DoUnloadBot(CmdResult r, string botName)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (botName.ToLower().Equals("all", StringComparison.OrdinalIgnoreCase))
|
if (botName.ToLower().Equals("all", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
if (handler.GetLoadedChatBots().Count == 0)
|
if (handler.GetLoadedChatBots().Count == 0)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "changeslot <1-9>"; } }
|
public override string CmdUsage { get { return "changeslot <1-9>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_changeSlot_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_changeSlot_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -21,7 +21,7 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Argument("Slot", MccArguments.HotbarSlot())
|
.Then(l => l.Argument("Slot", MccArguments.HotbarSlot())
|
||||||
.Executes(r => DoChangeSlot(r.Source, handler, Arguments.GetInteger(r, "Slot"))))
|
.Executes(r => DoChangeSlot(r.Source, Arguments.GetInteger(r, "Slot"))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -37,8 +37,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoChangeSlot(CmdResult r, McClient handler, int slot)
|
private int DoChangeSlot(CmdResult r, int slot)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedInventory);
|
return r.SetAndReturn(Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "chunk status [chunkX chunkZ|locationX locationY locationZ]"; } }
|
public override string CmdUsage { get { return "chunk status [chunkX chunkZ|locationX locationY locationZ]"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_chunk_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_chunk_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -32,26 +32,26 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Literal("status")
|
.Then(l => l.Literal("status")
|
||||||
.Executes(r => LogChunkStatus(r.Source, handler))
|
.Executes(r => LogChunkStatus(r.Source))
|
||||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||||
.Executes(r => LogChunkStatus(r.Source, handler, pos: MccArguments.GetLocation(r, "Location"))))
|
.Executes(r => LogChunkStatus(r.Source, pos: MccArguments.GetLocation(r, "Location"))))
|
||||||
.Then(l => l.Argument("Chunk", MccArguments.Tuple())
|
.Then(l => l.Argument("Chunk", MccArguments.Tuple())
|
||||||
.Executes(r => LogChunkStatus(r.Source, handler, markedChunkPos: MccArguments.GetTuple(r, "Chunk")))))
|
.Executes(r => LogChunkStatus(r.Source, markedChunkPos: MccArguments.GetTuple(r, "Chunk")))))
|
||||||
.Then(l => l.Literal("_setloading")
|
.Then(l => l.Literal("_setloading")
|
||||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||||
.Executes(r => DebugSetLoading(r.Source, handler, pos: MccArguments.GetLocation(r, "Location"))))
|
.Executes(r => DebugSetLoading(r.Source, pos: MccArguments.GetLocation(r, "Location"))))
|
||||||
.Then(l => l.Argument("Chunk", MccArguments.Tuple())
|
.Then(l => l.Argument("Chunk", MccArguments.Tuple())
|
||||||
.Executes(r => DebugSetLoading(r.Source, handler, markedChunkPos: MccArguments.GetTuple(r, "Chunk")))))
|
.Executes(r => DebugSetLoading(r.Source, markedChunkPos: MccArguments.GetTuple(r, "Chunk")))))
|
||||||
.Then(l => l.Literal("_setloaded")
|
.Then(l => l.Literal("_setloaded")
|
||||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||||
.Executes(r => DebugSetLoaded(r.Source, handler, pos: MccArguments.GetLocation(r, "Location"))))
|
.Executes(r => DebugSetLoaded(r.Source, pos: MccArguments.GetLocation(r, "Location"))))
|
||||||
.Then(l => l.Argument("Chunk", MccArguments.Tuple())
|
.Then(l => l.Argument("Chunk", MccArguments.Tuple())
|
||||||
.Executes(r => DebugSetLoaded(r.Source, handler, markedChunkPos: MccArguments.GetTuple(r, "Chunk")))))
|
.Executes(r => DebugSetLoaded(r.Source, markedChunkPos: MccArguments.GetTuple(r, "Chunk")))))
|
||||||
.Then(l => l.Literal("_delete")
|
.Then(l => l.Literal("_delete")
|
||||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||||
.Executes(r => DebugDelete(r.Source, handler, pos: MccArguments.GetLocation(r, "Location"))))
|
.Executes(r => DebugDelete(r.Source, pos: MccArguments.GetLocation(r, "Location"))))
|
||||||
.Then(l => l.Argument("Chunk", MccArguments.Tuple())
|
.Then(l => l.Argument("Chunk", MccArguments.Tuple())
|
||||||
.Executes(r => DebugDelete(r.Source, handler, markedChunkPos: MccArguments.GetTuple(r, "Chunk")))))
|
.Executes(r => DebugDelete(r.Source, markedChunkPos: MccArguments.GetTuple(r, "Chunk")))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -71,8 +71,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int LogChunkStatus(CmdResult r, McClient handler, Location? pos = null, Tuple<int, int>? markedChunkPos = null)
|
private static int LogChunkStatus(CmdResult r, Location? pos = null, Tuple<int, int>? markedChunkPos = null)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -225,8 +226,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Done);
|
return r.SetAndReturn(Status.Done);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int DebugSetLoading(CmdResult r, McClient handler, Location? pos = null, Tuple<int, int>? markedChunkPos = null)
|
private static int DebugSetLoading(CmdResult r, Location? pos = null, Tuple<int, int>? markedChunkPos = null)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -244,8 +246,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Done, string.Format("Successfully marked chunk ({0}, {1}) as loading.", chunkX, chunkZ));
|
return r.SetAndReturn(Status.Done, string.Format("Successfully marked chunk ({0}, {1}) as loading.", chunkX, chunkZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int DebugSetLoaded(CmdResult r, McClient handler, Location? pos = null, Tuple<int, int>? markedChunkPos = null)
|
private static int DebugSetLoaded(CmdResult r, Location? pos = null, Tuple<int, int>? markedChunkPos = null)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -263,8 +266,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Done, string.Format("Successfully marked chunk ({0}, {1}) as loaded.", chunkX, chunkZ));
|
return r.SetAndReturn(Status.Done, string.Format("Successfully marked chunk ({0}, {1}) as loaded.", chunkX, chunkZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int DebugDelete(CmdResult r, McClient handler, Location? pos = null, Tuple<int, int>? markedChunkPos = null)
|
private static int DebugDelete(CmdResult r, Location? pos = null, Tuple<int, int>? markedChunkPos = null)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "connect <server> [account]"; } }
|
public override string CmdUsage { get { return "connect <server> [account]"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_connect_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_connect_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -21,9 +21,9 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Argument("ServerNick", MccArguments.ServerNick())
|
.Then(l => l.Argument("ServerNick", MccArguments.ServerNick())
|
||||||
.Executes(r => DoConnect(r.Source, handler, Arguments.GetString(r, "ServerNick"), string.Empty))
|
.Executes(r => DoConnect(r.Source, Arguments.GetString(r, "ServerNick"), string.Empty))
|
||||||
.Then(l => l.Argument("AccountNick", MccArguments.AccountNick())
|
.Then(l => l.Argument("AccountNick", MccArguments.AccountNick())
|
||||||
.Executes(r => DoConnect(r.Source, handler, Arguments.GetString(r, "ServerNick"), Arguments.GetString(r, "AccountNick")))))
|
.Executes(r => DoConnect(r.Source, Arguments.GetString(r, "ServerNick"), Arguments.GetString(r, "AccountNick")))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -39,7 +39,7 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoConnect(CmdResult r, McClient handler, string server, string account)
|
private int DoConnect(CmdResult r, string server, string account)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(account) && !Settings.Config.Main.Advanced.SetAccount(account))
|
if (!string.IsNullOrWhiteSpace(account) && !Settings.Config.Main.Advanced.SetAccount(account))
|
||||||
return r.SetAndReturn(Status.Fail, string.Format(Translations.cmd_connect_unknown, account));
|
return r.SetAndReturn(Status.Fail, string.Format(Translations.cmd_connect_unknown, account));
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "debug [on|off]"; } }
|
public override string CmdUsage { get { return "debug [on|off]"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_debug_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_debug_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "dig <x> <y> <z>"; } }
|
public override string CmdUsage { get { return "dig <x> <y> <z>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_dig_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_dig_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -22,9 +22,9 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => DigLookAt(r.Source, handler))
|
.Executes(r => DigLookAt(r.Source))
|
||||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||||
.Executes(r => DigAt(r.Source, handler, MccArguments.GetLocation(r, "Location"))))
|
.Executes(r => DigAt(r.Source, MccArguments.GetLocation(r, "Location"))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -40,8 +40,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DigAt(CmdResult r, McClient handler, Location blockToBreak)
|
private int DigAt(CmdResult r, Location blockToBreak)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -61,8 +62,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_fail);
|
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DigLookAt(CmdResult r, McClient handler)
|
private int DigLookAt(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "dropitem <itemtype>"; } }
|
public override string CmdUsage { get { return "dropitem <itemtype>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_dropItem_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_dropItem_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -24,7 +24,7 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Argument("ItemType", MccArguments.ItemType())
|
.Then(l => l.Argument("ItemType", MccArguments.ItemType())
|
||||||
.Executes(r => DoDropItem(r.Source, handler, MccArguments.GetItemType(r, "ItemType"))))
|
.Executes(r => DoDropItem(r.Source, MccArguments.GetItemType(r, "ItemType"))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -40,8 +40,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoDropItem(CmdResult r, McClient handler, ItemType itemType)
|
private int DoDropItem(CmdResult r, ItemType itemType)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "enchant <top|middle|bottom>"; } }
|
public override string CmdUsage { get { return "enchant <top|middle|bottom>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_enchant_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_enchant_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -28,11 +28,11 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Literal("top")
|
.Then(l => l.Literal("top")
|
||||||
.Executes(r => DoEnchant(r.Source, handler, slotId: 0)))
|
.Executes(r => DoEnchant(r.Source, slotId: 0)))
|
||||||
.Then(l => l.Literal("middle")
|
.Then(l => l.Literal("middle")
|
||||||
.Executes(r => DoEnchant(r.Source, handler, slotId: 1)))
|
.Executes(r => DoEnchant(r.Source, slotId: 1)))
|
||||||
.Then(l => l.Literal("bottom")
|
.Then(l => l.Literal("bottom")
|
||||||
.Executes(r => DoEnchant(r.Source, handler, slotId: 2)))
|
.Executes(r => DoEnchant(r.Source, slotId: 2)))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -51,8 +51,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoEnchant(CmdResult r, McClient handler, int slotId)
|
private int DoEnchant(CmdResult r, int slotId)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
Container? enchantingTable = null;
|
Container? enchantingTable = null;
|
||||||
|
|
||||||
foreach (var (id, container) in handler.GetInventories())
|
foreach (var (id, container) in handler.GetInventories())
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
private enum ActionType { Attack, Use, List };
|
private enum ActionType { Attack, Use, List };
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -36,41 +36,41 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => GetFullEntityList(r.Source, handler))
|
.Executes(r => GetFullEntityList(r.Source))
|
||||||
.Then(l => l.Literal("near")
|
.Then(l => l.Literal("near")
|
||||||
.Executes(r => GetClosetEntityList(r.Source, handler))
|
.Executes(r => GetClosetEntityList(r.Source))
|
||||||
.Then(l => l.Argument("EntityID", Arguments.Integer())
|
.Then(l => l.Argument("EntityID", Arguments.Integer())
|
||||||
.Executes(r => OperateWithId(r.Source, handler, Arguments.GetInteger(r, "EntityID"), ActionType.List))
|
.Executes(r => OperateWithId(r.Source, Arguments.GetInteger(r, "EntityID"), ActionType.List))
|
||||||
.Then(l => l.Literal("attack")
|
.Then(l => l.Literal("attack")
|
||||||
.Executes(r => OperateWithId(r.Source, handler, Arguments.GetInteger(r, "EntityID"), ActionType.Attack)))
|
.Executes(r => OperateWithId(r.Source, Arguments.GetInteger(r, "EntityID"), ActionType.Attack)))
|
||||||
.Then(l => l.Literal("use")
|
.Then(l => l.Literal("use")
|
||||||
.Executes(r => OperateWithId(r.Source, handler, Arguments.GetInteger(r, "EntityID"), ActionType.Use)))
|
.Executes(r => OperateWithId(r.Source, Arguments.GetInteger(r, "EntityID"), ActionType.Use)))
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => OperateWithId(r.Source, handler, Arguments.GetInteger(r, "EntityID"), ActionType.List))))
|
.Executes(r => OperateWithId(r.Source, Arguments.GetInteger(r, "EntityID"), ActionType.List))))
|
||||||
.Then(l => l.Argument("EntityType", MccArguments.EntityType())
|
.Then(l => l.Argument("EntityType", MccArguments.EntityType())
|
||||||
.Executes(r => OperateWithType(r.Source, handler, true, MccArguments.GetEntityType(r, "EntityType"), ActionType.List))
|
.Executes(r => OperateWithType(r.Source, true, MccArguments.GetEntityType(r, "EntityType"), ActionType.List))
|
||||||
.Then(l => l.Literal("attack")
|
.Then(l => l.Literal("attack")
|
||||||
.Executes(r => OperateWithType(r.Source, handler, near: true, MccArguments.GetEntityType(r, "EntityType"), ActionType.Attack)))
|
.Executes(r => OperateWithType(r.Source, near: true, MccArguments.GetEntityType(r, "EntityType"), ActionType.Attack)))
|
||||||
.Then(l => l.Literal("use")
|
.Then(l => l.Literal("use")
|
||||||
.Executes(r => OperateWithType(r.Source, handler, near: true, MccArguments.GetEntityType(r, "EntityType"), ActionType.Use)))
|
.Executes(r => OperateWithType(r.Source, near: true, MccArguments.GetEntityType(r, "EntityType"), ActionType.Use)))
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => OperateWithType(r.Source, handler, near: true, MccArguments.GetEntityType(r, "EntityType"), ActionType.List)))))
|
.Executes(r => OperateWithType(r.Source, near: true, MccArguments.GetEntityType(r, "EntityType"), ActionType.List)))))
|
||||||
.Then(l => l.Argument("EntityID", Arguments.Integer())
|
.Then(l => l.Argument("EntityID", Arguments.Integer())
|
||||||
.Executes(r => OperateWithId(r.Source, handler, Arguments.GetInteger(r, "EntityID"), ActionType.List))
|
.Executes(r => OperateWithId(r.Source, Arguments.GetInteger(r, "EntityID"), ActionType.List))
|
||||||
.Then(l => l.Literal("attack")
|
.Then(l => l.Literal("attack")
|
||||||
.Executes(r => OperateWithId(r.Source, handler, Arguments.GetInteger(r, "EntityID"), ActionType.Attack)))
|
.Executes(r => OperateWithId(r.Source, Arguments.GetInteger(r, "EntityID"), ActionType.Attack)))
|
||||||
.Then(l => l.Literal("use")
|
.Then(l => l.Literal("use")
|
||||||
.Executes(r => OperateWithId(r.Source, handler, Arguments.GetInteger(r, "EntityID"), ActionType.Use)))
|
.Executes(r => OperateWithId(r.Source, Arguments.GetInteger(r, "EntityID"), ActionType.Use)))
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => OperateWithId(r.Source, handler, Arguments.GetInteger(r, "EntityID"), ActionType.List))))
|
.Executes(r => OperateWithId(r.Source, Arguments.GetInteger(r, "EntityID"), ActionType.List))))
|
||||||
.Then(l => l.Argument("EntityType", MccArguments.EntityType())
|
.Then(l => l.Argument("EntityType", MccArguments.EntityType())
|
||||||
.Executes(r => OperateWithType(r.Source, handler, true, MccArguments.GetEntityType(r, "EntityType"), ActionType.List))
|
.Executes(r => OperateWithType(r.Source, true, MccArguments.GetEntityType(r, "EntityType"), ActionType.List))
|
||||||
.Then(l => l.Literal("attack")
|
.Then(l => l.Literal("attack")
|
||||||
.Executes(r => OperateWithType(r.Source, handler, near: false, MccArguments.GetEntityType(r, "EntityType"), ActionType.Attack)))
|
.Executes(r => OperateWithType(r.Source, near: false, MccArguments.GetEntityType(r, "EntityType"), ActionType.Attack)))
|
||||||
.Then(l => l.Literal("use")
|
.Then(l => l.Literal("use")
|
||||||
.Executes(r => OperateWithType(r.Source, handler, near: false, MccArguments.GetEntityType(r, "EntityType"), ActionType.Use)))
|
.Executes(r => OperateWithType(r.Source, near: false, MccArguments.GetEntityType(r, "EntityType"), ActionType.Use)))
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => OperateWithType(r.Source, handler, near: false, MccArguments.GetEntityType(r, "EntityType"), ActionType.List))))
|
.Executes(r => OperateWithType(r.Source, near: false, MccArguments.GetEntityType(r, "EntityType"), ActionType.List))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -90,8 +90,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetFullEntityList(CmdResult r, McClient handler)
|
private int GetFullEntityList(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetEntityHandlingEnabled())
|
if (!handler.GetEntityHandlingEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedEntity);
|
return r.SetAndReturn(Status.FailNeedEntity);
|
||||||
|
|
||||||
|
|
@ -106,8 +107,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Done);
|
return r.SetAndReturn(Status.Done);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetClosetEntityList(CmdResult r, McClient handler)
|
private int GetClosetEntityList(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetEntityHandlingEnabled())
|
if (!handler.GetEntityHandlingEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedEntity);
|
return r.SetAndReturn(Status.FailNeedEntity);
|
||||||
|
|
||||||
|
|
@ -120,8 +122,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Fail, Translations.cmd_entityCmd_not_found);
|
return r.SetAndReturn(Status.Fail, Translations.cmd_entityCmd_not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OperateWithId(CmdResult r, McClient handler, int entityID, ActionType action)
|
private int OperateWithId(CmdResult r, int entityID, ActionType action)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetEntityHandlingEnabled())
|
if (!handler.GetEntityHandlingEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedEntity);
|
return r.SetAndReturn(Status.FailNeedEntity);
|
||||||
|
|
||||||
|
|
@ -134,8 +137,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Fail, Translations.cmd_entityCmd_not_found);
|
return r.SetAndReturn(Status.Fail, Translations.cmd_entityCmd_not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int OperateWithType(CmdResult r, McClient handler, bool near, EntityType entityType, ActionType action)
|
private int OperateWithType(CmdResult r, bool near, EntityType entityType, ActionType action)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetEntityHandlingEnabled())
|
if (!handler.GetEntityHandlingEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedEntity);
|
return r.SetAndReturn(Status.FailNeedEntity);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "execif \"<condition/expression>\" \"<command>\""; } }
|
public override string CmdUsage { get { return "execif \"<condition/expression>\" \"<command>\""; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_execif_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_execif_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -24,7 +24,7 @@ namespace MinecraftClient.Commands
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Argument("Condition", Arguments.String())
|
.Then(l => l.Argument("Condition", Arguments.String())
|
||||||
.Then(l => l.Argument("Command", Arguments.String())
|
.Then(l => l.Argument("Command", Arguments.String())
|
||||||
.Executes(r => HandleCommand(r.Source, handler, Arguments.GetString(r, "Condition"), Arguments.GetString(r, "Command")))))
|
.Executes(r => HandleCommand(r.Source, Arguments.GetString(r, "Condition"), Arguments.GetString(r, "Command")))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,8 +38,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int HandleCommand(CmdResult r, McClient handler, string expressionText, string resultCommand)
|
private int HandleCommand(CmdResult r, string expressionText, string resultCommand)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var interpreter = new Interpreter();
|
var interpreter = new Interpreter();
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "execmulti <command 1> -> <command2> -> <command 3> -> ..."; } }
|
public override string CmdUsage { get { return "execmulti <command 1> -> <command2> -> <command 3> -> ..."; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_execmulti_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_execmulti_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -23,7 +23,7 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Argument("Commands", Arguments.GreedyString())
|
.Then(l => l.Argument("Commands", Arguments.GreedyString())
|
||||||
.Executes(r => HandleCommand(r.Source, handler, Arguments.GetString(r, "Commands"))))
|
.Executes(r => HandleCommand(r.Source, Arguments.GetString(r, "Commands"))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,8 +37,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int HandleCommand(CmdResult r, McClient handler, string commandsString)
|
private int HandleCommand(CmdResult r, string commandsString)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (commandsString.Contains("execmulti", StringComparison.OrdinalIgnoreCase) || commandsString.Contains("execif", StringComparison.OrdinalIgnoreCase))
|
if (commandsString.Contains("execmulti", StringComparison.OrdinalIgnoreCase) || commandsString.Contains("execif", StringComparison.OrdinalIgnoreCase))
|
||||||
return r.SetAndReturn(CmdResult.Status.Fail, Translations.cmd_execmulti_prevent);
|
return r.SetAndReturn(CmdResult.Status.Fail, Translations.cmd_execmulti_prevent);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "exit"; } }
|
public override string CmdUsage { get { return "exit"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_exit_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_exit_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "health"; } }
|
public override string CmdUsage { get { return "health"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_health_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_health_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -19,7 +19,7 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => LogHealth(r.Source, handler))
|
.Executes(r => LogHealth(r.Source))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -35,8 +35,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int LogHealth(CmdResult r, McClient handler)
|
private int LogHealth(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
return r.SetAndReturn(CmdResult.Status.Done, string.Format(Translations.cmd_health_response, handler.GetHealth(), handler.GetSaturation(), handler.GetLevel(), handler.GetTotalExperience()));
|
return r.SetAndReturn(CmdResult.Status.Done, string.Format(Translations.cmd_health_response, handler.GetHealth(), handler.GetSaturation(), handler.GetLevel(), handler.GetTotalExperience()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,17 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdDesc => throw new NotImplementedException();
|
public override string CmdDesc => throw new NotImplementedException();
|
||||||
public override string CmdUsage => throw new NotImplementedException();
|
public override string CmdUsage => throw new NotImplementedException();
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l =>
|
dispatcher.Register(l =>
|
||||||
l.Literal("help")
|
l.Literal("help")
|
||||||
.Executes(r => LogHelp(r.Source, handler, dispatcher))
|
.Executes(r => LogHelp(r.Source, dispatcher))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int LogHelp(CmdResult r, McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
private int LogHelp(CmdResult r, CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
var usage = dispatcher.GetSmartUsage(dispatcher.GetRoot(), CmdResult.Empty);
|
var usage = dispatcher.GetSmartUsage(dispatcher.GetRoot(), CmdResult.Empty);
|
||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
foreach (var item in usage)
|
foreach (var item in usage)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return GetBasicUsage(); } }
|
public override string CmdUsage { get { return GetBasicUsage(); } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_inventory_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_inventory_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -42,65 +42,65 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => ListAllInventories(r.Source, handler))
|
.Executes(r => ListAllInventories(r.Source))
|
||||||
.Then(l => l.Literal("creativegive")
|
.Then(l => l.Literal("creativegive")
|
||||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||||
.Then(l => l.Argument("ItemType", MccArguments.ItemType())
|
.Then(l => l.Argument("ItemType", MccArguments.ItemType())
|
||||||
.Then(l => l.Argument("Count", Arguments.Integer(min: 1))
|
.Then(l => l.Argument("Count", Arguments.Integer(min: 1))
|
||||||
.Executes(r => DoCreativeGive(r.Source, handler, Arguments.GetInteger(r, "Slot"), MccArguments.GetItemType(r, "ItemType"), Arguments.GetInteger(r, "Count")))))))
|
.Executes(r => DoCreativeGive(r.Source, Arguments.GetInteger(r, "Slot"), MccArguments.GetItemType(r, "ItemType"), Arguments.GetInteger(r, "Count")))))))
|
||||||
.Then(l => l.Literal("creativedelete")
|
.Then(l => l.Literal("creativedelete")
|
||||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||||
.Executes(r => DoCreativeDelete(r.Source, handler, Arguments.GetInteger(r, "Slot")))))
|
.Executes(r => DoCreativeDelete(r.Source, Arguments.GetInteger(r, "Slot")))))
|
||||||
.Then(l => l.Literal("inventories")
|
.Then(l => l.Literal("inventories")
|
||||||
.Executes(r => ListAvailableInventories(r.Source, handler)))
|
.Executes(r => ListAvailableInventories(r.Source)))
|
||||||
.Then(l => l.Literal("search")
|
.Then(l => l.Literal("search")
|
||||||
.Then(l => l.Argument("ItemType", MccArguments.ItemType())
|
.Then(l => l.Argument("ItemType", MccArguments.ItemType())
|
||||||
.Executes(r => SearchItem(r.Source, handler, MccArguments.GetItemType(r, "ItemType"), null))
|
.Executes(r => SearchItem(r.Source, MccArguments.GetItemType(r, "ItemType"), null))
|
||||||
.Then(l => l.Argument("Count", Arguments.Integer(0, 64))
|
.Then(l => l.Argument("Count", Arguments.Integer(0, 64))
|
||||||
.Executes(r => SearchItem(r.Source, handler, MccArguments.GetItemType(r, "ItemType"), Arguments.GetInteger(r, "Count"))))))
|
.Executes(r => SearchItem(r.Source, MccArguments.GetItemType(r, "ItemType"), Arguments.GetInteger(r, "Count"))))))
|
||||||
.Then(l => l.Argument("InventoryId", MccArguments.InventoryId())
|
.Then(l => l.Argument("InventoryId", MccArguments.InventoryId())
|
||||||
.Then(l => l.Literal("close")
|
.Then(l => l.Literal("close")
|
||||||
.Executes(r => DoCloseAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"))))
|
.Executes(r => DoCloseAction(r.Source, Arguments.GetInteger(r, "InventoryId"))))
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => DoListAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"))))
|
.Executes(r => DoListAction(r.Source, Arguments.GetInteger(r, "InventoryId"))))
|
||||||
.Then(l => l.Literal("click")
|
.Then(l => l.Literal("click")
|
||||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||||
.Executes(r => DoClickAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), WindowActionType.LeftClick))
|
.Executes(r => DoClickAction(r.Source, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), WindowActionType.LeftClick))
|
||||||
.Then(l => l.Argument("Action", MccArguments.InventoryAction())
|
.Then(l => l.Argument("Action", MccArguments.InventoryAction())
|
||||||
.Executes(r => DoClickAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), MccArguments.GetInventoryAction(r, "Action"))))))
|
.Executes(r => DoClickAction(r.Source, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), MccArguments.GetInventoryAction(r, "Action"))))))
|
||||||
.Then(l => l.Literal("drop")
|
.Then(l => l.Literal("drop")
|
||||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||||
.Executes(r => DoDropAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), WindowActionType.DropItem))
|
.Executes(r => DoDropAction(r.Source, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), WindowActionType.DropItem))
|
||||||
.Then(l => l.Literal("all")
|
.Then(l => l.Literal("all")
|
||||||
.Executes(r => DoDropAction(r.Source, handler, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), WindowActionType.DropItemStack))))))
|
.Executes(r => DoDropAction(r.Source, Arguments.GetInteger(r, "InventoryId"), Arguments.GetInteger(r, "Slot"), WindowActionType.DropItemStack))))))
|
||||||
.Then(l => l.Literal("player")
|
.Then(l => l.Literal("player")
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => DoListAction(r.Source, handler, inventoryId: 0)))
|
.Executes(r => DoListAction(r.Source, inventoryId: 0)))
|
||||||
.Then(l => l.Literal("click")
|
.Then(l => l.Literal("click")
|
||||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||||
.Executes(r => DoClickAction(r.Source, handler, inventoryId: 0, Arguments.GetInteger(r, "Slot"), WindowActionType.LeftClick))
|
.Executes(r => DoClickAction(r.Source, inventoryId: 0, Arguments.GetInteger(r, "Slot"), WindowActionType.LeftClick))
|
||||||
.Then(l => l.Argument("Action", MccArguments.InventoryAction())
|
.Then(l => l.Argument("Action", MccArguments.InventoryAction())
|
||||||
.Executes(r => DoClickAction(r.Source, handler, inventoryId: 0, Arguments.GetInteger(r, "Slot"), MccArguments.GetInventoryAction(r, "Action"))))))
|
.Executes(r => DoClickAction(r.Source, inventoryId: 0, Arguments.GetInteger(r, "Slot"), MccArguments.GetInventoryAction(r, "Action"))))))
|
||||||
.Then(l => l.Literal("drop")
|
.Then(l => l.Literal("drop")
|
||||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||||
.Executes(r => DoDropAction(r.Source, handler, inventoryId: 0, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItem))
|
.Executes(r => DoDropAction(r.Source, inventoryId: 0, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItem))
|
||||||
.Then(l => l.Literal("all")
|
.Then(l => l.Literal("all")
|
||||||
.Executes(r => DoDropAction(r.Source, handler, inventoryId: 0, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItemStack))))))
|
.Executes(r => DoDropAction(r.Source, inventoryId: 0, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItemStack))))))
|
||||||
.Then(l => l.Literal("container")
|
.Then(l => l.Literal("container")
|
||||||
.Then(l => l.Literal("close")
|
.Then(l => l.Literal("close")
|
||||||
.Executes(r => DoCloseAction(r.Source, handler, inventoryId: null)))
|
.Executes(r => DoCloseAction(r.Source, inventoryId: null)))
|
||||||
.Then(l => l.Literal("list")
|
.Then(l => l.Literal("list")
|
||||||
.Executes(r => DoListAction(r.Source, handler, inventoryId: null)))
|
.Executes(r => DoListAction(r.Source, inventoryId: null)))
|
||||||
.Then(l => l.Literal("click")
|
.Then(l => l.Literal("click")
|
||||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||||
.Executes(r => DoClickAction(r.Source, handler, inventoryId: null, Arguments.GetInteger(r, "Slot"), WindowActionType.LeftClick))
|
.Executes(r => DoClickAction(r.Source, inventoryId: null, Arguments.GetInteger(r, "Slot"), WindowActionType.LeftClick))
|
||||||
.Then(l => l.Argument("Action", MccArguments.InventoryAction())
|
.Then(l => l.Argument("Action", MccArguments.InventoryAction())
|
||||||
.Executes(r => DoClickAction(r.Source, handler, inventoryId: null, Arguments.GetInteger(r, "Slot"), MccArguments.GetInventoryAction(r, "Action"))))))
|
.Executes(r => DoClickAction(r.Source, inventoryId: null, Arguments.GetInteger(r, "Slot"), MccArguments.GetInventoryAction(r, "Action"))))))
|
||||||
.Then(l => l.Literal("drop")
|
.Then(l => l.Literal("drop")
|
||||||
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
.Then(l => l.Argument("Slot", MccArguments.InventorySlot())
|
||||||
.Executes(r => DoDropAction(r.Source, handler, inventoryId: null, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItem))
|
.Executes(r => DoDropAction(r.Source, inventoryId: null, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItem))
|
||||||
.Then(l => l.Literal("all")
|
.Then(l => l.Literal("all")
|
||||||
.Executes(r => DoDropAction(r.Source, handler, inventoryId: null, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItemStack))))))
|
.Executes(r => DoDropAction(r.Source, inventoryId: null, Arguments.GetInteger(r, "Slot"), WindowActionType.DropItemStack))))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -133,8 +133,9 @@ namespace MinecraftClient.Commands
|
||||||
return availableIds.Max(); // use foreground container
|
return availableIds.Max(); // use foreground container
|
||||||
}
|
}
|
||||||
|
|
||||||
private int ListAllInventories(CmdResult r, McClient handler)
|
private int ListAllInventories(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
{
|
{
|
||||||
handler.Log.Info(Translations.extra_inventory_required);
|
handler.Log.Info(Translations.extra_inventory_required);
|
||||||
|
|
@ -149,8 +150,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(CmdResult.Status.Done);
|
return r.SetAndReturn(CmdResult.Status.Done);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoCreativeGive(CmdResult r, McClient handler, int slot, ItemType itemType, int count)
|
private int DoCreativeGive(CmdResult r, int slot, ItemType itemType, int count)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
@ -167,8 +169,9 @@ namespace MinecraftClient.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoCreativeDelete(CmdResult r, McClient handler, int slot)
|
private int DoCreativeDelete(CmdResult r, int slot)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
@ -185,8 +188,9 @@ namespace MinecraftClient.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int ListAvailableInventories(CmdResult r, McClient handler)
|
private int ListAvailableInventories(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
@ -202,8 +206,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(CmdResult.Status.Done);
|
return r.SetAndReturn(CmdResult.Status.Done);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int SearchItem(CmdResult r, McClient handler, ItemType itemType, int? itemCount)
|
private int SearchItem(CmdResult r, ItemType itemType, int? itemCount)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
@ -256,8 +261,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(CmdResult.Status.Done);
|
return r.SetAndReturn(CmdResult.Status.Done);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoCloseAction(CmdResult r, McClient handler, int? inventoryId)
|
private int DoCloseAction(CmdResult r, int? inventoryId)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
@ -278,8 +284,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(CmdResult.Status.Fail, string.Format(Translations.cmd_inventory_close_fail, inventoryId));
|
return r.SetAndReturn(CmdResult.Status.Fail, string.Format(Translations.cmd_inventory_close_fail, inventoryId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoListAction(CmdResult r, McClient handler, int? inventoryId)
|
private int DoListAction(CmdResult r, int? inventoryId)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
@ -320,8 +327,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(CmdResult.Status.Done);
|
return r.SetAndReturn(CmdResult.Status.Done);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoClickAction(CmdResult r, McClient handler, int? inventoryId, int slot, WindowActionType actionType)
|
private int DoClickAction(CmdResult r, int? inventoryId, int slot, WindowActionType actionType)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
@ -349,8 +357,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(handler.DoWindowAction(inventoryId.Value, slot, actionType));
|
return r.SetAndReturn(handler.DoWindowAction(inventoryId.Value, slot, actionType));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoDropAction(CmdResult r, McClient handler, int? inventoryId, int slot, WindowActionType actionType)
|
private int DoDropAction(CmdResult r, int? inventoryId, int slot, WindowActionType actionType)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
return r.SetAndReturn(CmdResult.Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "list"; } }
|
public override string CmdUsage { get { return "list"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_list_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_list_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -20,7 +20,7 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => DoListPlayers(r.Source, handler))
|
.Executes(r => DoListPlayers(r.Source))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -36,8 +36,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoListPlayers(CmdResult r, McClient handler)
|
private int DoListPlayers(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
return r.SetAndReturn(CmdResult.Status.Done, string.Format(Translations.cmd_list_players, String.Join(", ", handler.GetOnlinePlayers())));
|
return r.SetAndReturn(CmdResult.Status.Done, string.Format(Translations.cmd_list_players, String.Join(", ", handler.GetOnlinePlayers())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "log <text>"; } }
|
public override string CmdUsage { get { return "log <text>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_log_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_log_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "look <x y z|yaw pitch|up|down|east|west|north|south>"; } }
|
public override string CmdUsage { get { return "look <x y z|yaw pitch|up|down|east|west|north|south>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_look_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_look_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -28,24 +28,24 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => LogCurrentLooking(r.Source, handler))
|
.Executes(r => LogCurrentLooking(r.Source))
|
||||||
.Then(l => l.Literal("up")
|
.Then(l => l.Literal("up")
|
||||||
.Executes(r => LookAtDirection(r.Source, handler, Direction.Up)))
|
.Executes(r => LookAtDirection(r.Source, Direction.Up)))
|
||||||
.Then(l => l.Literal("down")
|
.Then(l => l.Literal("down")
|
||||||
.Executes(r => LookAtDirection(r.Source, handler, Direction.Down)))
|
.Executes(r => LookAtDirection(r.Source, Direction.Down)))
|
||||||
.Then(l => l.Literal("east")
|
.Then(l => l.Literal("east")
|
||||||
.Executes(r => LookAtDirection(r.Source, handler, Direction.East)))
|
.Executes(r => LookAtDirection(r.Source, Direction.East)))
|
||||||
.Then(l => l.Literal("west")
|
.Then(l => l.Literal("west")
|
||||||
.Executes(r => LookAtDirection(r.Source, handler, Direction.West)))
|
.Executes(r => LookAtDirection(r.Source, Direction.West)))
|
||||||
.Then(l => l.Literal("north")
|
.Then(l => l.Literal("north")
|
||||||
.Executes(r => LookAtDirection(r.Source, handler, Direction.North)))
|
.Executes(r => LookAtDirection(r.Source, Direction.North)))
|
||||||
.Then(l => l.Literal("south")
|
.Then(l => l.Literal("south")
|
||||||
.Executes(r => LookAtDirection(r.Source, handler, Direction.South)))
|
.Executes(r => LookAtDirection(r.Source, Direction.South)))
|
||||||
.Then(l => l.Argument("Yaw", Arguments.Float())
|
.Then(l => l.Argument("Yaw", Arguments.Float())
|
||||||
.Then(l => l.Argument("Pitch", Arguments.Float())
|
.Then(l => l.Argument("Pitch", Arguments.Float())
|
||||||
.Executes(r => LookAtAngle(r.Source, handler, Arguments.GetFloat(r, "Yaw"), Arguments.GetFloat(r, "Pitch")))))
|
.Executes(r => LookAtAngle(r.Source, Arguments.GetFloat(r, "Yaw"), Arguments.GetFloat(r, "Pitch")))))
|
||||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||||
.Executes(r => LookAtLocation(r.Source, handler, MccArguments.GetLocation(r, "Location"))))
|
.Executes(r => LookAtLocation(r.Source, MccArguments.GetLocation(r, "Location"))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -64,8 +64,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int LogCurrentLooking(CmdResult r, McClient handler)
|
private int LogCurrentLooking(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -83,8 +84,9 @@ namespace MinecraftClient.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int LookAtDirection(CmdResult r, McClient handler, Direction direction)
|
private int LookAtDirection(CmdResult r, Direction direction)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -92,8 +94,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Done, "Looking " + direction.ToString());
|
return r.SetAndReturn(Status.Done, "Looking " + direction.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int LookAtAngle(CmdResult r, McClient handler, float yaw, float pitch)
|
private int LookAtAngle(CmdResult r, float yaw, float pitch)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -101,8 +104,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_look_at, yaw.ToString("0.00"), pitch.ToString("0.00")));
|
return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_look_at, yaw.ToString("0.00"), pitch.ToString("0.00")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int LookAtLocation(CmdResult r, McClient handler, Location location)
|
private int LookAtLocation(CmdResult r, Location location)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "move <on|off|get|up|down|east|west|north|south|center|x y z|gravity [on|off]> [-f]"; } }
|
public override string CmdUsage { get { return "move <on|off|get|up|down|east|west|north|south|center|x y z|gravity [on|off]> [-f]"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_move_desc + " \"-f\": " + Translations.cmd_move_desc_force; } }
|
public override string CmdDesc { get { return Translations.cmd_move_desc + " \"-f\": " + Translations.cmd_move_desc_force; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -37,47 +37,47 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Literal("on")
|
.Then(l => l.Literal("on")
|
||||||
.Executes(r => SetMovementEnable(r.Source, handler, enable: true)))
|
.Executes(r => SetMovementEnable(r.Source, enable: true)))
|
||||||
.Then(l => l.Literal("off")
|
.Then(l => l.Literal("off")
|
||||||
.Executes(r => SetMovementEnable(r.Source, handler, enable: false)))
|
.Executes(r => SetMovementEnable(r.Source, enable: false)))
|
||||||
.Then(l => l.Literal("gravity")
|
.Then(l => l.Literal("gravity")
|
||||||
.Executes(r => SetGravityEnable(r.Source, handler, enable: null))
|
.Executes(r => SetGravityEnable(r.Source, enable: null))
|
||||||
.Then(l => l.Literal("on")
|
.Then(l => l.Literal("on")
|
||||||
.Executes(r => SetGravityEnable(r.Source, handler, enable: true)))
|
.Executes(r => SetGravityEnable(r.Source, enable: true)))
|
||||||
.Then(l => l.Literal("off")
|
.Then(l => l.Literal("off")
|
||||||
.Executes(r => SetGravityEnable(r.Source, handler, enable: false))))
|
.Executes(r => SetGravityEnable(r.Source, enable: false))))
|
||||||
.Then(l => l.Literal("up")
|
.Then(l => l.Literal("up")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.Up, false))
|
.Executes(r => MoveOnDirection(r.Source, Direction.Up, false))
|
||||||
.Then(l => l.Literal("-f")
|
.Then(l => l.Literal("-f")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.Up, true))))
|
.Executes(r => MoveOnDirection(r.Source, Direction.Up, true))))
|
||||||
.Then(l => l.Literal("down")
|
.Then(l => l.Literal("down")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.Down, false))
|
.Executes(r => MoveOnDirection(r.Source, Direction.Down, false))
|
||||||
.Then(l => l.Literal("-f")
|
.Then(l => l.Literal("-f")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.Down, true))))
|
.Executes(r => MoveOnDirection(r.Source, Direction.Down, true))))
|
||||||
.Then(l => l.Literal("east")
|
.Then(l => l.Literal("east")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.East, false))
|
.Executes(r => MoveOnDirection(r.Source, Direction.East, false))
|
||||||
.Then(l => l.Literal("-f")
|
.Then(l => l.Literal("-f")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.East, true))))
|
.Executes(r => MoveOnDirection(r.Source, Direction.East, true))))
|
||||||
.Then(l => l.Literal("west")
|
.Then(l => l.Literal("west")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.West, false))
|
.Executes(r => MoveOnDirection(r.Source, Direction.West, false))
|
||||||
.Then(l => l.Literal("-f")
|
.Then(l => l.Literal("-f")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.West, true))))
|
.Executes(r => MoveOnDirection(r.Source, Direction.West, true))))
|
||||||
.Then(l => l.Literal("north")
|
.Then(l => l.Literal("north")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.North, false))
|
.Executes(r => MoveOnDirection(r.Source, Direction.North, false))
|
||||||
.Then(l => l.Literal("-f")
|
.Then(l => l.Literal("-f")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.North, true))))
|
.Executes(r => MoveOnDirection(r.Source, Direction.North, true))))
|
||||||
.Then(l => l.Literal("south")
|
.Then(l => l.Literal("south")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.South, false))
|
.Executes(r => MoveOnDirection(r.Source, Direction.South, false))
|
||||||
.Then(l => l.Literal("-f")
|
.Then(l => l.Literal("-f")
|
||||||
.Executes(r => MoveOnDirection(r.Source, handler, Direction.South, true))))
|
.Executes(r => MoveOnDirection(r.Source, Direction.South, true))))
|
||||||
.Then(l => l.Literal("center")
|
.Then(l => l.Literal("center")
|
||||||
.Executes(r => MoveToCenter(r.Source, handler)))
|
.Executes(r => MoveToCenter(r.Source)))
|
||||||
.Then(l => l.Literal("get")
|
.Then(l => l.Literal("get")
|
||||||
.Executes(r => GetCurrentLocation(r.Source, handler)))
|
.Executes(r => GetCurrentLocation(r.Source)))
|
||||||
.Then(l => l.Argument("location", MccArguments.Location())
|
.Then(l => l.Argument("location", MccArguments.Location())
|
||||||
.Executes(r => MoveToLocation(r.Source, handler, MccArguments.GetLocation(r, "location"), false))
|
.Executes(r => MoveToLocation(r.Source, MccArguments.GetLocation(r, "location"), false))
|
||||||
.Then(l => l.Literal("-f")
|
.Then(l => l.Literal("-f")
|
||||||
.Executes(r => MoveToLocation(r.Source, handler, MccArguments.GetLocation(r, "location"), true))))
|
.Executes(r => MoveToLocation(r.Source, MccArguments.GetLocation(r, "location"), true))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -100,8 +100,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int SetMovementEnable(CmdResult r, McClient handler, bool enable)
|
private int SetMovementEnable(CmdResult r, bool enable)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
handler.SetTerrainEnabled(true);
|
handler.SetTerrainEnabled(true);
|
||||||
|
|
@ -114,8 +115,9 @@ namespace MinecraftClient.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int SetGravityEnable(CmdResult r, McClient handler, bool? enable)
|
private int SetGravityEnable(CmdResult r, bool? enable)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (enable.HasValue)
|
if (enable.HasValue)
|
||||||
Settings.InternalConfig.GravityEnabled = enable.Value;
|
Settings.InternalConfig.GravityEnabled = enable.Value;
|
||||||
|
|
||||||
|
|
@ -125,16 +127,18 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_move_gravity_disabled);
|
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_move_gravity_disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetCurrentLocation(CmdResult r, McClient handler)
|
private int GetCurrentLocation(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
return r.SetAndReturn(Status.Done, handler.GetCurrentLocation().ToString());
|
return r.SetAndReturn(Status.Done, handler.GetCurrentLocation().ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private int MoveToCenter(CmdResult r, McClient handler)
|
private int MoveToCenter(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -144,8 +148,9 @@ namespace MinecraftClient.Commands
|
||||||
return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_move_walk, currentCenter, current));
|
return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_move_walk, currentCenter, current));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int MoveOnDirection(CmdResult r, McClient handler, Direction direction, bool takeRisk)
|
private int MoveOnDirection(CmdResult r, Direction direction, bool takeRisk)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
@ -167,8 +172,9 @@ namespace MinecraftClient.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int MoveToLocation(CmdResult r, McClient handler, Location goal, bool takeRisk)
|
private int MoveToLocation(CmdResult r, Location goal, bool takeRisk)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "reco [account]"; } }
|
public override string CmdUsage { get { return "reco [account]"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_reco_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_reco_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -40,7 +40,7 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
private int DoReconnect(CmdResult r, string account)
|
private int DoReconnect(CmdResult r, string account)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(account))
|
if (!string.IsNullOrWhiteSpace(account))
|
||||||
{
|
{
|
||||||
account = account.Trim();
|
account = account.Trim();
|
||||||
if (!Settings.Config.Main.Advanced.SetAccount(account))
|
if (!Settings.Config.Main.Advanced.SetAccount(account))
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "reload"; } }
|
public override string CmdUsage { get { return "reload"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_reload_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_reload_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -19,7 +19,7 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => DoReload(r.Source, handler))
|
.Executes(r => DoReload(r.Source))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -35,8 +35,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoReload(CmdResult r, McClient handler)
|
private int DoReload(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
handler.Log.Info(Translations.cmd_reload_started);
|
handler.Log.Info(Translations.cmd_reload_started);
|
||||||
handler.ReloadSettings();
|
handler.ReloadSettings();
|
||||||
handler.Log.Warn(Translations.cmd_reload_warning1);
|
handler.Log.Warn(Translations.cmd_reload_warning1);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "respawn"; } }
|
public override string CmdUsage { get { return "respawn"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_respawn_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_respawn_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -19,7 +19,7 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => DoRespawn(r.Source, handler))
|
.Executes(r => DoRespawn(r.Source))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -35,8 +35,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoRespawn(CmdResult r, McClient handler)
|
private int DoRespawn(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
handler.SendRespawnPacket();
|
handler.SendRespawnPacket();
|
||||||
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_respawn_done);
|
return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_respawn_done);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "script <scriptname>"; } }
|
public override string CmdUsage { get { return "script <scriptname>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_script_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_script_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -21,7 +21,7 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Argument("Script", Arguments.GreedyString())
|
.Then(l => l.Argument("Script", Arguments.GreedyString())
|
||||||
.Executes(r => DoExecuteScript(r.Source, handler, Arguments.GetString(r, "Script"), null)))
|
.Executes(r => DoExecuteScript(r.Source, Arguments.GetString(r, "Script"), null)))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -37,8 +37,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoExecuteScript(CmdResult r, McClient handler, string command, Dictionary<string, object>? localVars)
|
private int DoExecuteScript(CmdResult r, string command, Dictionary<string, object>? localVars)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
handler.BotLoad(new ChatBots.Script(command.Trim(), null, localVars));
|
handler.BotLoad(new ChatBots.Script(command.Trim(), null, localVars));
|
||||||
return r.SetAndReturn(CmdResult.Status.Done);
|
return r.SetAndReturn(CmdResult.Status.Done);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "send <text>"; } }
|
public override string CmdUsage { get { return "send <text>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_send_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_send_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -20,7 +20,7 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Argument("any", Arguments.GreedyString())
|
.Then(l => l.Argument("any", Arguments.GreedyString())
|
||||||
.Executes(r => DoSendText(r.Source, handler, Arguments.GetString(r, "any"))))
|
.Executes(r => DoSendText(r.Source, Arguments.GetString(r, "any"))))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,8 +34,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoSendText(CmdResult r, McClient handler, string command)
|
private int DoSendText(CmdResult r, string command)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
handler.SendText(command);
|
handler.SendText(command);
|
||||||
return r.SetAndReturn(CmdResult.Status.Done);
|
return r.SetAndReturn(CmdResult.Status.Done);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "set varname=value"; } }
|
public override string CmdUsage { get { return "set varname=value"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_set_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_set_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdDesc { get { return Translations.cmd_setrnd_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_setrnd_desc; } }
|
||||||
private static readonly Random rand = new();
|
private static readonly Random rand = new();
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "sneak"; } }
|
public override string CmdUsage { get { return "sneak"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_sneak_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_sneak_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -20,7 +20,7 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => DoSneak(r.Source, handler))
|
.Executes(r => DoSneak(r.Source))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -36,8 +36,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoSneak(CmdResult r, McClient handler)
|
private int DoSneak(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (sneaking)
|
if (sneaking)
|
||||||
{
|
{
|
||||||
var result = handler.SendEntityAction(Protocol.EntityActionType.StopSneaking);
|
var result = handler.SendEntityAction(Protocol.EntityActionType.StopSneaking);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "tps"; } }
|
public override string CmdUsage { get { return "tps"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_tps_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_tps_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -20,7 +20,7 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => DoLogTps(r.Source, handler))
|
.Executes(r => DoLogTps(r.Source))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -36,8 +36,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoLogTps(CmdResult r, McClient handler)
|
private int DoLogTps(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
var tps = Math.Round(handler.GetServerTPS(), 2);
|
var tps = Math.Round(handler.GetServerTPS(), 2);
|
||||||
string color;
|
string color;
|
||||||
if (tps < 10)
|
if (tps < 10)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "upgrade [-f|check|cancel|download]"; } }
|
public override string CmdUsage { get { return "upgrade [-f|check|cancel|download]"; } }
|
||||||
public override string CmdDesc { get { return string.Empty; } }
|
public override string CmdDesc { get { return string.Empty; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "useitem"; } }
|
public override string CmdUsage { get { return "useitem"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_useitem_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_useitem_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -20,7 +20,7 @@ namespace MinecraftClient.Commands
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Executes(r => DoUseItem(r.Source, handler))
|
.Executes(r => DoUseItem(r.Source))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -36,8 +36,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DoUseItem(CmdResult r, McClient handler)
|
private int DoUseItem(CmdResult r)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetInventoryEnabled())
|
if (!handler.GetInventoryEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedInventory);
|
return r.SetAndReturn(Status.FailNeedInventory);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace MinecraftClient.Commands
|
||||||
public override string CmdUsage { get { return "useblock <x> <y> <z>"; } }
|
public override string CmdUsage { get { return "useblock <x> <y> <z>"; } }
|
||||||
public override string CmdDesc { get { return Translations.cmd_useblock_desc; } }
|
public override string CmdDesc { get { return Translations.cmd_useblock_desc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
dispatcher.Register(l => l.Literal("help")
|
dispatcher.Register(l => l.Literal("help")
|
||||||
.Then(l => l.Literal(CmdName)
|
.Then(l => l.Literal(CmdName)
|
||||||
|
|
@ -22,7 +22,7 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
dispatcher.Register(l => l.Literal(CmdName)
|
dispatcher.Register(l => l.Literal(CmdName)
|
||||||
.Then(l => l.Argument("Location", MccArguments.Location())
|
.Then(l => l.Argument("Location", MccArguments.Location())
|
||||||
.Executes(r => UseBlockAtLocation(r.Source, handler, MccArguments.GetLocation(r, "Location"))))
|
.Executes(r => UseBlockAtLocation(r.Source, MccArguments.GetLocation(r, "Location"))))
|
||||||
.Then(l => l.Literal("_help")
|
.Then(l => l.Literal("_help")
|
||||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName)))
|
||||||
);
|
);
|
||||||
|
|
@ -38,8 +38,9 @@ namespace MinecraftClient.Commands
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int UseBlockAtLocation(CmdResult r, McClient handler, Location block)
|
private int UseBlockAtLocation(CmdResult r, Location block)
|
||||||
{
|
{
|
||||||
|
McClient handler = CmdResult.currentHandler!;
|
||||||
if (!handler.GetTerrainEnabled())
|
if (!handler.GetTerrainEnabled())
|
||||||
return r.SetAndReturn(Status.FailNeedTerrain);
|
return r.SetAndReturn(Status.FailNeedTerrain);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ namespace MinecraftClient
|
||||||
|
|
||||||
sugList.Add(new("/"));
|
sugList.Add(new("/"));
|
||||||
|
|
||||||
var childs = CmdResult.client?.dispatcher.GetRoot().Children;
|
var childs = McClient.dispatcher.GetRoot().Children;
|
||||||
if (childs != null)
|
if (childs != null)
|
||||||
foreach (var child in childs)
|
foreach (var child in childs)
|
||||||
sugList.Add(new(child.Name));
|
sugList.Add(new(child.Name));
|
||||||
|
|
@ -246,7 +246,7 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CommandDispatcher<CmdResult>? dispatcher = CmdResult.client?.dispatcher;
|
CommandDispatcher<CmdResult>? dispatcher = McClient.dispatcher;
|
||||||
if (dispatcher == null)
|
if (dispatcher == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
public static int ReconnectionAttemptsLeft = 0;
|
public static int ReconnectionAttemptsLeft = 0;
|
||||||
|
|
||||||
public CommandDispatcher<CmdResult> dispatcher = new();
|
public static CommandDispatcher<CmdResult> dispatcher = new();
|
||||||
private readonly Dictionary<Guid, PlayerInfo> onlinePlayers = new();
|
private readonly Dictionary<Guid, PlayerInfo> onlinePlayers = new();
|
||||||
|
|
||||||
private static bool commandsLoaded = false;
|
private static bool commandsLoaded = false;
|
||||||
|
|
@ -150,7 +150,7 @@ namespace MinecraftClient
|
||||||
/// <param name="forgeInfo">ForgeInfo item stating that Forge is enabled</param>
|
/// <param name="forgeInfo">ForgeInfo item stating that Forge is enabled</param>
|
||||||
public McClient(SessionToken session, PlayerKeyPair? playerKeyPair, string server_ip, ushort port, int protocolversion, ForgeInfo? forgeInfo)
|
public McClient(SessionToken session, PlayerKeyPair? playerKeyPair, string server_ip, ushort port, int protocolversion, ForgeInfo? forgeInfo)
|
||||||
{
|
{
|
||||||
CmdResult.client = this;
|
CmdResult.currentHandler = this;
|
||||||
terrainAndMovementsEnabled = Config.Main.Advanced.TerrainAndMovements;
|
terrainAndMovementsEnabled = Config.Main.Advanced.TerrainAndMovements;
|
||||||
inventoryHandlingEnabled = Config.Main.Advanced.InventoryHandling;
|
inventoryHandlingEnabled = Config.Main.Advanced.InventoryHandling;
|
||||||
entityHandlingEnabled = Config.Main.Advanced.EntityHandling;
|
entityHandlingEnabled = Config.Main.Advanced.EntityHandling;
|
||||||
|
|
@ -674,7 +674,7 @@ namespace MinecraftClient
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Command cmd = (Command)Activator.CreateInstance(type)!;
|
Command cmd = (Command)Activator.CreateInstance(type)!;
|
||||||
cmd.RegisterCommand(this, dispatcher);
|
cmd.RegisterCommand(dispatcher);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1102,6 +1102,15 @@ namespace MinecraftClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Enable this option if the arrows in the command suggestions are not displayed properly in your terminal..
|
||||||
|
/// </summary>
|
||||||
|
internal static string Console_CommandSuggestion_Use_Basic_Arrow {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Console.CommandSuggestion.Use_Basic_Arrow", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to If a garbled code like "←[0m" appears on the terminal, you can turn off this..
|
/// Looks up a localized string similar to If a garbled code like "←[0m" appears on the terminal, you can turn off this..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -544,6 +544,9 @@ When this happens, you'll need to configure chat format below, see https://mccte
|
||||||
<data name="Console.CommandSuggestion.Enable" xml:space="preserve">
|
<data name="Console.CommandSuggestion.Enable" xml:space="preserve">
|
||||||
<value>Whether to display command suggestions in the console.</value>
|
<value>Whether to display command suggestions in the console.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Console.CommandSuggestion.Use_Basic_Arrow" xml:space="preserve">
|
||||||
|
<value>Enable this option if the arrows in the command suggestions are not displayed properly in your terminal.</value>
|
||||||
|
</data>
|
||||||
<data name="Console.Enable_Color" xml:space="preserve">
|
<data name="Console.Enable_Color" xml:space="preserve">
|
||||||
<value>If a garbled code like "←[0m" appears on the terminal, you can turn off this.</value>
|
<value>If a garbled code like "←[0m" appears on the terminal, you can turn off this.</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
||||||
|
|
@ -5341,7 +5341,7 @@ namespace MinecraftClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Password(invisible): {0}.
|
/// Looks up a localized string similar to Password(invisible): .
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string mcc_password_hidden {
|
internal static string mcc_password_hidden {
|
||||||
get {
|
get {
|
||||||
|
|
|
||||||
|
|
@ -1900,7 +1900,7 @@ Type '{0}quit' to leave the server.</value>
|
||||||
<value>Please type the password for {0}.</value>
|
<value>Please type the password for {0}.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="mcc.password_hidden" xml:space="preserve">
|
<data name="mcc.password_hidden" xml:space="preserve">
|
||||||
<value>Password(invisible): {0}</value>
|
<value>Password(invisible): </value>
|
||||||
</data>
|
</data>
|
||||||
<data name="mcc.player_dead" xml:space="preserve">
|
<data name="mcc.player_dead" xml:space="preserve">
|
||||||
<value>You are dead. Type '{0}respawn' to respawn.</value>
|
<value>You are dead. Type '{0}respawn' to respawn.</value>
|
||||||
|
|
|
||||||
|
|
@ -1667,7 +1667,7 @@ namespace MinecraftClient.Scripting
|
||||||
public override string CmdUsage { get { return _cmdUsage; } }
|
public override string CmdUsage { get { return _cmdUsage; } }
|
||||||
public override string CmdDesc { get { return _cmdDesc; } }
|
public override string CmdDesc { get { return _cmdDesc; } }
|
||||||
|
|
||||||
public override void RegisterCommand(McClient handler, CommandDispatcher<CmdResult> dispatcher)
|
public override void RegisterCommand(CommandDispatcher<CmdResult> dispatcher)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -794,6 +794,8 @@ namespace MinecraftClient
|
||||||
|
|
||||||
ConsoleInteractive.ConsoleSuggestion.EnableColor = CommandSuggestion.Enable_Color;
|
ConsoleInteractive.ConsoleSuggestion.EnableColor = CommandSuggestion.Enable_Color;
|
||||||
|
|
||||||
|
ConsoleInteractive.ConsoleSuggestion.UseBasicArrow = CommandSuggestion.Use_Basic_Arrow;
|
||||||
|
|
||||||
CommandSuggestion.Max_Suggestion_Width =
|
CommandSuggestion.Max_Suggestion_Width =
|
||||||
ConsoleInteractive.ConsoleSuggestion.SetMaxSuggestionLength(CommandSuggestion.Max_Suggestion_Width);
|
ConsoleInteractive.ConsoleSuggestion.SetMaxSuggestionLength(CommandSuggestion.Max_Suggestion_Width);
|
||||||
|
|
||||||
|
|
@ -886,6 +888,9 @@ namespace MinecraftClient
|
||||||
[TomlInlineComment("$Console.Enable_Color$")]
|
[TomlInlineComment("$Console.Enable_Color$")]
|
||||||
public bool Enable_Color = true;
|
public bool Enable_Color = true;
|
||||||
|
|
||||||
|
[TomlInlineComment("$Console.CommandSuggestion.Use_Basic_Arrow$")]
|
||||||
|
public bool Use_Basic_Arrow = false;
|
||||||
|
|
||||||
public int Max_Suggestion_Width = 30;
|
public int Max_Suggestion_Width = 30;
|
||||||
|
|
||||||
public int Max_Displayed_Suggestions = 6;
|
public int Max_Displayed_Suggestions = 6;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue