Allow conversion of v1-v3 data snapshots

feat/data-edit-commands
William 1 year ago
parent 7034a97d3a
commit 856cbb9caa
No known key found for this signature in database

@ -41,6 +41,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.OffsetDateTime;
import java.util.*;
import java.util.logging.Level;
public class BukkitLegacyConverter extends LegacyConverter {
@ -55,10 +56,7 @@ public class BukkitLegacyConverter extends LegacyConverter {
final JSONObject object = new JSONObject(plugin.getDataAdapter().bytesToString(data));
final int version = object.getInt("format_version");
if (version != 3) {
throw new DataAdapter.AdaptionException(String.format(
"Unsupported legacy data format version: %s. Please downgrade to an earlier version of HuskSync, " +
"perform a manual legacy migration, then attempt to upgrade again.", version
));
plugin.log(Level.WARNING, String.format("Converting data from older v2 data format (%s).", version));
}
// Read legacy data from the JSON object

@ -45,7 +45,7 @@ public class DataSnapshot {
/*
* Current version of the snapshot data format.
* HuskSync v3.0 uses v4; HuskSync v2.0 uses v3. HuskSync v1.0 uses v1 or v2
* HuskSync v3.0 uses v4; HuskSync v2.0 uses v1-v3
*/
protected static final int CURRENT_FORMAT_VERSION = 4;
@ -240,12 +240,6 @@ public class DataSnapshot {
/**
* Get the format version of the snapshot (indicating the version of HuskSync that created it)
* <ul>
* <li>1: HuskSync v1.0+</li>
* <li>2: HuskSync v1.5+</li>
* <li>3: HuskSync v2.0+</li>
* <li>4: HuskSync v3.0+</li>
* </ul>
*
* @return The format version of the snapshot
* @since 3.0

Loading…
Cancel
Save