From 7f2ede8ad2be86f2d7ddfc531924da87e18870fd Mon Sep 17 00:00:00 2001 From: BruceChen Date: Wed, 5 Oct 2022 20:41:37 +0800 Subject: [PATCH] Delete unused sample files --- MinecraftClient/ChatBots/ScriptScheduler.cs | 31 +++++++++++- MinecraftClient/Program.cs | 10 ++-- MinecraftClient/Resources/lang/en.ini | 8 ++-- MinecraftClient/Settings.cs | 12 ++--- MinecraftClient/config/alerts-exclude.txt | 8 ---- MinecraftClient/config/alerts.txt | 37 --------------- MinecraftClient/config/kickmessages.txt | 4 -- MinecraftClient/config/sample-accounts.txt | 14 ------ MinecraftClient/config/sample-servers.txt | 18 ------- MinecraftClient/config/sample-tasks.ini | 52 --------------------- 10 files changed, 45 insertions(+), 149 deletions(-) delete mode 100644 MinecraftClient/config/alerts-exclude.txt delete mode 100644 MinecraftClient/config/alerts.txt delete mode 100644 MinecraftClient/config/kickmessages.txt delete mode 100644 MinecraftClient/config/sample-accounts.txt delete mode 100644 MinecraftClient/config/sample-servers.txt delete mode 100644 MinecraftClient/config/sample-tasks.ini diff --git a/MinecraftClient/ChatBots/ScriptScheduler.cs b/MinecraftClient/ChatBots/ScriptScheduler.cs index ca5bc001..21c22551 100644 --- a/MinecraftClient/ChatBots/ScriptScheduler.cs +++ b/MinecraftClient/ChatBots/ScriptScheduler.cs @@ -25,7 +25,24 @@ namespace MinecraftClient.ChatBots public bool Enabled = false; - public TaskConfig[] TaskList = new TaskConfig[] { new() }; + public TaskConfig[] TaskList = new TaskConfig[] { + new TaskConfig( + Task_Name: "Task Name 1", + Trigger_On_First_Login: false, + Trigger_On_Login: false, + Trigger_On_Times: new(true, new TimeSpan[] { new(14, 00, 00) }), + Trigger_On_Interval: new(true, 10, 20), + Action: "send /hello" + ), + new TaskConfig( + Task_Name: "Task Name 2", + Trigger_On_First_Login: false, + Trigger_On_Login: true, + Trigger_On_Times: new(false, Array.Empty() ), + Trigger_On_Interval: new(false, 1, 10), + Action: "send /login pass" + ), + }; public void OnSettingUpdate() { @@ -85,6 +102,18 @@ namespace MinecraftClient.ChatBots [NonSerialized] public int Trigger_On_Interval_Countdown = 0; + public TaskConfig() { } + + public TaskConfig(string Task_Name, bool Trigger_On_First_Login, bool Trigger_On_Login, TriggerOnTimeConfig Trigger_On_Times, TriggerOnIntervalConfig Trigger_On_Interval, string Action) + { + this.Task_Name = Task_Name; + this.Trigger_On_First_Login = Trigger_On_First_Login; + this.Trigger_On_Login = Trigger_On_Login; + this.Trigger_On_Times = Trigger_On_Times; + this.Trigger_On_Interval = Trigger_On_Interval; + this.Action = Action; + } + public struct TriggerOnTimeConfig { public bool Enable = false; diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index 90fda3da..f8fa9d7a 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -59,8 +59,11 @@ namespace MinecraftClient /// static void Main(string[] args) { - new Thread(() => + Task.Run(() => { + // "ToLower" require "CultureInfo" to be initialized on first run, which can take a lot of time. + _ = "a".ToLower(); + //Take advantage of Windows 10 / Mac / Linux UTF-8 console if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { @@ -76,10 +79,7 @@ namespace MinecraftClient // Fix issue #2119 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); - - // "ToLower" require "CultureInfo" to be initialized on first run, which can take a lot of time. - _ = "a".ToLower(); - }).Start(); + }); //Setup ConsoleIO ConsoleIO.LogPrefix = "§8[MCC] "; diff --git a/MinecraftClient/Resources/lang/en.ini b/MinecraftClient/Resources/lang/en.ini index 868245c7..0d449649 100644 --- a/MinecraftClient/Resources/lang/en.ini +++ b/MinecraftClient/Resources/lang/en.ini @@ -687,8 +687,8 @@ config.Main.Advanced.entity_handling=Toggle entity handling (beta) config.Main.Advanced.session_cache=How to retain session tokens. Use 'none', 'memory' or 'disk' config.Main.Advanced.profilekey_cache=How to retain profile key. Use 'none', 'memory' or 'disk' config.Main.Advanced.resolve_srv_records=Use 'no', 'fast' (5s timeout), or 'yes'. Required for joining some servers. -config.Main.Advanced.account_list=See README > 'Servers and Accounts file' for more info about this -config.Main.Advanced.server_list=See README > 'Servers and Accounts file' for more info about this +config.Main.Advanced.account_list=AccountList: It allows a fast account switching without directly using the credentials\n# Usage examples: "/tell reco Player2", "/connect Player1" +config.Main.Advanced.server_list=ServerList: It allows an easier and faster server switching with short aliases instead of full server IP\n# Aliases cannot contain dots or spaces, and the name "localhost" cannot be used as an alias.\n# Usage examples: "/tell connect Server1", "/connect Server2" config.Main.Advanced.player_head_icon=Only works on Windows XP-8 or Windows 10 with old console config.Main.Advanced.exit_on_failure=Disable pauses on error, for using MCC in non-interactive scripts config.Main.Advanced.script_cache=Cache compiled scripts for faster load on low-end devices @@ -814,8 +814,8 @@ config.ChatBot.AutoFishing.Auto_Rod_Switch=Switch to a new rod from inventory af config.ChatBot.AutoFishing.Stationary_Threshold=Hooks moving in the X and Z axes below this threshold will be considered stationary. config.ChatBot.AutoFishing.Hook_Threshold=A stationary hook moving on the Y-axis above this threshold will be considered to have caught a fish. config.ChatBot.AutoFishing.Log_Fish_Bobber=For debugging purposes, you can use this log to adjust the two thresholds mentioned above. -config.ChatBot.AutoFishing.Enable_Move=This allows the player to change position/angle after each fish caught. -config.ChatBot.AutoFishing.Movements=It will move in order "1->2->3->4->3->2->1->2->..." and can change position or angle or both each time. It is recommended to change the facing only. +config.ChatBot.AutoFishing.Enable_Move=This allows the player to change position/facing after each fish caught. +config.ChatBot.AutoFishing.Movements=It will move in order "1->2->3->4->3->2->1->2->..." and can change position or facing or both each time. It is recommended to change the facing only. # ChatBot.AutoRelog diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index c3525b2b..51daeb85 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -435,16 +435,16 @@ namespace MinecraftClient [TomlInlineComment("$config.Main.Advanced.resolve_srv_records$")] public ResolveSrvRecordType ResolveSrvRecords = ResolveSrvRecordType.fast; - [TomlInlineComment("$config.Main.Advanced.account_list$")] + [TomlPrecedingComment("$config.Main.Advanced.account_list$")] public Dictionary AccountList = new() { - { "AccountNikename1", new AccountInfoConfig("login1", "pass1") }, - { "AccountNikename2", new AccountInfoConfig("login2", "pass2") }, + { "AccountNikename1", new AccountInfoConfig("playerone@email.com", "thepassword") }, + { "AccountNikename2", new AccountInfoConfig("TestBot", "-") }, }; - [TomlInlineComment("$config.Main.Advanced.server_list$")] + [TomlPrecedingComment("$config.Main.Advanced.server_list$")] public Dictionary ServerList = new() { - { "ServerNickname1", new ServerInfoConfig("test1.server.com") }, - { "ServerNickname2", new ServerInfoConfig("test2.server.com", 12345) }, + { "ServerAlias1", new ServerInfoConfig("mc.awesomeserver.com") }, + { "ServerAlias2", new ServerInfoConfig("192.168.1.27", 12345) }, }; [TomlInlineComment("$config.Main.Advanced.player_head_icon$")] diff --git a/MinecraftClient/config/alerts-exclude.txt b/MinecraftClient/config/alerts-exclude.txt deleted file mode 100644 index 9d4263a5..00000000 --- a/MinecraftClient/config/alerts-exclude.txt +++ /dev/null @@ -1,8 +0,0 @@ -myserver.com -Yourname>: -Player Yourname -Yourname joined -Yourname left -[Lockette] (Admin) - Yourname: -Yourname is \ No newline at end of file diff --git a/MinecraftClient/config/alerts.txt b/MinecraftClient/config/alerts.txt deleted file mode 100644 index 8db71581..00000000 --- a/MinecraftClient/config/alerts.txt +++ /dev/null @@ -1,37 +0,0 @@ -Yourname - whispers --> me -admin -.com -.net -.fr -.us -.uk -!!!! -???? -aaaa -zzzz -eeee -rrrr -tttt -yyyy -uuuu -iiii -oooo -pppp -qqqq -ssss -dddd -ffff -gggg -hhhh -jjjj -kkkk -llll -mmmm -wwww -xxxx -cccc -vvvv -bbbb -nnnn \ No newline at end of file diff --git a/MinecraftClient/config/kickmessages.txt b/MinecraftClient/config/kickmessages.txt deleted file mode 100644 index f9fe3ecc..00000000 --- a/MinecraftClient/config/kickmessages.txt +++ /dev/null @@ -1,4 +0,0 @@ -Connection has been lost -Server is restarting -Server is full -Too Many people \ No newline at end of file diff --git a/MinecraftClient/config/sample-accounts.txt b/MinecraftClient/config/sample-accounts.txt deleted file mode 100644 index f2326621..00000000 --- a/MinecraftClient/config/sample-accounts.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Minecraft Console Client -# Account list file - -# Put account data as comma separated values -# Values are: Alias,Login,Password -# It allows a fast account switching -# without directly using the credentials - -# Usage examples: -# /tell reco Player2 -# /connect Player1 - -Player1,playerone@email.com,thepassword -Player2,TestBot,- \ No newline at end of file diff --git a/MinecraftClient/config/sample-servers.txt b/MinecraftClient/config/sample-servers.txt deleted file mode 100644 index 2657da3b..00000000 --- a/MinecraftClient/config/sample-servers.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Minecraft Console Client -# Server list file - -# Put server data as comma separated values -# Values are: Alias,ServerIP:Port -# Aliases cannot contains dots or spaces -# The name "localhost" cannot be used as an alias -# It allows an easier and faster server switching -# with short aliases instead of full server IP -# It also adds a bit of privacy for remote control - -# Usage examples: -# /tell connect Server1 -# /connect Server2 - -Server1,localhost -Server2,mc.awesomeserver.com:25567 -Server3,192.168.1.27:1348 # Example of LAN server \ No newline at end of file diff --git a/MinecraftClient/config/sample-tasks.ini b/MinecraftClient/config/sample-tasks.ini deleted file mode 100644 index 6681f3a8..00000000 --- a/MinecraftClient/config/sample-tasks.ini +++ /dev/null @@ -1,52 +0,0 @@ -# Minecraft Console Client -# ScriptScheduler Tasks -# Example config file - -# Structure of a task: [Task] Followed by triggers and other settings. -# The example below contains all the possible fields for a task -# Time is HH:mm format, several different hours can be provided -# Action command can be "script" or any other internal command - -[Task] -triggerOnFirstLogin=false -triggerOnLogin=false -triggerOnTime=true -triggerOnInterval=false -timeValue=19:30 -timeValue=08:10 -timeInterval=0 -action=script event.txt - -# Another minimal example: some properties may be omitted -# This is highly recommended for improving task readability - -[Task] -triggerOnFirstLogin=true -action=script startup.txt - -# Intervals can be random -# To define a random interval between 2 numbers, use -, example: 1-100 -[Task] -triggerOnInterval=true -timeInterval=1-15 -action=send I am triggered! - -# Of course, the tasks file can contain as much tasks as you want. -# Another example triggered on logging in and every night at midnight: - -[Task] -triggerOnLogin=true -triggerOnTime=true -timeValue=00:00 -action=log It's midnight! - -# Example of task occuring every 30 seconds -# Could be used for jumping as antiAFK method - -[Task] -triggerOnInterval=true -timeInterval=30 -action=move up - -# Enjoy! -# - ORelio