mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Merge into master
This commit is contained in:
commit
892999ac98
155 changed files with 10911 additions and 9860 deletions
|
|
@ -20,28 +20,28 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Beep_Enabled$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Beep_Enabled$")]
|
||||
public bool Beep_Enabled = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Trigger_By_Words$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Trigger_By_Words$")]
|
||||
public bool Trigger_By_Words = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Trigger_By_Rain$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Trigger_By_Rain$")]
|
||||
public bool Trigger_By_Rain = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Trigger_By_Thunderstorm$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Trigger_By_Thunderstorm$")]
|
||||
public bool Trigger_By_Thunderstorm = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Log_To_File$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Log_To_File$")]
|
||||
public bool Log_To_File = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Alerts.Log_File$")]
|
||||
[TomlInlineComment("$ChatBot.Alerts.Log_File$")]
|
||||
public string Log_File = @"alerts-log.txt";
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.Alerts.Matches$")]
|
||||
[TomlPrecedingComment("$ChatBot.Alerts.Matches$")]
|
||||
public string[] Matches = new string[] { "Yourname", " whispers ", "-> me", "admin", ".com" };
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.Alerts.Excludes$")]
|
||||
[TomlPrecedingComment("$ChatBot.Alerts.Excludes$")]
|
||||
public string[] Excludes = new string[] { "myserver.com", "Yourname>:", "Player Yourname", "Yourname joined", "Yourname left", "[Lockette] (Admin)", " Yourname:", "Yourname is" };
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -124,7 +124,7 @@ namespace MinecraftClient.ChatBots
|
|||
Console.Beep();
|
||||
Console.Beep();
|
||||
}
|
||||
LogToConsole(Translations.bot_alerts_start_rain);
|
||||
LogToConsole("§c" + Translations.bot_alerts_start_rain);
|
||||
}
|
||||
}
|
||||
else if (curRainLevel >= threshold && level < threshold)
|
||||
|
|
@ -135,7 +135,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
Console.Beep();
|
||||
}
|
||||
LogToConsole(Translations.bot_alerts_end_rain);
|
||||
LogToConsole("§c" + Translations.bot_alerts_end_rain);
|
||||
}
|
||||
}
|
||||
curRainLevel = level;
|
||||
|
|
@ -152,7 +152,7 @@ namespace MinecraftClient.ChatBots
|
|||
Console.Beep();
|
||||
Console.Beep();
|
||||
}
|
||||
LogToConsole(Translations.bot_alerts_start_thunderstorm);
|
||||
LogToConsole("§c" + Translations.bot_alerts_start_thunderstorm);
|
||||
}
|
||||
}
|
||||
else if (curThunderLevel >= threshold && level < threshold)
|
||||
|
|
@ -163,7 +163,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
Console.Beep();
|
||||
}
|
||||
LogToConsole(Translations.bot_alerts_end_thunderstorm);
|
||||
LogToConsole("§c" + Translations.bot_alerts_end_thunderstorm);
|
||||
}
|
||||
}
|
||||
curThunderLevel = level;
|
||||
|
|
|
|||
|
|
@ -23,22 +23,22 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Delay$")]
|
||||
public Range Delay = new(60);
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Command$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Command$")]
|
||||
public string Command = "/ping";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Use_Sneak$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Use_Sneak$")]
|
||||
public bool Use_Sneak = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Use_Terrain_Handling$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Use_Terrain_Handling$")]
|
||||
public bool Use_Terrain_Handling = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Walk_Range$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Walk_Range$")]
|
||||
public int Walk_Range = 5;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AntiAfk.Walk_Retries$")]
|
||||
[TomlInlineComment("$ChatBot.AntiAfk.Walk_Retries$")]
|
||||
public int Walk_Retries = 20;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -93,7 +93,7 @@ namespace MinecraftClient.ChatBots
|
|||
count = 0;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (Config.Use_Terrain_Handling)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,28 +23,28 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Mode$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Mode$")]
|
||||
public AttackMode Mode = AttackMode.single;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Priority$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Priority$")]
|
||||
public PriorityType Priority = PriorityType.distance;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Cooldown_Time$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Cooldown_Time$")]
|
||||
public CooldownConfig Cooldown_Time = new(false, 1.0);
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Interaction$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Interaction$")]
|
||||
public InteractType Interaction = InteractType.Attack;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Attack_Hostile$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Attack_Hostile$")]
|
||||
public bool Attack_Hostile = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Attack_Passive$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Attack_Passive$")]
|
||||
public bool Attack_Passive = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.List_Mode$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.List_Mode$")]
|
||||
public ListType List_Mode = ListType.whitelist;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoAttack.Entites_List$")]
|
||||
[TomlInlineComment("$ChatBot.AutoAttack.Entites_List$")]
|
||||
public List<EntityType> Entites_List = new() { EntityType.Zombie, EntityType.Cow };
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -112,7 +112,7 @@ namespace MinecraftClient.ChatBots
|
|||
attackPassive = Config.Attack_Passive;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetEntityHandlingEnabled())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoCraft.CraftingTable$")]
|
||||
[TomlInlineComment("$ChatBot.AutoCraft.CraftingTable$")]
|
||||
public LocationConfig CraftingTable = new(123, 65, 456);
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoCraft.OnFailure$")]
|
||||
[TomlInlineComment("$ChatBot.AutoCraft.OnFailure$")]
|
||||
public OnFailConfig OnFailure = OnFailConfig.abort;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.AutoCraft.Recipes$")]
|
||||
[TomlPrecedingComment("$ChatBot.AutoCraft.Recipes$")]
|
||||
public RecipeConfig[] Recipes = new RecipeConfig[]
|
||||
{
|
||||
new RecipeConfig(
|
||||
|
|
@ -286,7 +286,7 @@ namespace MinecraftClient.ChatBots
|
|||
}
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetInventoryEnabled())
|
||||
{
|
||||
|
|
@ -296,7 +296,7 @@ namespace MinecraftClient.ChatBots
|
|||
return;
|
||||
}
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
.Then(l => l.Literal("list")
|
||||
|
|
@ -310,7 +310,7 @@ namespace MinecraftClient.ChatBots
|
|||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("list")
|
||||
.Executes(r => OnCommandList(r.Source)))
|
||||
.Then(l => l.Literal("start")
|
||||
|
|
@ -319,14 +319,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -339,7 +339,7 @@ namespace MinecraftClient.ChatBots
|
|||
"stop" => Translations.bot_autoCraft_help_stop,
|
||||
"help" => Translations.bot_autoCraft_help_help,
|
||||
_ => string.Format(Translations.bot_autoCraft_available_cmd, "load, list, reload, resetcfg, start, stop, help")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,36 +26,36 @@ namespace MinecraftClient.ChatBots
|
|||
public bool Enabled = false;
|
||||
|
||||
[NonSerialized]
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Auto_Tool_Switch$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Auto_Tool_Switch$")]
|
||||
public bool Auto_Tool_Switch = false;
|
||||
|
||||
[NonSerialized]
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Durability_Limit$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Durability_Limit$")]
|
||||
public int Durability_Limit = 2;
|
||||
|
||||
[NonSerialized]
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Drop_Low_Durability_Tools$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Drop_Low_Durability_Tools$")]
|
||||
public bool Drop_Low_Durability_Tools = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Mode$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Mode$")]
|
||||
public ModeType Mode = ModeType.lookat;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.AutoDig.Locations$")]
|
||||
[TomlPrecedingComment("$ChatBot.AutoDig.Locations$")]
|
||||
public Coordination[] Locations = new Coordination[] { new(123.5, 64, 234.5), new(124.5, 63, 235.5) };
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Location_Order$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Location_Order$")]
|
||||
public OrderType Location_Order = OrderType.distance;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Auto_Start_Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Auto_Start_Delay$")]
|
||||
public double Auto_Start_Delay = 3.0;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Dig_Timeout$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Dig_Timeout$")]
|
||||
public double Dig_Timeout = 60.0;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.Log_Block_Dig$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.Log_Block_Dig$")]
|
||||
public bool Log_Block_Dig = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDig.List_Type$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDig.List_Type$")]
|
||||
public ListType List_Type = ListType.whitelist;
|
||||
|
||||
public List<Material> Blocks = new() { Material.Cobblestone, Material.Stone };
|
||||
|
|
@ -110,7 +110,7 @@ namespace MinecraftClient.ChatBots
|
|||
Stopping,
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetTerrainEnabled())
|
||||
{
|
||||
|
|
@ -124,7 +124,7 @@ namespace MinecraftClient.ChatBots
|
|||
if (!inventoryEnabled && Config.Auto_Tool_Switch)
|
||||
LogToConsole(Translations.bot_autodig_no_inv_handle);
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
.Then(l => l.Literal("start")
|
||||
|
|
@ -136,25 +136,25 @@ namespace MinecraftClient.ChatBots
|
|||
)
|
||||
);
|
||||
|
||||
var cmd = dispatcher.Register(l => l.Literal(CommandName)
|
||||
var cmd = Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("start")
|
||||
.Executes(r => OnCommandStart(r.Source)))
|
||||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal("digbot")
|
||||
Handler.dispatcher.Register(l => l.Literal("digbot")
|
||||
.Redirect(cmd)
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister("digbot");
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister("digbot");
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -166,7 +166,7 @@ namespace MinecraftClient.ChatBots
|
|||
"stop" => Translations.bot_autodig_help_stop,
|
||||
"help" => Translations.bot_autodig_help_help,
|
||||
_ => string.Format(Translations.bot_autodig_available_cmd, "start, stop, help")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoDrop.Mode$")]
|
||||
[TomlInlineComment("$ChatBot.AutoDrop.Mode$")]
|
||||
public DropMode Mode = DropMode.include;
|
||||
|
||||
public List<ItemType> Items = new() { ItemType.Cobblestone, ItemType.Dirt };
|
||||
|
|
@ -45,7 +45,7 @@ namespace MinecraftClient.ChatBots
|
|||
private readonly int updateDebounceValue = 2;
|
||||
private int inventoryUpdated = -1;
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetInventoryEnabled())
|
||||
{
|
||||
|
|
@ -55,7 +55,7 @@ namespace MinecraftClient.ChatBots
|
|||
return;
|
||||
}
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
.Then(l => l.Literal("add")
|
||||
|
|
@ -67,7 +67,7 @@ namespace MinecraftClient.ChatBots
|
|||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("on")
|
||||
.Executes(r => OnCommandEnable(r.Source, true)))
|
||||
.Then(l => l.Literal("off")
|
||||
|
|
@ -88,14 +88,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("everything")
|
||||
.Executes(r => OnCommandMode(r.Source, DropMode.everything))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -107,7 +107,7 @@ namespace MinecraftClient.ChatBots
|
|||
"remove" => Translations.cmd_inventory_help_usage + ": remove <item name>",
|
||||
"mode" => Translations.bot_autoDrop_unknown_mode,
|
||||
_ => string.Format(Translations.general_available_cmd, "on, off, add, remove, list, mode")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,43 +32,43 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Antidespawn$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Antidespawn$")]
|
||||
public bool Antidespawn = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Mainhand$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Mainhand$")]
|
||||
public bool Mainhand = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Auto_Start$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Auto_Start$")]
|
||||
public bool Auto_Start = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Cast_Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Cast_Delay$")]
|
||||
public double Cast_Delay = 0.4;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Fishing_Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Fishing_Delay$")]
|
||||
public double Fishing_Delay = 3.0;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Fishing_Timeout$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Fishing_Timeout$")]
|
||||
public double Fishing_Timeout = 300.0;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Durability_Limit$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Durability_Limit$")]
|
||||
public double Durability_Limit = 2;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Auto_Rod_Switch$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Auto_Rod_Switch$")]
|
||||
public bool Auto_Rod_Switch = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Stationary_Threshold$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Stationary_Threshold$")]
|
||||
public double Stationary_Threshold = 0.001;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Hook_Threshold$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Hook_Threshold$")]
|
||||
public double Hook_Threshold = 0.2;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Log_Fish_Bobber$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Log_Fish_Bobber$")]
|
||||
public bool Log_Fish_Bobber = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoFishing.Enable_Move$")]
|
||||
[TomlInlineComment("$ChatBot.AutoFishing.Enable_Move$")]
|
||||
public bool Enable_Move = false;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.AutoFishing.Movements$")]
|
||||
[TomlPrecedingComment("$ChatBot.AutoFishing.Movements$")]
|
||||
public LocationConfig[] Movements = new LocationConfig[]
|
||||
{
|
||||
new LocationConfig(12.34, -23.45),
|
||||
|
|
@ -176,7 +176,7 @@ namespace MinecraftClient.ChatBots
|
|||
Stopping,
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetEntityHandlingEnabled())
|
||||
{
|
||||
|
|
@ -188,7 +188,7 @@ namespace MinecraftClient.ChatBots
|
|||
if (!inventoryEnabled)
|
||||
LogToConsole(Translations.bot_autoFish_no_inv_handle);
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
.Then(l => l.Literal("start")
|
||||
|
|
@ -202,7 +202,7 @@ namespace MinecraftClient.ChatBots
|
|||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("start")
|
||||
.Executes(r => OnCommandStart(r.Source)))
|
||||
.Then(l => l.Literal("stop")
|
||||
|
|
@ -212,14 +212,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("clear")
|
||||
.Executes(r => OnCommandStatusClear(r.Source))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -232,7 +232,7 @@ namespace MinecraftClient.ChatBots
|
|||
"status" => Translations.bot_autoFish_help_status,
|
||||
"help" => Translations.bot_autoFish_help_help,
|
||||
_ => string.Format(Translations.bot_autoFish_available_cmd, "start, stop, status, help")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,16 +21,16 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoRelog.Delay$")]
|
||||
[TomlInlineComment("$ChatBot.AutoRelog.Delay$")]
|
||||
public Range Delay = new(3);
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoRelog.Retries$")]
|
||||
[TomlInlineComment("$ChatBot.AutoRelog.Retries$")]
|
||||
public int Retries = 3;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoRelog.Ignore_Kick_Message$")]
|
||||
[TomlInlineComment("$ChatBot.AutoRelog.Ignore_Kick_Message$")]
|
||||
public bool Ignore_Kick_Message = false;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.AutoRelog.Kick_Messages$")]
|
||||
[TomlPrecedingComment("$ChatBot.AutoRelog.Kick_Messages$")]
|
||||
public string[] Kick_Messages = new string[] { "Connection has been lost", "Server is restarting", "Server is full", "Too Many people" };
|
||||
|
||||
[NonSerialized]
|
||||
|
|
@ -85,12 +85,12 @@ namespace MinecraftClient.ChatBots
|
|||
LogDebugToConsole(string.Format(Translations.bot_autoRelog_launch, Config.Retries));
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
Initialize();
|
||||
_Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
private void _Initialize()
|
||||
{
|
||||
McClient.ReconnectionAttemptsLeft = Config.Retries;
|
||||
if (Config.Ignore_Kick_Message)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public string Matches_File = @"matches.ini";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.AutoRespond.Match_Colors$")]
|
||||
[TomlInlineComment("$ChatBot.AutoRespond.Match_Colors$")]
|
||||
public bool Match_Colors = false;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -187,7 +187,7 @@ namespace MinecraftClient.ChatBots
|
|||
/// <summary>
|
||||
/// Initialize the AutoRespond bot from the matches file
|
||||
/// </summary>
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (File.Exists(Config.Matches_File))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,22 +44,22 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.Token$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.Token$")]
|
||||
public string Token = "your bot token here";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.GuildId$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.GuildId$")]
|
||||
public ulong GuildId = 1018553894831403028L;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.ChannelId$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.ChannelId$")]
|
||||
public ulong ChannelId = 1018565295654326364L;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.OwnersIds$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.OwnersIds$")]
|
||||
public ulong[] OwnersIds = new[] { 978757810781323276UL };
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.DiscordBridge.MessageSendTimeout$")]
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.MessageSendTimeout$")]
|
||||
public int Message_Send_Timeout = 3;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.DiscordBridge.Formats$")]
|
||||
[TomlPrecedingComment("$ChatBot.DiscordBridge.Formats$")]
|
||||
public string PrivateMessageFormat = "**[Private Message]** {username}: {message}";
|
||||
public string PublicMessageFormat = "{username}: {message}";
|
||||
public string TeleportRequestMessageFormat = "A new Teleport Request from **{username}**!";
|
||||
|
|
@ -75,15 +75,15 @@ namespace MinecraftClient.ChatBots
|
|||
instance = this;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("direction")
|
||||
.Then(l => l.Literal("both")
|
||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Both)))
|
||||
|
|
@ -93,16 +93,16 @@ namespace MinecraftClient.ChatBots
|
|||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Discord)))
|
||||
)
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
|
||||
Task.Run(async () => await MainAsync());
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => "dscbridge direction <both|mc|discord>"
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Farmer.Delay_Between_Tasks$")]
|
||||
[TomlInlineComment("$ChatBot.Farmer.Delay_Between_Tasks$")]
|
||||
public double Delay_Between_Tasks = 1.0;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -70,7 +70,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
private const string commandDescription = "farmer <start <crop type> [radius:<radius = 30>] [unsafe:<true/false>] [teleport:<true/false>] [debug:<true/false>]|stop>";
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (GetProtocolVersion() < Protocol18Handler.MC_1_13_Version)
|
||||
{
|
||||
|
|
@ -90,13 +90,13 @@ namespace MinecraftClient.ChatBots
|
|||
return;
|
||||
}
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("start")
|
||||
|
|
@ -105,14 +105,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Argument("OtherArgs", Arguments.GreedyString())
|
||||
.Executes(r => OnCommandStart(r.Source, MccArguments.GetFarmerCropType(r, "CropType"), Arguments.GetString(r, "OtherArgs"))))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -121,7 +121,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.bot_farmer_desc + ": " + commandDescription
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.FollowPlayer.Update_Limit$")]
|
||||
[TomlInlineComment("$ChatBot.FollowPlayer.Update_Limit$")]
|
||||
public double Update_Limit = 1.5;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.FollowPlayer.Stop_At_Distance$")]
|
||||
[TomlInlineComment("$ChatBot.FollowPlayer.Stop_At_Distance$")]
|
||||
public double Stop_At_Distance = 3.0;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -44,7 +44,7 @@ namespace MinecraftClient.ChatBots
|
|||
private int _updateCounter = 0;
|
||||
private bool _unsafeEnabled = false;
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!GetEntityHandlingEnabled())
|
||||
{
|
||||
|
|
@ -62,13 +62,13 @@ namespace MinecraftClient.ChatBots
|
|||
return;
|
||||
}
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("start")
|
||||
.Then(l => l.Argument("PlayerName", MccArguments.PlayerName())
|
||||
.Executes(r => OnCommandStart(r.Source, Arguments.GetString(r, "PlayerName"), takeRisk: false))
|
||||
|
|
@ -77,14 +77,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -93,7 +93,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.cmd_follow_desc + ": " + Translations.cmd_follow_usage
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
|
|
@ -223,7 +223,7 @@ namespace MinecraftClient.ChatBots
|
|||
/// <summary>
|
||||
/// Initialization of the Mailer bot
|
||||
/// </summary>
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
LogDebugToConsole(Translations.bot_mailer_init);
|
||||
LogDebugToConsole(Translations.bot_mailer_init_db + Config.DatabaseFile);
|
||||
|
|
@ -258,53 +258,31 @@ namespace MinecraftClient.ChatBots
|
|||
mailDbFileMonitor = new FileMonitor(Path.GetDirectoryName(Config.DatabaseFile)!, Path.GetFileName(Config.DatabaseFile), FileMonitorCallback);
|
||||
ignoreListFileMonitor = new FileMonitor(Path.GetDirectoryName(Config.IgnoreListFile)!, Path.GetFileName(Config.IgnoreListFile), FileMonitorCallback);
|
||||
|
||||
dispatcher.Register(l =>
|
||||
l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(string.Empty))
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp(string.Empty)))
|
||||
)
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(string.Empty)))
|
||||
);
|
||||
|
||||
dispatcher.Register(l =>
|
||||
l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(string.Empty))
|
||||
.Then(l => l.Literal("getmails")
|
||||
.Executes(r => OnCommandGetMails())
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("getmails")))
|
||||
)
|
||||
.Then(l => l.Literal("getignored")
|
||||
.Executes(r => OnCommandGetIgnored())
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("getignored")))
|
||||
)
|
||||
.Then(l => l.Literal("addignored")
|
||||
.Executes(r => OnCommandHelp("addignored"))
|
||||
.Then(l => l.Argument("username", Arguments.String())
|
||||
.Executes(r => OnCommandAddIgnored(Arguments.GetString(r, "username")))
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("addignored")))
|
||||
)
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("addignored")))
|
||||
)
|
||||
.Then(l => l.Literal("removeignored")
|
||||
.Executes(r => OnCommandHelp("removeignored"))
|
||||
.Then(l => l.Argument("username", Arguments.String())
|
||||
.Executes(r => OnCommandRemoveIgnored(Arguments.GetString(r, "username")))
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("removeignored")))
|
||||
)
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp("removeignored")))
|
||||
)
|
||||
.Then(l => l.Literal("_help")
|
||||
.Executes(r => OnCommandHelp(string.Empty))
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName))
|
||||
)
|
||||
.Then(l => l.Argument("any", Arguments.GreedyString()).Executes(r => OnCommandHelp(string.Empty)))
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("getmails")
|
||||
.Executes(r => OnCommandGetMails()))
|
||||
.Then(l => l.Literal("getignored")
|
||||
.Executes(r => OnCommandGetIgnored()))
|
||||
.Then(l => l.Literal("addignored")
|
||||
.Then(l => l.Argument("username", Arguments.String())
|
||||
.Executes(r => OnCommandAddIgnored(Arguments.GetString(r, "username")))))
|
||||
.Then(l => l.Literal("removeignored")
|
||||
.Then(l => l.Argument("username", Arguments.String())
|
||||
.Executes(r => OnCommandRemoveIgnored(Arguments.GetString(r, "username")))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(string cmd)
|
||||
|
|
@ -313,7 +291,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.bot_mailer_cmd_help + ": /mailer <getmails|addignored|getignored|removeignored>"
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -35,28 +35,28 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Render_In_Console$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Render_In_Console$")]
|
||||
public bool Render_In_Console = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Save_To_File$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Save_To_File$")]
|
||||
public bool Save_To_File = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Auto_Render_On_Update$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Auto_Render_On_Update$")]
|
||||
public bool Auto_Render_On_Update = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Delete_All_On_Unload$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Delete_All_On_Unload$")]
|
||||
public bool Delete_All_On_Unload = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Notify_On_First_Update$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Notify_On_First_Update$")]
|
||||
public bool Notify_On_First_Update = true;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Rasize_Rendered_Image$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Rasize_Rendered_Image$")]
|
||||
public bool Rasize_Rendered_Image = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.Map.Resize_To$")]
|
||||
[TomlInlineComment("$ChatBot.Map.Resize_To$")]
|
||||
public int Resize_To = 512;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.Map.Send_Rendered_To_Bridges$")]
|
||||
[TomlPrecedingComment("$ChatBot.Map.Send_Rendered_To_Bridges$")]
|
||||
public bool Send_Rendered_To_Discord = false;
|
||||
public bool Send_Rendered_To_Telegram = false;
|
||||
|
||||
|
|
@ -73,20 +73,20 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
private readonly Queue<QueuedMap> discordQueue = new();
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
if (!Directory.Exists(baseDirectory))
|
||||
Directory.CreateDirectory(baseDirectory);
|
||||
|
||||
DeleteRenderedMaps();
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandList(r.Source))
|
||||
.Then(l => l.Literal("list")
|
||||
.Executes(r => OnCommandList(r.Source)))
|
||||
|
|
@ -94,14 +94,14 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Argument("MapID", MccArguments.MapBotMapId())
|
||||
.Executes(r => OnCommandRender(r.Source, Arguments.GetInteger(r, "MapID")))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
DeleteRenderedMaps();
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.error_usage + ": /maps <list/render <id>>"
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public string File = "playerlog.txt";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.PlayerListLogger.Delay$")]
|
||||
[TomlInlineComment("$ChatBot.PlayerListLogger.Delay$")]
|
||||
public double Delay = 60;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.ReplayCapture.Backup_Interval$")]
|
||||
[TomlInlineComment("$ChatBot.ReplayCapture.Backup_Interval$")]
|
||||
public double Backup_Interval = 300.0;
|
||||
|
||||
public void OnSettingUpdate()
|
||||
|
|
@ -40,33 +40,33 @@ namespace MinecraftClient.ChatBots
|
|||
private ReplayHandler? replay;
|
||||
private int backupCounter = -1;
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
SetNetworkPacketEventEnabled(true);
|
||||
replay = new ReplayHandler(GetProtocolVersion());
|
||||
replay.MetaData.serverName = GetServerHost() + GetServerPort();
|
||||
backupCounter = Settings.DoubleToTick(Config.Backup_Interval);
|
||||
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("save")
|
||||
.Executes(r => OnCommandSave(r.Source)))
|
||||
.Then(l => l.Literal("stop")
|
||||
.Executes(r => OnCommandStop(r.Source)))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
}
|
||||
|
||||
private int OnCommandHelp(CmdResult r, string? cmd)
|
||||
|
|
@ -75,7 +75,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => string.Format(Translations.general_available_cmd, "save, stop")
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ namespace MinecraftClient.ChatBots
|
|||
return false;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
//Load the given file from the startup parameters
|
||||
if (LookForScript(ref file!))
|
||||
|
|
|
|||
|
|
@ -47,19 +47,19 @@ namespace MinecraftClient.ChatBots
|
|||
|
||||
public bool Enabled = false;
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.TelegramBridge.Token$")]
|
||||
[TomlInlineComment("$ChatBot.TelegramBridge.Token$")]
|
||||
public string Token = "your bot token here";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.TelegramBridge.ChannelId$")]
|
||||
[TomlInlineComment("$ChatBot.TelegramBridge.ChannelId$")]
|
||||
public string ChannelId = "";
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.TelegramBridge.Authorized_Chat_Ids$")]
|
||||
[TomlInlineComment("$ChatBot.TelegramBridge.Authorized_Chat_Ids$")]
|
||||
public long[] Authorized_Chat_Ids = Array.Empty<long>();
|
||||
|
||||
[TomlInlineComment("$config.ChatBot.TelegramBridge.MessageSendTimeout$")]
|
||||
[TomlInlineComment("$ChatBot.TelegramBridge.MessageSendTimeout$")]
|
||||
public int Message_Send_Timeout = 3;
|
||||
|
||||
[TomlPrecedingComment("$config.ChatBot.TelegramBridge.Formats$")]
|
||||
[TomlPrecedingComment("$ChatBot.TelegramBridge.Formats$")]
|
||||
public string PrivateMessageFormat = "*(Private Message)* {username}: {message}";
|
||||
public string PublicMessageFormat = "{username}: {message}";
|
||||
public string TeleportRequestMessageFormat = "A new Teleport Request from **{username}**!";
|
||||
|
|
@ -75,15 +75,15 @@ namespace MinecraftClient.ChatBots
|
|||
instance = this;
|
||||
}
|
||||
|
||||
public override void Initialize(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void Initialize()
|
||||
{
|
||||
dispatcher.Register(l => l.Literal("help")
|
||||
Handler.dispatcher.Register(l => l.Literal("help")
|
||||
.Then(l => l.Literal(CommandName)
|
||||
.Executes(r => OnCommandHelp(r.Source, string.Empty))
|
||||
)
|
||||
);
|
||||
|
||||
dispatcher.Register(l => l.Literal(CommandName)
|
||||
Handler.dispatcher.Register(l => l.Literal(CommandName)
|
||||
.Then(l => l.Literal("direction")
|
||||
.Then(l => l.Literal("both")
|
||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Both)))
|
||||
|
|
@ -92,16 +92,16 @@ namespace MinecraftClient.ChatBots
|
|||
.Then(l => l.Literal("telegram")
|
||||
.Executes(r => OnCommandDirection(r.Source, BridgeDirection.Telegram))))
|
||||
.Then(l => l.Literal("_help")
|
||||
.Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
.Redirect(Handler.dispatcher.GetRoot().GetChild("help").GetChild(CommandName)))
|
||||
);
|
||||
|
||||
Task.Run(async () => await MainAsync());
|
||||
}
|
||||
|
||||
public override void OnUnload(CommandDispatcher<CmdResult> dispatcher)
|
||||
public override void OnUnload()
|
||||
{
|
||||
dispatcher.Unregister(CommandName);
|
||||
dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Handler.dispatcher.Unregister(CommandName);
|
||||
Handler.dispatcher.GetRoot().GetChild("help").RemoveChild(CommandName);
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ namespace MinecraftClient.ChatBots
|
|||
{
|
||||
#pragma warning disable format // @formatter:off
|
||||
_ => Translations.error_usage + ": /tgbridge direction <both|mc|telegram>"
|
||||
+ '\n' + McClient.dispatcher.GetAllUsageString(CommandName, false),
|
||||
+ '\n' + Handler.dispatcher.GetAllUsageString(CommandName, false),
|
||||
#pragma warning restore format // @formatter:on
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue