more pretty log

This commit is contained in:
alexcrea 2025-09-25 20:30:03 +02:00
parent dd2f3204c3
commit 4da017c9be
Signed by: alexcrea
GPG key ID: E346CD16413450E3
3 changed files with 15 additions and 12 deletions

View file

@ -9,19 +9,20 @@ public class Update_1_21 {
private static final Version V1_21 = new Version(1, 21);
public static void handleUpdate(Version current){
public static boolean handleUpdate(Version current){
// Test if we are running in 1.21 or better
if(V1_21.greaterThan(current))
return;
return false;
// 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);
if(oldVersion != null){
var version = Version.fromString(oldVersion);
if(V1_21.lesserEqual(version)) return;
if(V1_21.lesserEqual(version)) return false;
}
doUpdate();
return true;
}
private static void doUpdate() {
@ -86,8 +87,6 @@ public class Update_1_21 {
// imply reload of CONFLICT_HOLDER
// We also do not need to reload base config as there is no object related to it.
ConfigHolder.ITEM_GROUP_HOLDER.reload();
CustomAnvil.instance.getLogger().info("Updating Done !");
}
}

View file

@ -9,19 +9,20 @@ public class Update_1_21_9 {
private static final Version V1_21_9 = new Version(1, 21, 9);
public static void handleUpdate(Version current){
public static boolean handleUpdate(Version current){
// Test if we are running in 1.21.9 or better
if(V1_21_9.greaterThan(current))
return;
return false;
// 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);
if(oldVersion != null){
var version = Version.fromString(oldVersion);
if(V1_21_9.lesserEqual(version)) return;
if(V1_21_9.lesserEqual(version)) return false;
}
doUpdate();
return true;
}
private static void doUpdate() {
@ -52,8 +53,6 @@ public class Update_1_21_9 {
// imply reload of CONFLICT_HOLDER
// We also do not need to reload base config as there is no object related to it.
ConfigHolder.ITEM_GROUP_HOLDER.reload();
CustomAnvil.instance.getLogger().info("Updating Done !");
}
}

View file

@ -57,8 +57,13 @@ public class PluginUpdates {
public static void handleMCVersionUpdate(){
Version current = UpdateUtils.currentMinecraftVersion();
Update_1_21.handleUpdate(current);
Update_1_21_9.handleUpdate(current);
boolean hadUpdate = false;
hadUpdate |= Update_1_21.handleUpdate(current);
hadUpdate |= Update_1_21_9.handleUpdate(current);
if(hadUpdate){
CustomAnvil.instance.getLogger().info("Updating Done !");
}
}
private static void finishConfiguration(@Nonnull String newVersion, @Nonnull Set<ConfigHolder> toSave) {