logic issue fix

This commit is contained in:
alexcrea 2025-09-25 20:24:22 +02:00
parent 5bdd2f9b4c
commit dd2f3204c3
Signed by: alexcrea
GPG key ID: E346CD16413450E3
2 changed files with 6 additions and 10 deletions

View file

@ -5,22 +5,20 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
import static xyz.alexcrea.cuanvil.update.UpdateUtils.addAbsentToList; import static xyz.alexcrea.cuanvil.update.UpdateUtils.addAbsentToList;
// This is a temporary class that aim to handle 1.21 update.
// It will be replaced by a better system later.
public class Update_1_21 { public class Update_1_21 {
private static final Version V1_21 = new Version(1, 21); private static final Version V1_21 = new Version(1, 21);
public static void handleUpdate(Version current){ public static void handleUpdate(Version current){
// Test if we are running in 1.21.1 // Test if we are running in 1.21 or better
if(V1_21.greaterEqual(current)) if(V1_21.greaterThan(current))
return; return;
// if version path is not null then check if its it's before 1.21 // if version path is not null then check if its it's before 1.21
String oldVersion = ConfigHolder.DEFAULT_CONFIG.getConfig().getString(UpdateUtils.MINECRAFT_VERSION_PATH); String oldVersion = ConfigHolder.DEFAULT_CONFIG.getConfig().getString(UpdateUtils.MINECRAFT_VERSION_PATH);
if(oldVersion != null){ if(oldVersion != null){
var version = Version.fromString(oldVersion); var version = Version.fromString(oldVersion);
if(V1_21.greaterEqual(version)) return; if(V1_21.lesserEqual(version)) return;
} }
doUpdate(); doUpdate();

View file

@ -5,22 +5,20 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
import static xyz.alexcrea.cuanvil.update.UpdateUtils.addAbsentToList; import static xyz.alexcrea.cuanvil.update.UpdateUtils.addAbsentToList;
// This is a temporary class that aim to handle 1.21 update.
// It will be replaced by a better system later.
public class Update_1_21_9 { public class Update_1_21_9 {
private static final Version V1_21_9 = new Version(1, 21, 9); private static final Version V1_21_9 = new Version(1, 21, 9);
public static void handleUpdate(Version current){ public static void handleUpdate(Version current){
// Test if we are running in 1.21.1.9 // Test if we are running in 1.21.9 or better
if(V1_21_9.greaterEqual(current)) if(V1_21_9.greaterThan(current))
return; return;
// if version path is not null then check if its it's before 1.21.9 // if version path is not null then check if its it's before 1.21.9
String oldVersion = ConfigHolder.DEFAULT_CONFIG.getConfig().getString(UpdateUtils.MINECRAFT_VERSION_PATH); String oldVersion = ConfigHolder.DEFAULT_CONFIG.getConfig().getString(UpdateUtils.MINECRAFT_VERSION_PATH);
if(oldVersion != null){ if(oldVersion != null){
var version = Version.fromString(oldVersion); var version = Version.fromString(oldVersion);
if(V1_21_9.greaterEqual(version)) return; if(V1_21_9.lesserEqual(version)) return;
} }
doUpdate(); doUpdate();