MCCTeam / Minecraft-Console-Client

Lightweight console for Minecraft chat and automated scripts
https://mccteam.github.io
Other
1.62k stars 391 forks source link

[Feature Request] Legacy Configuration Setting Loading #2331

Closed agitationswapping closed 6 months ago

agitationswapping commented 1 year ago

Prerequisites

Minecraft Version

1.19.2

Console Client Version

Latest

Expected Behavior

I could place the new MinecraftClient.exe and everything would work.

I wouldn't have to rebuild any configuration files or mess with settings I didn't want to change.

Actual Behavior

First I received the following error:

> "Minecraft Console Client v1.19.2 - for MC 1.4.6 to 1.19.2 - Github.com/MCCTeam
> GitHub build 156, built on 2022-11-06 from commit 09d4e71
> Failed to load settings:
> Expected the start of a number, string literal, boolean, array, or table on line 10, found 'a'
> 
> Failed to parse the settings file, enter "/new" to generate a new configuration.
> Or press Enter to exit Minecraft Console Client.
> >"

I clued in that something was wrong with the configuration file, but had no idea this had been changed between versions. After confirming the config file worked with the previous version still, I opted to create a new one, figuring that it had changed.

I then, manually imported my settings one by one from the old MinecraftClient.ini.

All good now, right?

Nope, next I received an error that the server couldn't be found.

I checked and also, the way that both users and servers are entered has also been changed.

Luckily the configuration file was clear enough, but I have a lot of accounts and servers I use, so this wasn't necessarily easy and took a decent amount of time.

Great, now I'm good right?

Yep, it worked.

Except, that when I closed down, I still had the previous Minecraft Client Console sessions open. When I closed them, I did it in the reverse order (having no idea this would matter at all).

So I assume it overwrote the MinecraftClient.ini with the previous version (no usernames/servers). Then it overwrote that MinecraftClient.ini with the original version (no usernames/servers or custom settings).

I realized this was happening when I saw the text, but by that time it was too late to do anything. All of the usernames and servers were overwritten and my text editor reloaded the file automatically.

So I then went through the process of manually transcribing all the settings, servers, and usernames/passwords again for a second time, after which time it seems to be stable.

I did notice there's a MinecraftClient.backup.ini, but I found it afterward and I think in my case it would have still lost the usernames/servers.

So I suppose I'm at a loss, why: (1) If changing the format of configuration files, you wouldn't leave a way to read old configuration files intact so they could be imported properly. (2) Failing that, you wouldn't display a reasonable error message. (3) Overwriting the MinecraftClient.ini file makes sense at all. Obviously, my config file worked and I didn't change any settings when running the program, so why the need to revert this file?

Steps to Reproduce the bug

  1. Place an old MinecraftClient.ini, servers.txt, and accounts.txt with the new MinecraftClient.exe
  2. Run the new MinecraftClient.exe

Attach screenshot here (If applicable)

No response

Anythings that could help diagnosing the bug

#Minecraft Console Client v1.9.0
#Startup Config File

[Main]

#General settings
#leave blank to prompt user on startup
#Use "-" as password for offline mode

login=a------@----.com
password=-------
serverip=-------
type=microsoft
method=mcc

#Advanced settings

language=en_GB
botowners=Player1,Player2,Player3
consoletitle=%username%@%serverip% - Minecraft Console Client
internalcmdchar=slash #use 'none', 'slash' or 'backslash'
splitmessagedelay=2 #seconds between each part of a long message
botmessagedelay=2 #seconds to delay between message a bot makes to avoid accidental spam
mcversion=1.19.2
brandinfo=mcc #use 'mcc','vanilla', or 'none'
chatbotlogfile=log.txt #leave empty for no logfile
privatemsgscmdname=tell #used by RemoteControl bot
showsystemmessages=true #system messages for server ops
showxpbarmessages=true #messages displayed above xp bar
terrainandmovements=true #false #uses more ram, cpu, bandwidth
sessioncache=memory #use 'none', 'memory' or 'disk'
accountlist=accounts.txt
serverlist=servers.txt
playerheadicon=true
exitonfailure=false
debugmessages=false
scriptcache=true
timestamps=false

[AppVars]
#yourvar=yourvalue
#can be used in some other fields as %yourvar%
#%username% and %serverip% are reserved variables.

[Proxy]
enabled=false #use 'false', 'true', or 'login' for login only
type=HTTP #Supported types: HTTP, SOCKS4, SOCKS4a, SOCKS5
server=0.0.0.0:0000
username=
password=

[ChatFormat]
builtins=true #support for handling vanilla and common message formats
#public=^<([a-zA-Z0-9_]+)> (.+)$ #uncomment and adapt if necessary
#private=^([a-zA-Z0-9_]+) whispers to you: (.+)$ #vanilla example
#tprequest=^([a-zA-Z0-9_]+) has requested (?:to|that you) teleport to (?:you|them)\.$

#Bot Settings

[Alerts]
enabled=false
alertsfile=alerts.txt
excludesfile=alerts-exclude.txt
beeponalert=true

[AntiAFK]
enabled=false
delay=600 #10 = 1s
command=/ping

[AutoRelog]
enabled=false
delay=10
retries=3 #-1 = unlimited
kickmessagesfile=kickmessages.txt

[ChatLog]
enabled=true
timestamps=true
filter=all
logfile=log/chatlog-%username%-%serverip%.txt

[Hangman]
enabled=false
english=true
wordsfile=hangman-en.txt
fichiermots=hangman-fr.txt

[ScriptScheduler]
enabled=false
tasksfile=tasks.ini

[RemoteControl]
enabled=false
autotpaccept=true
tpaccepteveryone=false

[AutoRespond]
enabled=false
matchesfile=matches.ini

Device

Desktop

Operating System

Windows

Server Address (If applicable)

No response

ORelio commented 1 year ago

Thanks for posting a detailed bug report. Indeed, the configuration format changed and it would be nice to be able to convert old configuration files to new ones.

milutinke commented 1 year ago

That would require a lot of work on our side since a lot of the code was replaced. I think we should not support the old format conversion, that part should fall on users.

BruceChenQAQ commented 1 year ago

(1) If changing the format of configuration files, you wouldn't leave a way to read old configuration files intact so they could be imported properly.

When an old settings file is detected, it will prompt The old MinecraftClient.ini has been backed up as MinecraftClient.backup.ini Please use the newly generated MinecraftClient.ini. We can use a different name for it, such as MinecraftClient.old.ini, to distinguish it from the backup.

Since the two settings files use completely different technologies, this would require a lot of dirty work if we want to automate the import, and we haven't implemented it yet due to our lack of developers. Feel free to contribute in this feature.

For the new version of the settings file, it will be able to automatically merge new settings items as they become available in the future, eliminating the need to delete settings and reconfigure them as in the old version.


(2) Failing that, you wouldn't display a reasonable error message.

As much as possible, we provide easy-to-understand default configurations as hints so that the user can be informed of the meaning of the setting and the format in which it is written. For a more detailed description, you can visit our documentation site.

The parsing (deserialization) of the settings file is done through Tolmat. The library should be able to indicate the line number or the section where the error occurred. If you think this is not good enough, please start a discussion in Tolmat-Issue or Tolmat-Discord.


(3) Overwriting the MinecraftClient.ini file makes sense at all. Obviously, my config file worked and I didn't change any settings when running the program, so why the need to revert this file?

There may be new setting items after the upgrade and certain commands will change the settings while MCC is running. Since we don't have a good way to sense these changes, once the serialization produces a file that differs from the existing file, MCC overwrites it and the old file is renamed as a backup.

milutinke commented 6 months ago

Since there has been 2 years of the Settings update there is no point of adding this feature. Thus I'll close the issue.