ClicksPerSecond's logo

ClicksPerSecond v

Reformats all data in all scoreboards (that use an outdated data format from plugin version 2.4 and lower) in currently used data storage. As of version 2.5, many things changed about data formatting. CPS-test records are saved differently in both scoreboard.yml and database to reduce disk usage and improve efficiency. Therefore, all data need to be reformatted.

ClicksPerSecond plugin automatically checks the data format version of all scoreboards when it enables and everytime it connects to a database. If it detects an outdated data format version in any scoreboard, all processes and commands will be blocked, except the reformat and reload command (data-fetching processes would not work as the code is designed for newer format version, CPS-test records could be queued, but any server restart will lose these - so just run the process and everything will be functional once again).

If using database, format checking can take some time (max. 3s, depends on the connection speed of your database), please note that again, all processes and commands (except reformat and reload commands) are blocked, until the format versions of all scoreboards is determined. If checking for format version failed (see the console), plugin reload is needed.

Command:

You can reformat all data using the reformat command with this syntax:

Reformat command syntax

/cps reformat

If running for the first time, confirmation message will be displayed. To confirm, you must run the command again within the set timeout (20 seconds by default). Please note that only one instance of the command can be active at one time.

If you have ClicksPerSecond plugin on more than one server, it is enough if only one instance reformats the data. After the operation finishes, you can restart all servers, or use reload command to reload the plugin.

Requirements and recommendations:

To access this operation, several things are required:

If the process fails, plugin is able to run the process again from the last operation and finish it without losing any data. However, making a copy of the data storage (of all data stored) is strongly recommended in case of any unexpected failure. Developer is not be responsible for any data loses.

Process phases:

During the whole process the command sender (player or console) will be informed about phase changes. Here you can see all phases, their order, descriptions, corresponding messages in config.yml.

Common phases:

These phases are the same no matter if reformatting FILE or DATABASE data storage.

Order Description Corresponding message
1st Format version of every scoreboard is being rechecked and scoreboards that use an outdated data format are determined. command.main.reformat.phase.rechecking
2nd Process goes through all steps listed below, for every scoreboard, that had been detected before as using an outdated data format version. -

Scoreboard reformatting phases:

These phases apply while reformatting a scoreboard in the FILE data storage.

Order Description Corresponding message Data-risky1
1st All data are being got from the scoreboard. command.main.reformat.phase.getting No
2nd Data are being reformatted to the latest format version. command.main.reformat.phase.reformatting No
3rd Checks if the scoreboard is empty, if so, sends a message and the process skips directly to the 6th step. command.main.reformat.phase.skipping No
4th Reformatted data are being converted into strings (to be saved after), notifies the command sender about progress as per set delay. command.main.reformat.phase.file.converting.message No
5th Reformatted data are being written into the file (replacing the old scoreboard with the reformatted one). command.main.reformat.phase.file.writing Can't fail.
6th Scoreboard's data format version is being updated (in code and scoreboard.yml file). - Can't fail.
7th Finished reformatting the scoreboard. command.main.reformat.phase.finished Can't fail.

These phases apply while reformatting a scoreboard in the DATABASE data storage.

Order Description Corresponding message Data-risky1
1st All data are being got from the scoreboard. command.main.reformat.phase.getting No
2nd Data are being reformatted to the latest format version. command.main.reformat.phase.reformatting No
3rd Checks if the scoreboard is empty, if so, sends a message and the process skips directly to the 6th step. command.main.reformat.phase.skipping No
4th Database table is being deleted and recreated. command.main.reformat.phase.database.recreatingTable Yes
5th Reformatted data are being written into the database, notifies the command sender about progress as per set delay. command.main.reformat.phase.database.writing.message Yes
6th Scoreboard's data format version is being updated (in code). - Can't fail.
7th Finished reformatting the scoreboard. command.main.reformat.phase.finished Can't fail.

Errors:

File-sided errors:

Errors if reformatting the FILE data storage. As no phase in file reformatting is marked as data-risky (data can be lost forever if the process fails in phase marked as data-risky), don't worry if you get this error, no data will be lost, just restart the process.

Description Corresponding message
An error has occurred (the error will be displayed in the console). command.main.reformat.error.file.error

Database-sided errors:

Errors if reformatting the DATABASE data storage:

Description Corresponding message
An error has occurred due to lost connection to the database server. command.main.reformat.error.database.disconnected
An other error (not caused by disconnection) has occurred (full error will be displayed in the console). command.main.reformat.error.database.other

After every database error you will get another message (post-error message) informing about how will the process continue:

Description Corresponding message
The process did not fail in a data-risky phase, you should restart the process. command.main.reformat.error.database.post.restart
The process failed in a data-risky phase because of a disconnection error, the process will be resumed automatically when the plugin reconnects. command.main.reformat.error.database.post.resume
The process failed in a data-risky phase because of another error (not caused by diconnection), the process will retry the last operation and continue in 5 seconds. command.main.reformat.error.database.post.retryWait

Please, don't shut down the server unless you get the ,,finished" message.

1data-risky phase - data will be lost forever if the process fails in this phase and the server/plugin is restarted.