diff --git a/adapters/bukkit/plugin/src/main/java/art/arcane/iris/IrisRuntime.java b/adapters/bukkit/plugin/src/main/java/art/arcane/iris/IrisRuntime.java index 6437648c0..753dc7bd8 100644 --- a/adapters/bukkit/plugin/src/main/java/art/arcane/iris/IrisRuntime.java +++ b/adapters/bukkit/plugin/src/main/java/art/arcane/iris/IrisRuntime.java @@ -21,6 +21,7 @@ package art.arcane.iris; import art.arcane.iris.api.terrain.IrisTerrainService; import art.arcane.iris.command.CommandSVC; import art.arcane.iris.configuration.IrisSettings; +import art.arcane.iris.configuration.IrisSettingsFile; import art.arcane.iris.configuration.SettingsHotloadWatch; import art.arcane.iris.diagnostics.LogFilterSVC; import art.arcane.iris.diagnostics.splash.IrisSplashComposer; @@ -735,7 +736,7 @@ public final class IrisRuntime implements IrisPluginRuntime { (EngineWorldManagerProvider) IrisWorldManager::new); IrisServices.register(WorldDeletionQueue.class, pendingWorldDeletes); IrisServices.register(ManagedWorldLoader.class, (ManagedWorldLoader) this::loadManagedWorld); - SettingsHotloadWatch watch = new SettingsHotloadWatch(plugin.getDataFile("iris.json")); + SettingsHotloadWatch watch = new SettingsHotloadWatch(plugin.getDataFile(IrisSettingsFile.FILE_NAME)); settingsHotloadWatch = watch; StudioSVC.gateDownloadsOnStaleTempCleanup(MultiBurst.ioBurst.completeValueAsync(() -> { IO.delete(getTemp()); diff --git a/adapters/bukkit/plugin/src/test/gameplay/studio-acceptance.mjs b/adapters/bukkit/plugin/src/test/gameplay/studio-acceptance.mjs index fd3d1fba8..e7b995a7c 100644 --- a/adapters/bukkit/plugin/src/test/gameplay/studio-acceptance.mjs +++ b/adapters/bukkit/plugin/src/test/gameplay/studio-acceptance.mjs @@ -4,12 +4,22 @@ import path from 'node:path' import { packKey, worldKey, seed, parsePhase, setup, exists, writeJson, readJson, openStudio, closeStudio, sampleTerrain, logPosition, logSince } from './studio-support.mjs' +async function disableStudioSideEffects(settingsFile) { + let inStudio = false + const lines = (await readFile(settingsFile, 'utf8')).split('\n').map(line => { + const header = line.match(/^\[(.+)\]\s*$/) + if (header) { + inStudio = header[1] === 'studio' + return line + } + return inStudio ? line.replace(/^(openVSCode|entitySpawning)\s*=.*$/, '$1 = false') : line + }) + await writeFile(settingsFile, lines.join('\n')) +} + async function prepare(context, fixture) { context.expect(!(await exists(fixture.marker)) && !(await exists(fixture.pack)), 'Prepare requires a new disposable instance and an unused fixture pack') - const settingsFile = path.join(fixture.irisRoot, 'iris.json') - const settings = await readJson(settingsFile) - settings.studio = { ...settings.studio, openVSCode: false, entitySpawning: false } - await writeJson(settingsFile, settings) + await disableStudioSideEffects(path.join(fixture.irisRoot, 'iris.toml')) await context.command(`/iris studio create name=${packKey}`, new RegExp(`Created studio project '${packKey}'`), 180000) for (const relative of [`dimensions/${packKey}.json`, 'regions/starter.json', 'biomes/starter.json', `${packKey}.code-workspace`]) { context.expect(await exists(path.join(fixture.pack, relative)), `Studio create omitted ${relative}`) diff --git a/adapters/bukkit/plugin/src/test/java/art/arcane/iris/update/IrisUpdateNotifierTest.java b/adapters/bukkit/plugin/src/test/java/art/arcane/iris/update/IrisUpdateNotifierTest.java index aa2835c0b..9540eed55 100644 --- a/adapters/bukkit/plugin/src/test/java/art/arcane/iris/update/IrisUpdateNotifierTest.java +++ b/adapters/bukkit/plugin/src/test/java/art/arcane/iris/update/IrisUpdateNotifierTest.java @@ -38,11 +38,11 @@ public class IrisUpdateNotifierTest { clearInvocations(service); assertFalse(IrisSettings.applyHotloadSnapshot( - "{\"general\":{\"updateNotifications\":false}}", candidate -> false)); + "[general]\nupdateNotifications = false", candidate -> false)); assertTrue(options.getValue().enabled().getAsBoolean()); verifyNoInteractions(service); - IrisSettings.installHotloadSnapshot("{\"general\":{\"updateNotifications\":false}}"); + IrisSettings.installHotloadSnapshot("[general]\nupdateNotifications = false"); assertFalse(options.getValue().enabled().getAsBoolean()); verify(service).reconfigure(); IrisSettings.settings.getGeneral().setUpdateNotifications(true); @@ -52,7 +52,7 @@ public class IrisUpdateNotifierTest { } verify(service).close(); clearInvocations(service); - IrisSettings.installHotloadSnapshot("{}"); + IrisSettings.installHotloadSnapshot("[general]"); verifyNoInteractions(service); } finally { IrisSettings.settings = previous; diff --git a/adapters/modded-common/src/main/java/art/arcane/iris/modded/localization/ModdedHelpMessages.java b/adapters/modded-common/src/main/java/art/arcane/iris/modded/localization/ModdedHelpMessages.java index 7c01fc66f..f9bf2a841 100644 --- a/adapters/modded-common/src/main/java/art/arcane/iris/modded/localization/ModdedHelpMessages.java +++ b/adapters/modded-common/src/main/java/art/arcane/iris/modded/localization/ModdedHelpMessages.java @@ -36,11 +36,11 @@ public final class ModdedHelpMessages { ); public static final TextKey COMMAND_DEBUG_TOGGLE_IRIS_DEBUG_LOGGING_AND_SAVE_SETTINGS_JSON = TextKey.of( "iris.modded.help.entry.command.debug", - "Toggle Iris debug logging and save iris.json" + "Toggle Iris debug logging and save iris.toml" ); public static final TextKey COMMAND_RELOAD_RELOAD_SETTINGS_JSON_ALSO_HOTLOADED_AUTOMATICALLY_EVERY_3S = TextKey.of( "iris.modded.help.entry.command.reload", - "Reload iris.json (also hotloaded automatically every 3s)" + "Reload iris.toml (also hotloaded automatically every 3s)" ); public static final TextKey COMMAND_DOWNLOAD_DOWNLOAD_A_PACK_PROJECT = TextKey.of( "iris.modded.help.entry.command.download", diff --git a/adapters/modded-common/src/main/java/art/arcane/iris/modded/service/ModdedSettingsHotloadService.java b/adapters/modded-common/src/main/java/art/arcane/iris/modded/service/ModdedSettingsHotloadService.java index 79a5baf5d..3a989a560 100644 --- a/adapters/modded-common/src/main/java/art/arcane/iris/modded/service/ModdedSettingsHotloadService.java +++ b/adapters/modded-common/src/main/java/art/arcane/iris/modded/service/ModdedSettingsHotloadService.java @@ -18,11 +18,10 @@ package art.arcane.iris.modded.service; +import art.arcane.iris.configuration.IrisSettingsFile; import art.arcane.iris.configuration.SettingsHotloadWatch; -import art.arcane.iris.spi.IrisPlatforms; import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeModdedServer; -import java.io.File; import java.util.concurrent.TimeUnit; public final class ModdedSettingsHotloadService implements ModdedTickableService { @@ -31,7 +30,7 @@ public final class ModdedSettingsHotloadService implements ModdedTickableService @Override public void onEnable() { - hotloadWatch = new SettingsHotloadWatch(settingsFile()); + hotloadWatch = new SettingsHotloadWatch(IrisSettingsFile.location()); lastPollAtNanos = 0L; } @@ -58,8 +57,4 @@ public final class ModdedSettingsHotloadService implements ModdedTickableService lastPollAtNanos = now; active.checkConfigHotload(); } - - private static File settingsFile() { - return IrisPlatforms.get().dataFile("iris.json"); - } } diff --git a/core/src/main/java/art/arcane/iris/configuration/IrisSettings.java b/core/src/main/java/art/arcane/iris/configuration/IrisSettings.java index 78d41ba1e..c29631055 100644 --- a/core/src/main/java/art/arcane/iris/configuration/IrisSettings.java +++ b/core/src/main/java/art/arcane/iris/configuration/IrisSettings.java @@ -22,16 +22,11 @@ import art.arcane.iris.world.pregen.MantleHeapPressure; import art.arcane.iris.world.IrisPaperLikeBackendMode; import art.arcane.iris.world.IrisRuntimeSchedulerMode; -import com.google.gson.Gson; import art.arcane.iris.spi.IrisLogging; -import art.arcane.iris.spi.IrisPlatforms; -import art.arcane.volmlib.util.io.IO; -import art.arcane.volmlib.util.json.JSONException; -import art.arcane.volmlib.util.json.JSONObject; import art.arcane.iris.platform.bukkit.plugin.VolmitSender; +import art.arcane.volmlib.util.config.ConfigDoc; import lombok.Data; -import java.io.File; import java.io.IOException; import java.util.Objects; import java.util.concurrent.CopyOnWriteArrayList; @@ -82,49 +77,13 @@ public class IrisSettings { return current; } - current = read(); + current = IrisSettingsFile.load(); settings = current; notifySettingsChanged(current); return current; } } - private static IrisSettings read() { - IrisSettings loaded = new IrisSettings(); - File s = IrisPlatforms.get().dataFile("iris.json"); - - if (!s.exists()) { - try { - IO.writeAll(s, new JSONObject(new Gson().toJson(loaded)).toString(4)); - } catch (JSONException | IOException e) { - IrisLogging.reportError(e); - } - - return loaded; - } - - try { - String ss = IO.readAll(s); - IrisSettings parsed = new Gson().fromJson(ss, IrisSettings.class); - - if (parsed != null) { - loaded = parsed; - } - - try { - IO.writeAll(s, new JSONObject(new Gson().toJson(loaded)).toString(4)); - } catch (IOException e) { - IrisLogging.reportError("Could not rewrite " + s.getAbsolutePath() - + "; settings changes made in game will not survive a restart.", e); - } - } catch (Throwable ee) { - // IrisLogging.reportError(ee); causes a self-reference & stackoverflow - IrisLogging.error("Configuration Error in iris.json! " + ee.getClass().getSimpleName() + ": " + ee.getMessage()); - } - - return loaded; - } - public static void invalidate() { synchronized (SETTINGS_LOCK) { settings = null; @@ -153,23 +112,16 @@ public class IrisSettings { return true; } - public static IrisSettings parseHotloadSnapshot(String rawJson) { - if (rawJson == null || rawJson.isBlank()) { + public static IrisSettings parseHotloadSnapshot(String rawToml) { + if (rawToml == null || rawToml.isBlank()) { throw new IllegalArgumentException("Iris settings snapshot is empty"); } - IrisSettings parsed; try { - parsed = new Gson().fromJson(rawJson, IrisSettings.class); - if (parsed == null) { - throw new IllegalArgumentException("Iris settings snapshot did not contain an object"); - } - } catch (RuntimeException failure) { + return IrisSettingsFile.parse(rawToml); + } catch (IOException | RuntimeException failure) { throw new IllegalArgumentException("Iris settings snapshot is invalid", failure); } - - parsed.fillMissingSections(); - return parsed; } public static void addSettingsListener(Consumer listener) { @@ -187,16 +139,14 @@ public class IrisSettings { } public void forceSave() { - File s = IrisPlatforms.get().dataFile("iris.json"); - try { - IO.writeAll(s, new JSONObject(new Gson().toJson(this)).toString(4)); - } catch (JSONException | IOException e) { + IrisSettingsFile.write(this, IrisSettingsFile.location()); + } catch (IOException e) { IrisLogging.reportError(e); } } - private void fillMissingSections() { + void fillMissingSections() { general = general == null ? new IrisSettingsGeneral() : general; world = world == null ? new IrisSettingsWorld() : world; gui = gui == null ? new IrisSettingsGUI() : gui; @@ -329,6 +279,7 @@ public class IrisSettings { @Data public static class IrisSettingsGeneral { + @ConfigDoc("Default locale for Iris messages, such as en_US or de_DE.") public String language = "en_US"; public boolean metrics = true; public boolean updateNotifications = true; @@ -340,22 +291,16 @@ public class IrisSettings { public boolean splashLogoStartup = true; public boolean useConsoleCustomColors = true; public boolean useCustomColorsIngame = true; - /** - * Boss bars for jobs, Studio opens, chunk jobs, and pack downloads. Ordinary - * world creation uses only its action-bar lifecycle meter; creation-time - * pregeneration retains its dedicated long-running boss bar. - */ + @ConfigDoc(value = "Shows boss bars for jobs, Studio opens, chunk jobs and pack downloads.", + impact = "Ordinary world creation uses only its action-bar meter; creation-time pregeneration keeps its own boss bar.") public boolean progressBossBar = true; public boolean adjustVanillaHeight = false; public boolean autoIngestDatapacks = true; - /** - * Converting every registered datapack structure into editable Iris resources writes - * thousands of objects/pools/pieces into the pack folder. Native generation and - * nativeStructures placements never need those copies, so this stays opt-in; run - * /iris structure import <dimension> when you actually want editable copies. - */ + @ConfigDoc(value = "Converts every registered datapack structure into editable Iris objects, pools and pieces in the pack folder.", + impact = "Writes thousands of files that native generation never needs; run /iris structure import when you want editable copies.") public boolean autoImportDatapackStructures = false; - /** Unresolved pack content keys and bad block-state properties become blocking pack errors. -Diris.strictContent overrides. */ + @ConfigDoc(value = "Turns unresolved pack content keys and bad block-state properties into blocking pack errors.", + impact = "The -Diris.strictContent system property overrides this.") public boolean strictContentKeys = false; public int spinh = -20; public int spins = 7; diff --git a/core/src/main/java/art/arcane/iris/configuration/IrisSettingsFile.java b/core/src/main/java/art/arcane/iris/configuration/IrisSettingsFile.java new file mode 100644 index 000000000..e45df67ff --- /dev/null +++ b/core/src/main/java/art/arcane/iris/configuration/IrisSettingsFile.java @@ -0,0 +1,143 @@ +package art.arcane.iris.configuration; + +import art.arcane.iris.spi.IrisLogging; +import art.arcane.iris.spi.IrisPlatforms; +import art.arcane.volmlib.util.config.TomlCodec; +import com.google.gson.Gson; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; + +/** + * Reads and writes the Iris settings file. Settings live in iris.toml so each key can carry a comment; a file + * left by a build that used iris.json is moved over once on first load. + */ +public final class IrisSettingsFile { + public static final String FILE_NAME = "iris.toml"; + static final String LEGACY_FILE_NAME = "iris.json"; + private static final String SOURCE_TAG = "iris"; + + private IrisSettingsFile() { + } + + public static File location() { + return IrisPlatforms.get().dataFile(FILE_NAME); + } + + public static void write(IrisSettings settings, File file) throws IOException { + Files.createDirectories(file.getAbsoluteFile().getParentFile().toPath()); + Files.writeString(file.toPath(), render(settings), StandardCharsets.UTF_8); + } + + static IrisSettings load() { + File file = location(); + if (file.exists()) { + return loadExisting(file); + } + + File legacyFile = new File(file.getParentFile(), LEGACY_FILE_NAME); + if (legacyFile.exists()) { + return migrateLegacy(legacyFile, file); + } + + IrisSettings defaults = new IrisSettings(); + rewrite(file, defaults); + return defaults; + } + + static IrisSettings parse(String toml) throws IOException { + IrisSettings parsed = TomlCodec.fromToml(toml, IrisSettings.class); + if (parsed == null) { + throw new IOException("Iris settings did not contain a table"); + } + parsed.fillMissingSections(); + return parsed; + } + + static String render(IrisSettings settings) { + return TomlCodec.toToml(settings, SOURCE_TAG); + } + + private static IrisSettings loadExisting(File file) { + String raw; + IrisSettings loaded; + try { + raw = Files.readString(file.toPath(), StandardCharsets.UTF_8); + loaded = parse(raw); + } catch (Throwable failure) { + // reportError reads the settings again while they are still loading, so only log the line. + IrisLogging.error("Configuration Error in " + FILE_NAME + "! " + rootCause(failure) + + ". Using defaults until the file is fixed."); + return new IrisSettings(); + } + + if (!sameContent(raw, render(loaded))) { + rewrite(file, loaded); + } + return loaded; + } + + private static IrisSettings migrateLegacy(File legacyFile, File file) { + IrisSettings migrated; + try { + migrated = parseLegacy(Files.readString(legacyFile.toPath(), StandardCharsets.UTF_8)); + } catch (Throwable failure) { + IrisLogging.error("Configuration Error in " + LEGACY_FILE_NAME + "! " + rootCause(failure) + + ". Using defaults; fix the file to move it to " + FILE_NAME + "."); + return new IrisSettings(); + } + + if (!rewrite(file, migrated)) { + return migrated; + } + deleteMigratedLegacy(legacyFile); + IrisLogging.info("Moved Iris settings from " + LEGACY_FILE_NAME + " to " + FILE_NAME + "."); + return migrated; + } + + private static IrisSettings parseLegacy(String json) { + IrisSettings parsed = new Gson().fromJson(json, IrisSettings.class); + IrisSettings migrated = parsed == null ? new IrisSettings() : parsed; + migrated.fillMissingSections(); + return migrated; + } + + private static boolean rewrite(File file, IrisSettings settings) { + try { + write(settings, file); + return true; + } catch (IOException failure) { + IrisLogging.reportError("Could not rewrite " + file.getAbsolutePath() + + "; settings changes made in game will not survive a restart.", failure); + return false; + } + } + + private static void deleteMigratedLegacy(File legacyFile) { + try { + Files.deleteIfExists(legacyFile.toPath()); + } catch (IOException | SecurityException failure) { + IrisLogging.warn("Could not delete " + legacyFile.getAbsolutePath() + " after moving it to " + + FILE_NAME + ": " + failure.getMessage()); + } + } + + private static boolean sameContent(String raw, String canonical) { + return normalizeLineEndings(raw).strip().equals(normalizeLineEndings(canonical).strip()); + } + + private static String normalizeLineEndings(String text) { + return text.replace("\r\n", "\n"); + } + + private static String rootCause(Throwable failure) { + Throwable root = failure; + while (root.getCause() != null && root.getCause() != root) { + root = root.getCause(); + } + String message = root.getMessage(); + return root.getClass().getSimpleName() + (message == null || message.isBlank() ? "" : ": " + message); + } +} diff --git a/core/src/main/java/art/arcane/iris/configuration/SettingsHotloadWatch.java b/core/src/main/java/art/arcane/iris/configuration/SettingsHotloadWatch.java index 7050a5ccb..43cc34631 100644 --- a/core/src/main/java/art/arcane/iris/configuration/SettingsHotloadWatch.java +++ b/core/src/main/java/art/arcane/iris/configuration/SettingsHotloadWatch.java @@ -112,7 +112,7 @@ public final class SettingsHotloadWatch implements AutoCloseable { boolean missing = "missing".equals(snapshot.signature()); if (isSettingsFile(file)) { if (missing) { - IrisLogging.warn("iris.json was removed; retaining the last valid runtime settings."); + IrisLogging.warn(settingsFile.getName() + " was removed; retaining the last valid runtime settings."); return true; } if (snapshot.normalizedContent() == null) { @@ -258,7 +258,7 @@ public final class SettingsHotloadWatch implements AutoCloseable { File file = delta.file(); if (isSettingsFile(file)) { if (delta.after() != null) { - IrisLogging.debug("Hotloaded iris.json"); + IrisLogging.debug("Hotloaded " + settingsFile.getName()); } return; } diff --git a/core/src/main/java/art/arcane/iris/localization/IrisLanguage.java b/core/src/main/java/art/arcane/iris/localization/IrisLanguage.java index 2b220b929..5b2b868ca 100644 --- a/core/src/main/java/art/arcane/iris/localization/IrisLanguage.java +++ b/core/src/main/java/art/arcane/iris/localization/IrisLanguage.java @@ -1,6 +1,7 @@ package art.arcane.iris.localization; import art.arcane.iris.configuration.IrisSettings; +import art.arcane.iris.configuration.IrisSettingsFile; import art.arcane.iris.spi.CapabilityProbe; import art.arcane.iris.spi.IrisLogging; import art.arcane.iris.spi.IrisPlatforms; @@ -41,7 +42,6 @@ import art.arcane.volmlib.util.localization.TomlLanguageEditor; import art.arcane.volmlib.util.localization.TomlLanguageParser; import art.arcane.volmlib.util.localization.TomlLanguageWriter; import art.arcane.volmlib.util.localization.VolmitLocales; -import com.google.gson.JsonObject; import java.io.File; import java.io.IOException; @@ -49,7 +49,6 @@ import java.io.InputStream; import java.net.URI; import java.nio.file.Path; import java.nio.file.LinkOption; -import java.nio.file.StandardCopyOption; import java.nio.file.attribute.FileTime; import java.time.Instant; import java.util.HashSet; @@ -831,16 +830,9 @@ public final class IrisLanguage { private static void selectDefault(String locale, LocalizationSnapshot prepared) throws Exception { IrisSettings current = IrisSettings.get(); - JsonObject serialized = new Gson().toJsonTree(current).getAsJsonObject(); - serialized.getAsJsonObject("general").addProperty("language", locale); - Path target = dataFolder.toPath().resolve("iris.json"); - Path temporary = Files.createTempFile(target.getParent(), "iris-", ".json.tmp"); - try { - Files.writeString(temporary, serialized.toString()); - Files.move(temporary, target, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING); - } finally { - Files.deleteIfExists(temporary); - } + IrisSettings saved = new Gson().fromJson(new Gson().toJsonTree(current), IrisSettings.class); + saved.getGeneral().setLanguage(locale); + IrisSettingsFile.write(saved, new File(dataFolder, IrisSettingsFile.FILE_NAME)); current.getGeneral().setLanguage(locale); synchronized (SNAPSHOT_LOCK) { MANAGER.install(prepared); diff --git a/core/src/main/java/art/arcane/iris/pack/ContentKeyValidator.java b/core/src/main/java/art/arcane/iris/pack/ContentKeyValidator.java index 3d2e37ad4..6a278f8c2 100644 --- a/core/src/main/java/art/arcane/iris/pack/ContentKeyValidator.java +++ b/core/src/main/java/art/arcane/iris/pack/ContentKeyValidator.java @@ -251,7 +251,7 @@ public final class ContentKeyValidator { /** * Whether unresolved pack content keys are blocking errors instead of warnings. Enabled by - * {@code -Diris.strictContent} or {@code general.strictContentKeys} in iris.json; the system property wins. + * {@code -Diris.strictContent} or {@code general.strictContentKeys} in iris.toml; the system property wins. */ public static boolean strictContent() { String property = System.getProperty(STRICT_PROPERTY); diff --git a/core/src/main/java/art/arcane/iris/pack/datapack/ServerConfigurator.java b/core/src/main/java/art/arcane/iris/pack/datapack/ServerConfigurator.java index d697bea0e..353b8aee2 100644 --- a/core/src/main/java/art/arcane/iris/pack/datapack/ServerConfigurator.java +++ b/core/src/main/java/art/arcane/iris/pack/datapack/ServerConfigurator.java @@ -265,7 +265,7 @@ public class ServerConfigurator { timeouts.raise(file, configuration, "settings.timeout-time", minimum); IrisLogging.warn("Updated " + file + " settings.timeout-time: " + previous + " -> " + minimum + " seconds. Takes effect after a server restart."); - IrisLogging.warn("Disable autoConfiguration.configureSpigotTimeoutTime in iris.json to manage this setting yourself."); + IrisLogging.warn("Disable autoConfiguration.configureSpigotTimeoutTime in iris.toml to manage this setting yourself."); } private static void increasePaperWatchdog() throws IOException, InvalidConfigurationException, ReflectiveOperationException { @@ -283,7 +283,7 @@ public class ServerConfigurator { timeouts.raise(file, configuration, "watchdog.early-warning-delay", minimum); IrisLogging.warn("Updated " + file + " watchdog.early-warning-delay: " + previous + " -> " + minimum + " milliseconds. Takes effect after a server restart."); - IrisLogging.warn("Disable autoConfiguration.configurePaperWatchdogDelay in iris.json to manage this setting yourself."); + IrisLogging.warn("Disable autoConfiguration.configurePaperWatchdogDelay in iris.toml to manage this setting yourself."); } private static ServerTimeoutConfiguration timeoutConfiguration() { diff --git a/core/src/main/resources/languages/de_DE.toml b/core/src/main/resources/languages/de_DE.toml index ca1cbdc21..3e170204a 100644 --- a/core/src/main/resources/languages/de_DE.toml +++ b/core/src/main/resources/languages/de_DE.toml @@ -360,8 +360,8 @@ operator_instruction = "Führe {command} in der Konsole aus oder aktiviere Cheat "entry.command.tp" = "Dich selbst oder einen angegebenen Spieler in eine geladene Iris-Dimension teleportieren" "entry.command.evacuate" = "Alle Spieler aus einer Iris-Dimension zum Spawn der primären Welt teleportieren" "entry.command.seed" = "Seed-Informationen der Welt und Engine anzeigen" -"entry.command.debug" = "Iris-Debugprotokollierung umschalten und iris.json speichern" -"entry.command.reload" = "iris.json neu laden; die Datei wird außerdem automatisch alle 3 Sekunden direkt neu geladen" +"entry.command.debug" = "Iris-Debugprotokollierung umschalten und iris.toml speichern" +"entry.command.reload" = "iris.toml neu laden; die Datei wird außerdem automatisch alle 3 Sekunden direkt neu geladen" "entry.command.download" = "Ein Pack-Projekt herunterladen" "entry.command.catalog" = "Worldgen-Inhalte geladener Mods auflisten, einen Namespace anzeigen oder neu erfassen" "entry.group.ingest" = "Iris-Packs aus den Worldgen-Inhalten geladener Mods erstellen" diff --git a/core/src/main/resources/languages/es_ES.toml b/core/src/main/resources/languages/es_ES.toml index 35cb8a152..e7960ac3d 100644 --- a/core/src/main/resources/languages/es_ES.toml +++ b/core/src/main/resources/languages/es_ES.toml @@ -360,8 +360,8 @@ operator_instruction = "Ejecuta {command} desde la consola (o activa los trucos "entry.command.tp" = "Teletransportarte o teletransportar a otro jugador a una dimensión de Iris cargada" "entry.command.evacuate" = "Teletransportar a todos los jugadores desde una dimensión de Iris al spawn del mundo principal" "entry.command.seed" = "Mostrar información sobre la semilla del mundo y del motor" -"entry.command.debug" = "Alternar el registro de depuración de Iris y guardar iris.json" -"entry.command.reload" = "Recargar iris.json (también se recarga en caliente automáticamente cada 3s)" +"entry.command.debug" = "Alternar el registro de depuración de Iris y guardar iris.toml" +"entry.command.reload" = "Recargar iris.toml (también se recarga en caliente automáticamente cada 3s)" "entry.command.download" = "Descargar un proyecto de pack" "entry.command.catalog" = "Listar el contenido de generación de los mods cargados, mostrar un espacio de nombres o volver a capturarlo" "entry.group.ingest" = "Crear packs de Iris a partir del contenido de generación de los mods cargados" diff --git a/core/src/main/resources/languages/fi_FI.toml b/core/src/main/resources/languages/fi_FI.toml index 3a6578970..7d7788933 100644 --- a/core/src/main/resources/languages/fi_FI.toml +++ b/core/src/main/resources/languages/fi_FI.toml @@ -365,8 +365,8 @@ operator_instruction = "Suorita {command} konsolista (tai ota huijaukset käytt "entry.command.tp" = "Teleporttaa itsesi tai nimetty pelaaja ladattuun Iris-ulottuvuuteen" "entry.command.evacuate" = "Teleportoi kaikki pelaajat Iris-ulottuvuudesta päämaailman spawn-pisteeseen" "entry.command.seed" = "Tulosta maailman ja generaattorin siementiedot" -"entry.command.debug" = "Vaihda Irisin vianetsintäloki päälle/pois ja tallenna iris.json" -"entry.command.reload" = "Lataa iris.json uudelleen (ladataan myös automaattisesti 3 s välein)" +"entry.command.debug" = "Vaihda Irisin vianetsintäloki päälle/pois ja tallenna iris.toml" +"entry.command.reload" = "Lataa iris.toml uudelleen (ladataan myös automaattisesti 3 s välein)" "entry.command.download" = "Lataa pakettiprojekti" "entry.command.catalog" = "Listaa ladattujen modien maailmangenerointisisältö, näytä yksi nimiavaruus tai kerää se uudelleen" "entry.group.ingest" = "Luo Iris-paketteja ladattujen modien maailmangenerointisisällöstä" diff --git a/core/src/main/resources/languages/fr_FR.toml b/core/src/main/resources/languages/fr_FR.toml index a6b38abbd..c8f28b0ea 100644 --- a/core/src/main/resources/languages/fr_FR.toml +++ b/core/src/main/resources/languages/fr_FR.toml @@ -360,8 +360,8 @@ operator_instruction = "Exécutez {command} depuis la console (ou activez les co "entry.command.tp" = "Vous téléporter ou téléporter un joueur nommé vers une dimension Iris chargée" "entry.command.evacuate" = "Téléporter tous les joueurs d'une dimension Iris vers le spawn du monde principal" "entry.command.seed" = "Afficher les informations de graine du monde et du moteur" -"entry.command.debug" = "Basculer les journaux de débogage Iris et enregistrer iris.json" -"entry.command.reload" = "Recharger iris.json (également rechargé à chaud automatiquement toutes les 3s)" +"entry.command.debug" = "Basculer les journaux de débogage Iris et enregistrer iris.toml" +"entry.command.reload" = "Recharger iris.toml (également rechargé à chaud automatiquement toutes les 3s)" "entry.command.download" = "Télécharger un projet de pack" "entry.command.catalog" = "Lister le contenu de génération des mods chargés, afficher un espace de noms ou le capturer à nouveau" "entry.group.ingest" = "Créer des packs Iris à partir du contenu de génération des mods chargés" diff --git a/core/src/main/resources/languages/he_IL.toml b/core/src/main/resources/languages/he_IL.toml index 304652c73..f139856d3 100644 --- a/core/src/main/resources/languages/he_IL.toml +++ b/core/src/main/resources/languages/he_IL.toml @@ -365,8 +365,8 @@ operator_instruction = "יש להריץ את {command} מהקונסולה (או "entry.command.tp" = "שיגור שלך או של שחקן בשם לממד Iris טעון" "entry.command.evacuate" = "שגר את כל השחקנים מממד Iris לנקודת הספאון של העולם הראשי" "entry.command.seed" = "הצג מידע על הזרע של העולם והמנוע" -"entry.command.debug" = "הפעלה/כיבוי של רישום ניפוי באגים של Iris ושמירת iris.json" -"entry.command.reload" = "טעינה מחדש של iris.json (נטען מחדש גם אוטומטית כל 3 שניות)" +"entry.command.debug" = "הפעלה/כיבוי של רישום ניפוי באגים של Iris ושמירת iris.toml" +"entry.command.reload" = "טעינה מחדש של iris.toml (נטען מחדש גם אוטומטית כל 3 שניות)" "entry.command.download" = "הורד פרויקט חבילה" "entry.command.catalog" = "הצג את תוכן יצירת העולם של המודים הטעונים, הצג מרחב שמות אחד או אסוף אותו מחדש" "entry.group.ingest" = "בנה חבילות Iris מתוכן יצירת העולם של המודים הטעונים" diff --git a/core/src/main/resources/languages/it_IT.toml b/core/src/main/resources/languages/it_IT.toml index 4796db3c5..1f2499e70 100644 --- a/core/src/main/resources/languages/it_IT.toml +++ b/core/src/main/resources/languages/it_IT.toml @@ -360,8 +360,8 @@ operator_instruction = "Esegui {command} dalla console oppure abilita i trucchi "entry.command.tp" = "Teletrasporta te stesso o un giocatore specificato in una dimensione Iris caricata" "entry.command.evacuate" = "Teletrasporta tutti i giocatori fuori da una dimensione Iris verso lo spawn del mondo principale" "entry.command.seed" = "Mostra le informazioni sui seed del mondo e dell'Engine" -"entry.command.debug" = "Attiva o disattiva la registrazione di debug Iris e salva iris.json" -"entry.command.reload" = "Ricarica iris.json; il file viene anche ricaricato automaticamente ogni 3 secondi" +"entry.command.debug" = "Attiva o disattiva la registrazione di debug Iris e salva iris.toml" +"entry.command.reload" = "Ricarica iris.toml; il file viene anche ricaricato automaticamente ogni 3 secondi" "entry.command.download" = "Scarica un progetto Pack" "entry.command.catalog" = "Elenca i contenuti di generazione delle mod caricate, mostra un namespace o acquisiscilo di nuovo" "entry.group.ingest" = "Crea pack Iris dai contenuti di generazione delle mod caricate" diff --git a/core/src/main/resources/languages/ja-JP.toml b/core/src/main/resources/languages/ja-JP.toml index 441c4bde7..3b193e628 100644 --- a/core/src/main/resources/languages/ja-JP.toml +++ b/core/src/main/resources/languages/ja-JP.toml @@ -363,8 +363,8 @@ operator_instruction = "コンソールから {command} を実行してくださ "entry.command.tp" = "自分または指定したプレイヤーを読み込み済みの Iris ディメンションへテレポートします" "entry.command.evacuate" = "Iris ディメンション内の全プレイヤーをプライマリーワールドのスポーン地点へ退避させます" "entry.command.seed" = "ワールドとエンジンのシード情報を表示します" -"entry.command.debug" = "Iris のデバッグログを切り替えて iris.json を保存します" -"entry.command.reload" = "iris.json を再読み込みします(3 秒ごとに自動でホットリロードもされます)" +"entry.command.debug" = "Iris のデバッグログを切り替えて iris.toml を保存します" +"entry.command.reload" = "iris.toml を再読み込みします(3 秒ごとに自動でホットリロードもされます)" "entry.command.download" = "パックプロジェクトをダウンロードします" "entry.command.catalog" = "読み込まれた Mod のワールド生成コンテンツを一覧表示し、1 つの名前空間を表示し、または再取得します" "entry.group.ingest" = "読み込まれた Mod のワールド生成コンテンツから Iris パックを作成します" diff --git a/core/src/main/resources/languages/ko_KR.toml b/core/src/main/resources/languages/ko_KR.toml index 749285469..a3e65793c 100644 --- a/core/src/main/resources/languages/ko_KR.toml +++ b/core/src/main/resources/languages/ko_KR.toml @@ -363,8 +363,8 @@ operator_instruction = "콘솔에서 {command}을(를) 실행하세요(싱글 "entry.command.tp" = "자신 또는 지정한 플레이어를 로드된 Iris 차원으로 순간이동합니다" "entry.command.evacuate" = "Iris 차원의 모든 플레이어를 기본 월드 스폰으로 대피시킵니다" "entry.command.seed" = "월드와 엔진의 시드 정보를 표시합니다" -"entry.command.debug" = "Iris 디버그 로깅을 전환하고 iris.json을 저장합니다" -"entry.command.reload" = "iris.json을 다시 로드합니다(3초마다 자동으로 핫 리로드도 수행)" +"entry.command.debug" = "Iris 디버그 로깅을 전환하고 iris.toml을 저장합니다" +"entry.command.reload" = "iris.toml을 다시 로드합니다(3초마다 자동으로 핫 리로드도 수행)" "entry.command.download" = "팩 프로젝트를 다운로드합니다" "entry.command.catalog" = "로드된 모드의 월드 생성 콘텐츠를 나열하거나, 네임스페이스 하나를 표시하거나, 다시 수집합니다" "entry.group.ingest" = "로드된 모드의 월드 생성 콘텐츠로 Iris 팩을 만듭니다" diff --git a/core/src/main/resources/languages/lt_LT.toml b/core/src/main/resources/languages/lt_LT.toml index 49fd93ae6..2b418544c 100644 --- a/core/src/main/resources/languages/lt_LT.toml +++ b/core/src/main/resources/languages/lt_LT.toml @@ -365,8 +365,8 @@ operator_instruction = "Vykdykite {command} iš konsolės (arba vieno žaidėjo "entry.command.tp" = "Teleportuoti save arba nurodytą žaidėją į įkeltą Iris dimensiją" "entry.command.evacuate" = "Teleportuoti visus žaidėjus iš Iris dimensijos į pagrindinio pasaulio atsiradimo vietą" "entry.command.seed" = "Rodyti pasaulio ir variklio sėklos informaciją" -"entry.command.debug" = "Perjungti Iris derinimo žurnalą ir įrašyti iris.json" -"entry.command.reload" = "Įkelti iš naujo iris.json (taip pat įkeliamas automatiškai kas 3s)" +"entry.command.debug" = "Perjungti Iris derinimo žurnalą ir įrašyti iris.toml" +"entry.command.reload" = "Įkelti iš naujo iris.toml (taip pat įkeliamas automatiškai kas 3s)" "entry.command.download" = "Parsisiųsti paketo projektą" "entry.command.catalog" = "Išvardyti įkeltų modų pasaulio generavimo turinį, parodyti vieną vardų sritį arba surinkti jį iš naujo" "entry.group.ingest" = "Kurti Iris paketus iš įkeltų modų pasaulio generavimo turinio" diff --git a/core/src/main/resources/languages/nl_NL.toml b/core/src/main/resources/languages/nl_NL.toml index 871f58cea..f2c1caae0 100644 --- a/core/src/main/resources/languages/nl_NL.toml +++ b/core/src/main/resources/languages/nl_NL.toml @@ -360,8 +360,8 @@ operator_instruction = "Voer {command} uit vanaf de console (of schakel cheats i "entry.command.tp" = "Teleporteer jezelf of een genoemde speler naar een geladen Iris dimensie" "entry.command.evacuate" = "Teleporteer alle spelers uit een Iris-dimensie naar de spawn van de primaire wereld" "entry.command.seed" = "Wereld- en engine-seedinformatie tonen" -"entry.command.debug" = "Iris-debuglogging in-/uitschakelen en iris.json opslaan" -"entry.command.reload" = "iris.json opnieuw laden (wordt ook automatisch elke 3s opnieuw geladen)" +"entry.command.debug" = "Iris-debuglogging in-/uitschakelen en iris.toml opslaan" +"entry.command.reload" = "iris.toml opnieuw laden (wordt ook automatisch elke 3s opnieuw geladen)" "entry.command.download" = "Een pakketproject downloaden" "entry.command.catalog" = "De wereldgeneratie-inhoud van geladen mods tonen, één namespace weergeven of opnieuw vastleggen" "entry.group.ingest" = "Iris-pakketten maken van de wereldgeneratie-inhoud van geladen mods" diff --git a/core/src/main/resources/languages/pl_PL.toml b/core/src/main/resources/languages/pl_PL.toml index 03d68ab3d..e4d135f4b 100644 --- a/core/src/main/resources/languages/pl_PL.toml +++ b/core/src/main/resources/languages/pl_PL.toml @@ -365,8 +365,8 @@ operator_instruction = "Uruchom {command} z konsoli (lub włącz kody w trybie j "entry.command.tp" = "Teleportuj siebie lub wskazanego gracza do wczytanego wymiaru Iris" "entry.command.evacuate" = "Teleportuj wszystkich graczy z wymiaru Iris do spawnu głównego świata" "entry.command.seed" = "Wyświetl informacje o ziarnie świata i silnika" -"entry.command.debug" = "Przełącz logowanie debugowania Iris i zapisz iris.json" -"entry.command.reload" = "Wczytaj ponownie iris.json (wczytywany też automatycznie co 3 s)" +"entry.command.debug" = "Przełącz logowanie debugowania Iris i zapisz iris.toml" +"entry.command.reload" = "Wczytaj ponownie iris.toml (wczytywany też automatycznie co 3 s)" "entry.command.download" = "Pobierz projekt pakietu" "entry.command.catalog" = "Wyświetl zawartość generowania świata wczytanych modów, pokaż jedną przestrzeń nazw lub zbierz ją ponownie" "entry.group.ingest" = "Twórz pakiety Iris z zawartości generowania świata wczytanych modów" diff --git a/core/src/main/resources/languages/pt_PT.toml b/core/src/main/resources/languages/pt_PT.toml index c9fb021fd..525f926a1 100644 --- a/core/src/main/resources/languages/pt_PT.toml +++ b/core/src/main/resources/languages/pt_PT.toml @@ -360,8 +360,8 @@ operator_instruction = "Execute {command} a partir da consola (ou ative os cheat "entry.command.tp" = "Teletransportar-se a si próprio ou a um jogador indicado para uma dimensão Iris carregada" "entry.command.evacuate" = "Teletransportar todos os jogadores de uma dimensão Iris para o spawn do mundo principal" "entry.command.seed" = "Mostrar informações da semente do mundo e do motor" -"entry.command.debug" = "Alternar o registo de depuração do Iris e guardar iris.json" -"entry.command.reload" = "Recarregar iris.json (também carregado automaticamente a cada 3s)" +"entry.command.debug" = "Alternar o registo de depuração do Iris e guardar iris.toml" +"entry.command.reload" = "Recarregar iris.toml (também carregado automaticamente a cada 3s)" "entry.command.download" = "Transferir um projeto de pacote" "entry.command.catalog" = "Listar o conteúdo de geração dos mods carregados, mostrar um namespace ou capturá-lo novamente" "entry.group.ingest" = "Criar pacotes Iris a partir do conteúdo de geração dos mods carregados" diff --git a/core/src/main/resources/languages/ru_RU.toml b/core/src/main/resources/languages/ru_RU.toml index 4137db8ef..b7aae0304 100644 --- a/core/src/main/resources/languages/ru_RU.toml +++ b/core/src/main/resources/languages/ru_RU.toml @@ -365,8 +365,8 @@ operator_instruction = "Выполните {command} из консоли (или "entry.command.tp" = "Телепортировать себя или указанного игрока в загруженное измерение Iris" "entry.command.evacuate" = "Телепортировать всех игроков из измерения Iris на точку спавна основного мира" "entry.command.seed" = "Показать информацию о сиде мира и движка" -"entry.command.debug" = "Переключить журнал отладки Iris и сохранить iris.json" -"entry.command.reload" = "Перезагрузить iris.json (также автоматически загружается каждые 3 секунды)" +"entry.command.debug" = "Переключить журнал отладки Iris и сохранить iris.toml" +"entry.command.reload" = "Перезагрузить iris.toml (также автоматически загружается каждые 3 секунды)" "entry.command.download" = "Скачать проект пакета" "entry.command.catalog" = "Показать генерацию мира загруженных модов, одно пространство имён или собрать каталог заново" "entry.group.ingest" = "Создать пакеты Iris из генерации мира загруженных модов" diff --git a/core/src/main/resources/languages/tr_TR.toml b/core/src/main/resources/languages/tr_TR.toml index f14fc4ff0..0f20006c2 100644 --- a/core/src/main/resources/languages/tr_TR.toml +++ b/core/src/main/resources/languages/tr_TR.toml @@ -365,8 +365,8 @@ operator_instruction = "{command} komutunu konsoldan çalıştırın (veya tek o "entry.command.tp" = "Kendinizi veya adı verilen bir oyuncuyu yüklü bir Iris boyutuna ışınlayın" "entry.command.evacuate" = "Tüm oyuncuları bir Iris boyutundan ana dünyanın spawn noktasına ışınla" "entry.command.seed" = "Dünya ve motor seed bilgilerini göster" -"entry.command.debug" = "Iris hata ayıklama günlüğünü aç/kapat ve iris.json dosyasını kaydet" -"entry.command.reload" = "iris.json dosyasını yeniden yükle (ayrıca her 3 saniyede otomatik olarak yeniden yüklenir)" +"entry.command.debug" = "Iris hata ayıklama günlüğünü aç/kapat ve iris.toml dosyasını kaydet" +"entry.command.reload" = "iris.toml dosyasını yeniden yükle (ayrıca her 3 saniyede otomatik olarak yeniden yüklenir)" "entry.command.download" = "Bir paket projesi indirin" "entry.command.catalog" = "Yüklü modların dünya oluşturma içeriğini listele, tek bir ad alanını göster veya yeniden topla" "entry.group.ingest" = "Yüklü modların dünya oluşturma içeriğinden Iris paketleri oluştur" diff --git a/core/src/main/resources/languages/vi_VI.toml b/core/src/main/resources/languages/vi_VI.toml index 2d3e3d7b7..29c13391b 100644 --- a/core/src/main/resources/languages/vi_VI.toml +++ b/core/src/main/resources/languages/vi_VI.toml @@ -363,8 +363,8 @@ operator_instruction = "Chạy {command} từ console (hoặc bật cheat trong "entry.command.tp" = "Dịch chuyển bạn hoặc một người chơi được chỉ định vào một chiều không gian Iris đã tải" "entry.command.evacuate" = "Dịch chuyển mọi người chơi khỏi chiều không gian Iris đến điểm spawn của thế giới chính" "entry.command.seed" = "Hiển thị thông tin seed của thế giới và engine" -"entry.command.debug" = "Bật/tắt ghi log debug của Iris và lưu iris.json" -"entry.command.reload" = "Tải lại iris.json (cũng được tự động tải lại mỗi 3 giây)" +"entry.command.debug" = "Bật/tắt ghi log debug của Iris và lưu iris.toml" +"entry.command.reload" = "Tải lại iris.toml (cũng được tự động tải lại mỗi 3 giây)" "entry.command.download" = "Tải về dự án gói" "entry.command.catalog" = "Liệt kê nội dung tạo thế giới của các mod đã tải, hiển thị một không gian tên hoặc thu thập lại" "entry.group.ingest" = "Tạo gói Iris từ nội dung tạo thế giới của các mod đã tải" diff --git a/core/src/main/resources/languages/zh_CN.toml b/core/src/main/resources/languages/zh_CN.toml index abc8f1176..590c56b90 100644 --- a/core/src/main/resources/languages/zh_CN.toml +++ b/core/src/main/resources/languages/zh_CN.toml @@ -363,8 +363,8 @@ operator_instruction = "请从控制台执行 {command}(或在单人游戏中 "entry.command.tp" = "将自己或指定玩家传送到已加载的 Iris 维度" "entry.command.evacuate" = "将 Iris 维度中的所有玩家传送到主世界出生点" "entry.command.seed" = "显示世界和引擎的种子信息" -"entry.command.debug" = "切换 Iris 调试日志并保存 iris.json" -"entry.command.reload" = "重新加载 iris.json(也会每 3 秒自动热加载)" +"entry.command.debug" = "切换 Iris 调试日志并保存 iris.toml" +"entry.command.reload" = "重新加载 iris.toml(也会每 3 秒自动热加载)" "entry.command.download" = "下载包项目" "entry.command.catalog" = "列出已加载模组的世界生成内容、显示单个命名空间或重新采集" "entry.group.ingest" = "根据已加载模组的世界生成内容创建 Iris 包" diff --git a/core/src/main/resources/languages/zh_TW.toml b/core/src/main/resources/languages/zh_TW.toml index d97b370aa..2980efb8f 100644 --- a/core/src/main/resources/languages/zh_TW.toml +++ b/core/src/main/resources/languages/zh_TW.toml @@ -363,8 +363,8 @@ operator_instruction = "請從主控台執行 {command}(或在單人遊戲中 "entry.command.tp" = "將自己或指定玩家傳送到已載入的 Iris 維度" "entry.command.evacuate" = "將 Iris 維度中的所有玩家傳送到主要世界出生點" "entry.command.seed" = "顯示世界和引擎的種子資訊" -"entry.command.debug" = "切換 Iris 偵錯記錄並儲存 iris.json" -"entry.command.reload" = "重新載入 iris.json(也會每 3 秒自動熱載入)" +"entry.command.debug" = "切換 Iris 偵錯記錄並儲存 iris.toml" +"entry.command.reload" = "重新載入 iris.toml(也會每 3 秒自動熱載入)" "entry.command.download" = "下載包專案" "entry.command.catalog" = "列出已載入模組的世界生成內容、顯示單一命名空間或重新擷取" "entry.group.ingest" = "根據已載入模組的世界生成內容建立 Iris 包" diff --git a/core/src/test/java/art/arcane/iris/configuration/IrisSettingsDefaultsTest.java b/core/src/test/java/art/arcane/iris/configuration/IrisSettingsDefaultsTest.java index ea1a44d32..d77960af3 100644 --- a/core/src/test/java/art/arcane/iris/configuration/IrisSettingsDefaultsTest.java +++ b/core/src/test/java/art/arcane/iris/configuration/IrisSettingsDefaultsTest.java @@ -1,6 +1,5 @@ package art.arcane.iris.configuration; -import com.google.gson.Gson; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -13,12 +12,11 @@ import static org.junit.Assert.assertThrows; public class IrisSettingsDefaultsTest { @Test - public void updateChecksDefaultOnAndPersistAnExplicitOptOut() { - assertTrue(IrisSettings.parseHotloadSnapshot("{}").getGeneral().isUpdateNotifications()); - IrisSettings optedOut = IrisSettings.parseHotloadSnapshot( - "{\"general\":{\"updateNotifications\":false}}"); + public void updateChecksDefaultOnAndPersistAnExplicitOptOut() throws Exception { + assertTrue(IrisSettings.parseHotloadSnapshot("[general]").getGeneral().isUpdateNotifications()); + IrisSettings optedOut = IrisSettings.parseHotloadSnapshot("[general]\nupdateNotifications = false"); assertFalse(optedOut.getGeneral().isUpdateNotifications()); - assertFalse(new Gson().fromJson(new Gson().toJson(optedOut), IrisSettings.class) + assertFalse(IrisSettingsFile.parse(IrisSettingsFile.render(optedOut)) .getGeneral().isUpdateNotifications()); } @@ -33,20 +31,20 @@ public class IrisSettingsDefaultsTest { } @Test - public void concurrencyIsNotSerializedIntoIrisJson() { - String json = new Gson().toJson(new IrisSettings()); + public void concurrencyIsNotWrittenToTheSettingsFile() { + String toml = IrisSettingsFile.render(new IrisSettings()); - assertFalse("iris.json must not advertise an unconfigurable concurrency block", - json.contains("\"concurrency\"")); + assertFalse("iris.toml must not advertise an unconfigurable concurrency block", + toml.contains("concurrency")); } @Test public void languageAndMetricsAreTheFirstGeneralControls() { - String json = new Gson().toJson(new IrisSettings()); + String toml = IrisSettingsFile.render(new IrisSettings()); - int language = json.indexOf("\"language\""); - int metrics = json.indexOf("\"metrics\""); - int commandSounds = json.indexOf("\"commandSounds\""); + int language = toml.indexOf("\nlanguage = "); + int metrics = toml.indexOf("\nmetrics = "); + int commandSounds = toml.indexOf("\ncommandSounds = "); assertTrue(language >= 0); assertTrue(language < metrics); assertTrue(metrics < commandSounds); @@ -75,10 +73,10 @@ public class IrisSettingsDefaultsTest { public void studioBlendingDefaultsOnAndAcceptsDisabledHotload() { IrisSettings defaults = new IrisSettings(); assertTrue(defaults.getStudio().isBlendChanges()); - assertTrue(new Gson().fromJson("{\"studio\":{}}", IrisSettings.class).getStudio().isBlendChanges()); - assertTrue(new Gson().toJson(defaults).contains("\"blendChanges\":true")); + assertTrue(IrisSettings.parseHotloadSnapshot("[studio]").getStudio().isBlendChanges()); + assertTrue(IrisSettingsFile.render(defaults).contains("\nblendChanges = true")); - IrisSettings changed = IrisSettings.parseHotloadSnapshot("{\"studio\":{\"blendChanges\":false}}"); + IrisSettings changed = IrisSettings.parseHotloadSnapshot("[studio]\nblendChanges = false"); assertFalse(changed.getStudio().isBlendChanges()); assertEquals(256, changed.getGenerator().getGenerationTransitionWidthBlocks()); @@ -91,11 +89,10 @@ public class IrisSettingsDefaultsTest { IrisSettings.settings = live; try { assertThrows(IllegalArgumentException.class, - () -> IrisSettings.installHotloadSnapshot("{\"general\":")); + () -> IrisSettings.installHotloadSnapshot("[general")); assertSame(live, IrisSettings.settings); - IrisSettings installed = IrisSettings.installHotloadSnapshot( - "{\"general\":{\"language\":\"fr_FR\"},\"world\":null}"); + IrisSettings installed = IrisSettings.installHotloadSnapshot("[general]\nlanguage = \"fr_FR\""); assertSame(installed, IrisSettings.settings); assertEquals("fr_FR", installed.getGeneral().getLanguage()); assertNotNull(installed.getWorld()); @@ -112,7 +109,7 @@ public class IrisSettingsDefaultsTest { IrisSettings.settings = live; try { boolean applied = IrisSettings.applyHotloadSnapshot( - "{\"general\":{\"language\":\"de_DE\"}}", + "[general]\nlanguage = \"de_DE\"", candidate -> false ); @@ -131,7 +128,7 @@ public class IrisSettingsDefaultsTest { IrisSettings.settings = live; try { boolean applied = IrisSettings.applyHotloadSnapshot( - "{\"general\":{\"language\":\"de_DE\"},\"world\":null}", + "[general]\nlanguage = \"de_DE\"", candidate -> "de_DE".equals(candidate.getGeneral().getLanguage()) ); diff --git a/core/src/test/java/art/arcane/iris/configuration/IrisSettingsFileTest.java b/core/src/test/java/art/arcane/iris/configuration/IrisSettingsFileTest.java new file mode 100644 index 000000000..6986f8586 --- /dev/null +++ b/core/src/test/java/art/arcane/iris/configuration/IrisSettingsFileTest.java @@ -0,0 +1,144 @@ +package art.arcane.iris.configuration; + +import art.arcane.iris.spi.IrisPlatform; +import art.arcane.iris.spi.IrisPlatforms; +import art.arcane.iris.world.IrisRuntimeSchedulerMode; +import com.google.gson.Gson; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.attribute.FileTime; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +public class IrisSettingsFileTest { + private static final FileTime LONG_AGO = FileTime.fromMillis(1_000_000L); + + @Rule + public TemporaryFolder temporaryFolder = new TemporaryFolder(); + + private IrisPlatform previousPlatform; + private IrisSettings previousSettings; + private File settingsFile; + private File legacyFile; + + @Before + public void bindPlatform() throws Exception { + previousSettings = IrisSettings.settings; + previousPlatform = IrisPlatforms.isBound() ? IrisPlatforms.get() : null; + IrisPlatforms.unbind(); + File dataFolder = temporaryFolder.newFolder("Iris"); + settingsFile = new File(dataFolder, IrisSettingsFile.FILE_NAME); + legacyFile = new File(dataFolder, IrisSettingsFile.LEGACY_FILE_NAME); + IrisPlatform platform = mock(IrisPlatform.class); + doReturn(settingsFile).when(platform).dataFile(IrisSettingsFile.FILE_NAME); + IrisPlatforms.bind(platform); + } + + @After + public void restore() { + IrisPlatforms.unbind(); + if (previousPlatform != null) { + IrisPlatforms.bind(previousPlatform); + } + IrisSettings.settings = previousSettings; + } + + @Test + public void writtenSettingsReadBackUnchanged() throws Exception { + IrisSettings edited = new IrisSettings(); + edited.getGeneral().setLanguage("de_DE"); + edited.getGeneral().setDebug(true); + edited.getWorld().setAsyncTickIntervalMS(1_250L); + edited.getWorld().setTargetSpawnEntitiesPerChunk(1.5D); + edited.getPregen().setRuntimeSchedulerMode(IrisRuntimeSchedulerMode.FOLIA); + edited.getPerformance().getEngineSVC().setParallelism(6); + + String rendered = IrisSettingsFile.render(edited); + IrisSettings readBack = IrisSettingsFile.parse(rendered); + + assertEquals(new Gson().toJson(edited), new Gson().toJson(readBack)); + assertEquals(rendered, IrisSettingsFile.render(readBack)); + } + + @Test + public void missingFileIsCreatedFromDefaults() throws Exception { + IrisSettings loaded = IrisSettingsFile.load(); + + assertEquals(new Gson().toJson(new IrisSettings()), new Gson().toJson(loaded)); + assertEquals(IrisSettingsFile.render(new IrisSettings()), Files.readString(settingsFile.toPath())); + } + + @Test + public void legacyJsonMovesToToml() throws Exception { + Files.writeString(legacyFile.toPath(), "{\"general\":{\"debug\":true},\"pregen\":{\"runtimeSchedulerMode\":\"FOLIA\"}}"); + + IrisSettings loaded = IrisSettingsFile.load(); + + assertTrue(loaded.getGeneral().isDebug()); + assertEquals(IrisRuntimeSchedulerMode.FOLIA, loaded.getPregen().getRuntimeSchedulerMode()); + assertFalse(legacyFile.exists()); + assertTrue(IrisSettingsFile.parse(Files.readString(settingsFile.toPath())).getGeneral().isDebug()); + } + + @Test + public void brokenLegacyJsonStaysWhereItIs() throws Exception { + Files.writeString(legacyFile.toPath(), "{\"general\":"); + + IrisSettings loaded = IrisSettingsFile.load(); + + assertFalse(loaded.getGeneral().isDebug()); + assertEquals("{\"general\":", Files.readString(legacyFile.toPath())); + assertFalse(settingsFile.exists()); + } + + @Test + public void brokenTomlIsNotOverwritten() throws Exception { + String broken = "[general]\ndebug = tru\n"; + Files.writeString(settingsFile.toPath(), broken); + + IrisSettings loaded = IrisSettingsFile.load(); + + assertFalse(loaded.getGeneral().isDebug()); + assertEquals(broken, Files.readString(settingsFile.toPath())); + } + + @Test + public void upToDateFileIsNotRewritten() throws Exception { + Files.writeString(settingsFile.toPath(), IrisSettingsFile.render(new IrisSettings())); + Files.setLastModifiedTime(settingsFile.toPath(), LONG_AGO); + + IrisSettingsFile.load(); + + assertEquals(LONG_AGO, Files.getLastModifiedTime(settingsFile.toPath())); + } + + @Test + public void missingKeysAreAddedOnLoad() throws Exception { + Files.writeString(settingsFile.toPath(), "[general]\ndebug = true\n"); + + IrisSettingsFile.load(); + + String rewritten = Files.readString(settingsFile.toPath()); + assertTrue(rewritten.contains("\ndebug = true")); + assertTrue(rewritten.contains("\n[studio]")); + } + + @Test + public void documentedSettingsCarryTheirComment() { + String rendered = IrisSettingsFile.render(new IrisSettings()); + + assertTrue(rendered.contains("# Turns unresolved pack content keys and bad block-state properties into blocking pack errors.\n" + + "# Effect: The -Diris.strictContent system property overrides this.\n" + + "strictContentKeys = false\n")); + } +} diff --git a/core/src/test/java/art/arcane/iris/configuration/IrisSettingsRewriteFailureTest.java b/core/src/test/java/art/arcane/iris/configuration/IrisSettingsRewriteFailureTest.java index 9a952e709..5446fec0f 100644 --- a/core/src/test/java/art/arcane/iris/configuration/IrisSettingsRewriteFailureTest.java +++ b/core/src/test/java/art/arcane/iris/configuration/IrisSettingsRewriteFailureTest.java @@ -21,7 +21,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; /** - * Iris rewrites iris.json on every read so a file written by an older build gains the keys it is missing. + * Iris rewrites iris.toml on every read that finds it out of date so a file written by an older build gains the keys it is missing. * That write used to fail into an empty catch, which is how a read-only or full data folder turned every * settings change an operator made in game into something that silently vanished on the next boot. */ @@ -53,10 +53,10 @@ public class IrisSettingsRewriteFailureTest { @Test public void anUnwritableSettingsFileIsReported() throws Exception { - File settingsFile = temporaryFolder.newFile("iris.json"); - Files.writeString(settingsFile.toPath(), "{}"); + File settingsFile = temporaryFolder.newFile(IrisSettingsFile.FILE_NAME); + Files.writeString(settingsFile.toPath(), "[general]"); assertTrue("this test needs a file the JVM can mark read-only", settingsFile.setWritable(false)); - doReturn(settingsFile).when(capturingPlatform).dataFile("iris.json"); + doReturn(settingsFile).when(capturingPlatform).dataFile(IrisSettingsFile.FILE_NAME); IrisSettings.invalidate(); IrisSettings.get(); @@ -66,14 +66,14 @@ public class IrisSettingsRewriteFailureTest { @Test public void aWritableSettingsFileIsRewrittenQuietly() throws Exception { - File settingsFile = temporaryFolder.newFile("iris.json"); - Files.writeString(settingsFile.toPath(), "{}"); - doReturn(settingsFile).when(capturingPlatform).dataFile("iris.json"); + File settingsFile = temporaryFolder.newFile(IrisSettingsFile.FILE_NAME); + Files.writeString(settingsFile.toPath(), "[general]"); + doReturn(settingsFile).when(capturingPlatform).dataFile(IrisSettingsFile.FILE_NAME); IrisSettings.invalidate(); IrisSettings.get(); verify(capturingPlatform, never()).reportError(anyString(), any(Throwable.class)); - assertTrue(Files.readString(settingsFile.toPath()).contains("general")); + assertTrue(Files.readString(settingsFile.toPath()).contains("[general]")); } } diff --git a/core/src/test/java/art/arcane/iris/configuration/SettingsHotloadWatchTest.java b/core/src/test/java/art/arcane/iris/configuration/SettingsHotloadWatchTest.java index b3da94385..ba6afaefe 100644 --- a/core/src/test/java/art/arcane/iris/configuration/SettingsHotloadWatchTest.java +++ b/core/src/test/java/art/arcane/iris/configuration/SettingsHotloadWatchTest.java @@ -48,7 +48,7 @@ public class SettingsHotloadWatchTest { public void setUp() throws Exception { previousSettings = IrisSettings.settings; dataFolder = temporaryFolder.newFolder("iris-hotload"); - settingsFile = new File(dataFolder, "iris.json"); + settingsFile = new File(dataFolder, IrisSettingsFile.FILE_NAME); overrideFolder = new File(dataFolder, "languages"); Files.createDirectories(overrideFolder.toPath()); String settings = settings("en_US"); @@ -416,7 +416,7 @@ public class SettingsHotloadWatchTest { } private String settings(String locale) { - return "{\"general\":{\"language\":\"" + locale + "\"}}"; + return "[general]\nlanguage = \"" + locale + "\"\n"; } private String locale(String locale, String permissionMessage) { diff --git a/core/src/test/java/art/arcane/iris/generation/runtime/EngineShutdownDrainTest.java b/core/src/test/java/art/arcane/iris/generation/runtime/EngineShutdownDrainTest.java index 6158663f4..80d25e229 100644 --- a/core/src/test/java/art/arcane/iris/generation/runtime/EngineShutdownDrainTest.java +++ b/core/src/test/java/art/arcane/iris/generation/runtime/EngineShutdownDrainTest.java @@ -1,5 +1,6 @@ package art.arcane.iris.generation.runtime; +import art.arcane.iris.configuration.IrisSettingsFile; import art.arcane.iris.pack.loading.IrisData; import art.arcane.iris.generation.runtime.EngineRuntimeBuilder.RuntimeAssembly; import art.arcane.iris.structure.nativegen.NativeStructureOwnershipStore; @@ -87,7 +88,7 @@ public class EngineShutdownDrainTest { previousPlatform = IrisPlatforms.isBound() ? IrisPlatforms.get() : null; IrisPlatforms.unbind(); IrisPlatform platform = mock(IrisPlatform.class); - when(platform.dataFile("iris.json")).thenReturn(PLATFORM_FILES.getRoot().toPath().resolve("iris.json").toFile()); + when(platform.dataFile(IrisSettingsFile.FILE_NAME)).thenReturn(PLATFORM_FILES.getRoot().toPath().resolve(IrisSettingsFile.FILE_NAME).toFile()); PlatformRegistries registries = mock(PlatformRegistries.class); when(platform.registries()).thenReturn(registries); when(registries.block(anyString())).thenReturn(mock(NativeBlockState.class)); diff --git a/core/src/test/java/art/arcane/iris/localization/IrisLanguageTest.java b/core/src/test/java/art/arcane/iris/localization/IrisLanguageTest.java index a54a0b247..b04abdaae 100644 --- a/core/src/test/java/art/arcane/iris/localization/IrisLanguageTest.java +++ b/core/src/test/java/art/arcane/iris/localization/IrisLanguageTest.java @@ -1,6 +1,7 @@ package art.arcane.iris.localization; import art.arcane.iris.configuration.IrisSettings; +import art.arcane.iris.configuration.IrisSettingsFile; import art.arcane.iris.testsupport.ProjectPaths; import art.arcane.volmlib.util.localization.MessageArgument; import art.arcane.volmlib.util.localization.LocaleOverlay; @@ -171,7 +172,7 @@ public class IrisLanguageTest { IrisSettings previous = IrisSettings.settings; IrisSettings current = new IrisSettings(); IrisSettings.settings = current; - Files.createDirectory(dataFolder.toPath().resolve("iris.json")); + Files.createDirectory(dataFolder.toPath().resolve(IrisSettingsFile.FILE_NAME)); IrisLanguage.start(); try { assertThrows(ExecutionException.class, @@ -525,7 +526,7 @@ public class IrisLanguageTest { IrisSettings.settings = live; try { boolean applied = IrisSettings.applyHotloadSnapshot( - "{\"general\":{\"language\":\"../invalid\"}}", + "[general]\nlanguage = \"../invalid\"", IrisLanguage::reload );