mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-02 19:22:08 +00:00
Store Iris settings in iris.toml
- Read and write settings through VolmLib TomlCodec - Comment settings that carry a ConfigDoc - Add missing keys in place, keep admin edits - Leave a broken iris.toml untouched and run on defaults - Convert iris.json to iris.toml on first load - Rename converted iris.json to iris.json.migrated - Point help text and warnings at iris.toml
This commit is contained in:
1 parent
94648946d9
commit
76fdfd43cd
36 files changed
+577
-176
No files matched your search
@@ -21,6 +21,7 @@ package art.arcane.iris;
|
|||||||
import art.arcane.iris.api.terrain.IrisTerrainService;
|
import art.arcane.iris.api.terrain.IrisTerrainService;
|
||||||
import art.arcane.iris.command.CommandSVC;
|
import art.arcane.iris.command.CommandSVC;
|
||||||
import art.arcane.iris.configuration.IrisSettings;
|
import art.arcane.iris.configuration.IrisSettings;
|
||||||
|
import art.arcane.iris.configuration.IrisSettingsFile;
|
||||||
import art.arcane.iris.configuration.SettingsHotloadWatch;
|
import art.arcane.iris.configuration.SettingsHotloadWatch;
|
||||||
import art.arcane.iris.diagnostics.LogFilterSVC;
|
import art.arcane.iris.diagnostics.LogFilterSVC;
|
||||||
import art.arcane.iris.diagnostics.splash.IrisSplashComposer;
|
import art.arcane.iris.diagnostics.splash.IrisSplashComposer;
|
||||||
@@ -737,7 +738,7 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
|||||||
(EngineWorldManagerProvider) IrisWorldManager::new);
|
(EngineWorldManagerProvider) IrisWorldManager::new);
|
||||||
IrisServices.register(WorldDeletionQueue.class, pendingWorldDeletes);
|
IrisServices.register(WorldDeletionQueue.class, pendingWorldDeletes);
|
||||||
IrisServices.register(ManagedWorldLoader.class, (ManagedWorldLoader) this::loadManagedWorld);
|
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;
|
settingsHotloadWatch = watch;
|
||||||
StudioSVC.gateDownloadsOnStaleTempCleanup(MultiBurst.ioBurst.completeValueAsync(() -> {
|
StudioSVC.gateDownloadsOnStaleTempCleanup(MultiBurst.ioBurst.completeValueAsync(() -> {
|
||||||
IO.delete(getTemp());
|
IO.delete(getTemp());
|
||||||
|
|||||||
@@ -4,12 +4,22 @@ import path from 'node:path'
|
|||||||
import { packKey, worldKey, seed, parsePhase, setup, exists, writeJson, readJson,
|
import { packKey, worldKey, seed, parsePhase, setup, exists, writeJson, readJson,
|
||||||
openStudio, closeStudio, sampleTerrain, logPosition, logSince } from './studio-support.mjs'
|
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) {
|
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')
|
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')
|
await disableStudioSideEffects(path.join(fixture.irisRoot, 'iris.toml'))
|
||||||
const settings = await readJson(settingsFile)
|
|
||||||
settings.studio = { ...settings.studio, openVSCode: false, entitySpawning: false }
|
|
||||||
await writeJson(settingsFile, settings)
|
|
||||||
await context.command(`/iris studio create name=${packKey}`, new RegExp(`Created studio project '${packKey}'`), 180000)
|
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`]) {
|
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}`)
|
context.expect(await exists(path.join(fixture.pack, relative)), `Studio create omitted ${relative}`)
|
||||||
|
|||||||
+3
-3
@@ -38,11 +38,11 @@ public class IrisUpdateNotifierTest {
|
|||||||
|
|
||||||
clearInvocations(service);
|
clearInvocations(service);
|
||||||
assertFalse(IrisSettings.applyHotloadSnapshot(
|
assertFalse(IrisSettings.applyHotloadSnapshot(
|
||||||
"{\"general\":{\"updateNotifications\":false}}", candidate -> false));
|
"[general]\nupdateNotifications = false", candidate -> false));
|
||||||
assertTrue(options.getValue().enabled().getAsBoolean());
|
assertTrue(options.getValue().enabled().getAsBoolean());
|
||||||
verifyNoInteractions(service);
|
verifyNoInteractions(service);
|
||||||
|
|
||||||
IrisSettings.installHotloadSnapshot("{\"general\":{\"updateNotifications\":false}}");
|
IrisSettings.installHotloadSnapshot("[general]\nupdateNotifications = false");
|
||||||
assertFalse(options.getValue().enabled().getAsBoolean());
|
assertFalse(options.getValue().enabled().getAsBoolean());
|
||||||
verify(service).reconfigure();
|
verify(service).reconfigure();
|
||||||
IrisSettings.settings.getGeneral().setUpdateNotifications(true);
|
IrisSettings.settings.getGeneral().setUpdateNotifications(true);
|
||||||
@@ -52,7 +52,7 @@ public class IrisUpdateNotifierTest {
|
|||||||
}
|
}
|
||||||
verify(service).close();
|
verify(service).close();
|
||||||
clearInvocations(service);
|
clearInvocations(service);
|
||||||
IrisSettings.installHotloadSnapshot("{}");
|
IrisSettings.installHotloadSnapshot("[general]");
|
||||||
verifyNoInteractions(service);
|
verifyNoInteractions(service);
|
||||||
} finally {
|
} finally {
|
||||||
IrisSettings.settings = previous;
|
IrisSettings.settings = previous;
|
||||||
|
|||||||
+2
-2
@@ -36,11 +36,11 @@ public final class ModdedHelpMessages {
|
|||||||
);
|
);
|
||||||
public static final TextKey COMMAND_DEBUG_TOGGLE_IRIS_DEBUG_LOGGING_AND_SAVE_SETTINGS_JSON = TextKey.of(
|
public static final TextKey COMMAND_DEBUG_TOGGLE_IRIS_DEBUG_LOGGING_AND_SAVE_SETTINGS_JSON = TextKey.of(
|
||||||
"iris.modded.help.entry.command.debug",
|
"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(
|
public static final TextKey COMMAND_RELOAD_RELOAD_SETTINGS_JSON_ALSO_HOTLOADED_AUTOMATICALLY_EVERY_3S = TextKey.of(
|
||||||
"iris.modded.help.entry.command.reload",
|
"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(
|
public static final TextKey COMMAND_DOWNLOAD_DOWNLOAD_A_PACK_PROJECT = TextKey.of(
|
||||||
"iris.modded.help.entry.command.download",
|
"iris.modded.help.entry.command.download",
|
||||||
|
|||||||
+2
-7
@@ -18,11 +18,10 @@
|
|||||||
|
|
||||||
package art.arcane.iris.modded.service;
|
package art.arcane.iris.modded.service;
|
||||||
|
|
||||||
|
import art.arcane.iris.configuration.IrisSettingsFile;
|
||||||
import art.arcane.iris.configuration.SettingsHotloadWatch;
|
import art.arcane.iris.configuration.SettingsHotloadWatch;
|
||||||
import art.arcane.iris.spi.IrisPlatforms;
|
|
||||||
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeModdedServer;
|
import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeModdedServer;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public final class ModdedSettingsHotloadService implements ModdedTickableService {
|
public final class ModdedSettingsHotloadService implements ModdedTickableService {
|
||||||
@@ -31,7 +30,7 @@ public final class ModdedSettingsHotloadService implements ModdedTickableService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
hotloadWatch = new SettingsHotloadWatch(settingsFile());
|
hotloadWatch = new SettingsHotloadWatch(IrisSettingsFile.location());
|
||||||
lastPollAtNanos = 0L;
|
lastPollAtNanos = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,8 +57,4 @@ public final class ModdedSettingsHotloadService implements ModdedTickableService
|
|||||||
lastPollAtNanos = now;
|
lastPollAtNanos = now;
|
||||||
active.checkConfigHotload();
|
active.checkConfigHotload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File settingsFile() {
|
|
||||||
return IrisPlatforms.get().dataFile("iris.json");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -126,7 +126,7 @@ public class ModdedPlatformPathsTest {
|
|||||||
File iris = new File(temporaryFolder.getRoot(), "iris");
|
File iris = new File(temporaryFolder.getRoot(), "iris");
|
||||||
|
|
||||||
assertEquals(iris, platform.dataFolder());
|
assertEquals(iris, platform.dataFolder());
|
||||||
assertEquals(new File(iris, "iris.json"), platform.dataFile("iris.json"));
|
assertEquals(new File(iris, "iris.toml"), platform.dataFile("iris.toml"));
|
||||||
assertEquals(new File(iris, "parity"), platform.dataFolder("parity"));
|
assertEquals(new File(iris, "parity"), platform.dataFolder("parity"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -482,7 +482,7 @@ List<String> dependencyBuildMetadata = [
|
|||||||
'META-INF/versions/*/OSGI-INF/**'
|
'META-INF/versions/*/OSGI-INF/**'
|
||||||
]
|
]
|
||||||
|
|
||||||
String languageTomlSupportClassPattern = 'art/arcane/volmlib/util/config/(?:TomlCodec|TomlSegments|ConfigComments|ConfigJson|ConfigExposePolicy|ConfigDoc|ConfigDescription|ConfigDocumentation)(?:\\$[^/]+)?\\.class'
|
String languageTomlSupportClassPattern = 'art/arcane/volmlib/util/config/(?:TomlCodec|TomlSegments|TomlDocumentEditor|ConfigJson|ConfigExposePolicy|ConfigComments|ConfigDoc|ConfigDescription|ConfigDocumentation)(?:\\$[^/]+)?\\.class'
|
||||||
|
|
||||||
tasks.named('shadowJar', ShadowJar).configure {
|
tasks.named('shadowJar', ShadowJar).configure {
|
||||||
inputs.property('languageTomlSupportClassPattern', languageTomlSupportClassPattern)
|
inputs.property('languageTomlSupportClassPattern', languageTomlSupportClassPattern)
|
||||||
|
|||||||
@@ -22,16 +22,11 @@ import art.arcane.iris.world.pregen.MantleHeapPressure;
|
|||||||
import art.arcane.iris.world.IrisPaperLikeBackendMode;
|
import art.arcane.iris.world.IrisPaperLikeBackendMode;
|
||||||
import art.arcane.iris.world.IrisRuntimeSchedulerMode;
|
import art.arcane.iris.world.IrisRuntimeSchedulerMode;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import art.arcane.iris.spi.IrisLogging;
|
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.iris.platform.bukkit.plugin.VolmitSender;
|
||||||
|
import art.arcane.volmlib.util.config.ConfigDoc;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
@@ -82,49 +77,13 @@ public class IrisSettings {
|
|||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
current = read();
|
current = IrisSettingsFile.load();
|
||||||
settings = current;
|
settings = current;
|
||||||
notifySettingsChanged(current);
|
notifySettingsChanged(current);
|
||||||
return 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() {
|
public static void invalidate() {
|
||||||
synchronized (SETTINGS_LOCK) {
|
synchronized (SETTINGS_LOCK) {
|
||||||
settings = null;
|
settings = null;
|
||||||
@@ -153,23 +112,16 @@ public class IrisSettings {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IrisSettings parseHotloadSnapshot(String rawJson) {
|
public static IrisSettings parseHotloadSnapshot(String rawToml) {
|
||||||
if (rawJson == null || rawJson.isBlank()) {
|
if (rawToml == null || rawToml.isBlank()) {
|
||||||
throw new IllegalArgumentException("Iris settings snapshot is empty");
|
throw new IllegalArgumentException("Iris settings snapshot is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
IrisSettings parsed;
|
|
||||||
try {
|
try {
|
||||||
parsed = new Gson().fromJson(rawJson, IrisSettings.class);
|
return IrisSettingsFile.parse(rawToml);
|
||||||
if (parsed == null) {
|
} catch (IOException | RuntimeException failure) {
|
||||||
throw new IllegalArgumentException("Iris settings snapshot did not contain an object");
|
|
||||||
}
|
|
||||||
} catch (RuntimeException failure) {
|
|
||||||
throw new IllegalArgumentException("Iris settings snapshot is invalid", failure);
|
throw new IllegalArgumentException("Iris settings snapshot is invalid", failure);
|
||||||
}
|
}
|
||||||
|
|
||||||
parsed.fillMissingSections();
|
|
||||||
return parsed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addSettingsListener(Consumer<IrisSettings> listener) {
|
public static void addSettingsListener(Consumer<IrisSettings> listener) {
|
||||||
@@ -187,16 +139,14 @@ public class IrisSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void forceSave() {
|
public void forceSave() {
|
||||||
File s = IrisPlatforms.get().dataFile("iris.json");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IO.writeAll(s, new JSONObject(new Gson().toJson(this)).toString(4));
|
IrisSettingsFile.write(this, IrisSettingsFile.location());
|
||||||
} catch (JSONException | IOException e) {
|
} catch (IOException e) {
|
||||||
IrisLogging.reportError(e);
|
IrisLogging.reportError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillMissingSections() {
|
void fillMissingSections() {
|
||||||
general = general == null ? new IrisSettingsGeneral() : general;
|
general = general == null ? new IrisSettingsGeneral() : general;
|
||||||
world = world == null ? new IrisSettingsWorld() : world;
|
world = world == null ? new IrisSettingsWorld() : world;
|
||||||
gui = gui == null ? new IrisSettingsGUI() : gui;
|
gui = gui == null ? new IrisSettingsGUI() : gui;
|
||||||
@@ -250,12 +200,20 @@ public class IrisSettings {
|
|||||||
private static final int REFERENCE_PLATE_MEGABYTES = 48;
|
private static final int REFERENCE_PLATE_MEGABYTES = 48;
|
||||||
public IrisRuntimeSchedulerMode runtimeSchedulerMode = IrisRuntimeSchedulerMode.AUTO;
|
public IrisRuntimeSchedulerMode runtimeSchedulerMode = IrisRuntimeSchedulerMode.AUTO;
|
||||||
public IrisPaperLikeBackendMode paperLikeBackendMode = IrisPaperLikeBackendMode.AUTO;
|
public IrisPaperLikeBackendMode paperLikeBackendMode = IrisPaperLikeBackendMode.AUTO;
|
||||||
|
@ConfigDoc(value = "Seconds pregen waits for a chunk to load.",
|
||||||
|
impact = "Clamped to 5 to 120.")
|
||||||
public int chunkLoadTimeoutSeconds = 15;
|
public int chunkLoadTimeoutSeconds = 15;
|
||||||
public int timeoutWarnIntervalMs = 500;
|
public int timeoutWarnIntervalMs = 500;
|
||||||
|
@ConfigDoc(value = "Milliseconds between saves during pregen.",
|
||||||
|
impact = "Clamped to 5000 to 900000.")
|
||||||
public int saveIntervalMs = 30_000;
|
public int saveIntervalMs = 30_000;
|
||||||
|
@ConfigDoc(value = "Mantle regions pregen keeps in memory before it pauses to let them unload.",
|
||||||
|
impact = "Lowered automatically for tall worlds and small heaps; minimum 16.")
|
||||||
public int maxResidentTectonicPlates = 96;
|
public int maxResidentTectonicPlates = 96;
|
||||||
public int mantleBackpressureWaitMs = 25;
|
public int mantleBackpressureWaitMs = 25;
|
||||||
public int mantleBackpressureTimeoutMs = 60_000;
|
public int mantleBackpressureTimeoutMs = 60_000;
|
||||||
|
@ConfigDoc(value = "Chunks a modded pregen generates at once.",
|
||||||
|
impact = "0 uses two per CPU core, between 16 and 48; capped at 512.")
|
||||||
public int moddedPregenInFlight = 0;
|
public int moddedPregenInFlight = 0;
|
||||||
|
|
||||||
public int getChunkLoadTimeoutSeconds() {
|
public int getChunkLoadTimeoutSeconds() {
|
||||||
@@ -319,6 +277,8 @@ public class IrisSettings {
|
|||||||
public static class IrisSettingsPerformance {
|
public static class IrisSettingsPerformance {
|
||||||
private IrisSettingsEngineSVC engineSVC = new IrisSettingsEngineSVC();
|
private IrisSettingsEngineSVC engineSVC = new IrisSettingsEngineSVC();
|
||||||
public boolean trimMantleInStudio = false;
|
public boolean trimMantleInStudio = false;
|
||||||
|
@ConfigDoc(value = "Seconds an idle mantle region stays in memory before it unloads.",
|
||||||
|
impact = "Shortens automatically as the heap fills up.")
|
||||||
public int mantleKeepAlive = 30;
|
public int mantleKeepAlive = 30;
|
||||||
public int noiseCacheSize = 1_024;
|
public int noiseCacheSize = 1_024;
|
||||||
public int resourceLoaderCacheSize = 1_024;
|
public int resourceLoaderCacheSize = 1_024;
|
||||||
@@ -329,6 +289,7 @@ public class IrisSettings {
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class IrisSettingsGeneral {
|
public static class IrisSettingsGeneral {
|
||||||
|
@ConfigDoc("Default locale for Iris messages, such as en_US or de_DE.")
|
||||||
public String language = "en_US";
|
public String language = "en_US";
|
||||||
public boolean metrics = true;
|
public boolean metrics = true;
|
||||||
public boolean updateNotifications = true;
|
public boolean updateNotifications = true;
|
||||||
@@ -340,25 +301,22 @@ public class IrisSettings {
|
|||||||
public boolean splashLogoStartup = true;
|
public boolean splashLogoStartup = true;
|
||||||
public boolean useConsoleCustomColors = true;
|
public boolean useConsoleCustomColors = true;
|
||||||
public boolean useCustomColorsIngame = true;
|
public boolean useCustomColorsIngame = true;
|
||||||
/**
|
@ConfigDoc(value = "Shows boss bars for jobs, Studio opens, chunk jobs and pack downloads.",
|
||||||
* Boss bars for jobs, Studio opens, chunk jobs, and pack downloads. Ordinary
|
impact = "Ordinary world creation uses only its action-bar meter; creation-time pregeneration keeps its own boss bar.")
|
||||||
* world creation uses only its action-bar lifecycle meter; creation-time
|
|
||||||
* pregeneration retains its dedicated long-running boss bar.
|
|
||||||
*/
|
|
||||||
public boolean progressBossBar = true;
|
public boolean progressBossBar = true;
|
||||||
public boolean adjustVanillaHeight = false;
|
public boolean adjustVanillaHeight = false;
|
||||||
public boolean autoIngestDatapacks = true;
|
public boolean autoIngestDatapacks = true;
|
||||||
/**
|
@ConfigDoc(value = "Converts every registered datapack structure into editable Iris objects, pools and pieces in the pack folder.",
|
||||||
* Converting every registered datapack structure into editable Iris resources writes
|
impact = "Writes thousands of files that native generation never needs; run /iris structure import <dimension> when you want editable copies.")
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
public boolean autoImportDatapackStructures = false;
|
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 boolean strictContentKeys = false;
|
||||||
|
@ConfigDoc("Hue shift of the colour gradient on Iris chat messages.")
|
||||||
public int spinh = -20;
|
public int spinh = -20;
|
||||||
|
@ConfigDoc("Saturation shift of the same gradient.")
|
||||||
public int spins = 7;
|
public int spins = 7;
|
||||||
|
@ConfigDoc("Brightness shift of the same gradient.")
|
||||||
public int spinb = 8;
|
public int spinb = 8;
|
||||||
|
|
||||||
|
|
||||||
@@ -380,6 +338,8 @@ public class IrisSettings {
|
|||||||
public static class IrisSettingsGenerator {
|
public static class IrisSettingsGenerator {
|
||||||
public String defaultWorldType = "overworld";
|
public String defaultWorldType = "overworld";
|
||||||
public boolean preventLeafDecay = true;
|
public boolean preventLeafDecay = true;
|
||||||
|
@ConfigDoc(value = "Width in blocks over which new terrain blends into terrain generated by an older pack version.",
|
||||||
|
impact = "Clamped to 16 to 8192.")
|
||||||
public int generationTransitionWidthBlocks = 256;
|
public int generationTransitionWidthBlocks = 256;
|
||||||
|
|
||||||
public int getGenerationTransitionWidthBlocks() {
|
public int getGenerationTransitionWidthBlocks() {
|
||||||
@@ -399,7 +359,10 @@ public class IrisSettings {
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class IrisSettingsStudio {
|
public static class IrisSettingsStudio {
|
||||||
|
@ConfigDoc("Opens VS Code on the server machine when a studio opens.")
|
||||||
public boolean openVSCode = true;
|
public boolean openVSCode = true;
|
||||||
|
@ConfigDoc(value = "Blends hotloaded studio changes into existing terrain instead of cutting hard at chunk edges.",
|
||||||
|
impact = "Uses generator.generationTransitionWidthBlocks as the blend width.")
|
||||||
public boolean blendChanges = true;
|
public boolean blendChanges = true;
|
||||||
public boolean disableTimeAndWeather = true;
|
public boolean disableTimeAndWeather = true;
|
||||||
public boolean entitySpawning = true;
|
public boolean entitySpawning = true;
|
||||||
@@ -410,7 +373,10 @@ public class IrisSettings {
|
|||||||
public static class IrisSettingsEngineSVC {
|
public static class IrisSettingsEngineSVC {
|
||||||
public boolean useVirtualThreads = true;
|
public boolean useVirtualThreads = true;
|
||||||
public boolean forceMulticoreWrite = false;
|
public boolean forceMulticoreWrite = false;
|
||||||
|
@ConfigDoc("Thread priority of engine workers, 1 to 10.")
|
||||||
public int priority = Thread.NORM_PRIORITY;
|
public int priority = Thread.NORM_PRIORITY;
|
||||||
|
@ConfigDoc(value = "Number of engine worker threads.",
|
||||||
|
impact = "-1 uses the square root of the CPU count; capped at twice the CPU count.")
|
||||||
public int parallelism = -1;
|
public int parallelism = -1;
|
||||||
|
|
||||||
public int getPriority() {
|
public int getPriority() {
|
||||||
|
|||||||
@@ -0,0 +1,241 @@
|
|||||||
|
package art.arcane.iris.configuration;
|
||||||
|
|
||||||
|
import art.arcane.iris.spi.IrisLogging;
|
||||||
|
import art.arcane.iris.spi.IrisPlatforms;
|
||||||
|
import art.arcane.volmlib.util.config.ConfigComments;
|
||||||
|
import art.arcane.volmlib.util.config.ConfigExposePolicy;
|
||||||
|
import art.arcane.volmlib.util.config.ConfigJson;
|
||||||
|
import art.arcane.volmlib.util.config.TomlCodec;
|
||||||
|
import art.arcane.volmlib.util.config.TomlDocumentEditor;
|
||||||
|
import art.arcane.volmlib.util.io.AtomicFileIO;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.AccessDeniedException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads and writes the Iris settings file. Settings live in iris.toml so each key can carry a comment.
|
||||||
|
*/
|
||||||
|
public final class IrisSettingsFile {
|
||||||
|
public static final String FILE_NAME = "iris.toml";
|
||||||
|
static final String LEGACY_FILE_NAME = "iris.json";
|
||||||
|
static final String MIGRATED_FILE_NAME = "iris.json.migrated";
|
||||||
|
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 {
|
||||||
|
requireWritable(file);
|
||||||
|
AtomicFileIO.writeString(file.toPath(), documentWithSettings(file, settings));
|
||||||
|
}
|
||||||
|
|
||||||
|
static IrisSettings load() {
|
||||||
|
File file = location();
|
||||||
|
if (file.exists()) {
|
||||||
|
return loadExisting(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
File legacy = new File(file.getParentFile(), LEGACY_FILE_NAME);
|
||||||
|
if (legacy.isFile()) {
|
||||||
|
return migrate(legacy, 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, ConfigExposePolicy.ALL, ConfigComments.ANNOTATED_ONLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the old iris.json into iris.toml, then renames it so it is not mistaken for the live file.
|
||||||
|
* A broken iris.json is left alone and no iris.toml is written, so fixing it and restarting still migrates.
|
||||||
|
*/
|
||||||
|
private static IrisSettings migrate(File legacy, File file) {
|
||||||
|
IrisSettings migrated;
|
||||||
|
try {
|
||||||
|
migrated = new Gson().fromJson(Files.readString(legacy.toPath(), StandardCharsets.UTF_8), IrisSettings.class);
|
||||||
|
} catch (Throwable failure) {
|
||||||
|
IrisLogging.error("Could not convert " + LEGACY_FILE_NAME + " to " + FILE_NAME + "! " + rootCause(failure)
|
||||||
|
+ ". Using defaults until the file is fixed.");
|
||||||
|
return new IrisSettings();
|
||||||
|
}
|
||||||
|
if (migrated == null) {
|
||||||
|
migrated = new IrisSettings();
|
||||||
|
}
|
||||||
|
migrated.fillMissingSections();
|
||||||
|
if (!rewrite(file, migrated)) {
|
||||||
|
return migrated;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Files.move(legacy.toPath(), new File(legacy.getParentFile(), MIGRATED_FILE_NAME).toPath(),
|
||||||
|
StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
IrisLogging.info("Converted " + LEGACY_FILE_NAME + " to " + FILE_NAME + "; the old file is now " + MIGRATED_FILE_NAME + ".");
|
||||||
|
} catch (IOException failure) {
|
||||||
|
IrisLogging.info("Converted " + LEGACY_FILE_NAME + " to " + FILE_NAME + "; " + LEGACY_FILE_NAME + " is no longer read.");
|
||||||
|
}
|
||||||
|
return migrated;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (!containsEverySetting(raw, loaded)) {
|
||||||
|
rewrite(file, loaded);
|
||||||
|
}
|
||||||
|
return loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean containsEverySetting(String raw, IrisSettings loaded) {
|
||||||
|
try {
|
||||||
|
JsonObject document = parseDocument(raw);
|
||||||
|
return settingPaths(settingsTree(loaded)).stream().allMatch(path -> valueAt(document, path) != null);
|
||||||
|
} catch (IOException unreadable) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void requireWritable(File file) throws AccessDeniedException {
|
||||||
|
if (file.exists() && !file.canWrite()) {
|
||||||
|
throw new AccessDeniedException(file.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String documentWithSettings(File file, IrisSettings settings) {
|
||||||
|
if (!file.exists()) {
|
||||||
|
return render(settings);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return applySettings(Files.readString(file.toPath(), StandardCharsets.UTF_8), settingsTree(settings));
|
||||||
|
} catch (IOException | RuntimeException uneditable) {
|
||||||
|
return render(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String applySettings(String document, JsonObject settings) throws IOException {
|
||||||
|
JsonObject written = parseDocument(document);
|
||||||
|
String updated = document;
|
||||||
|
for (List<String> path : settingPaths(settings)) {
|
||||||
|
JsonElement value = valueAt(settings, path);
|
||||||
|
if (value.equals(valueAt(written, path))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
updated = TomlDocumentEditor.set(updated, path, value);
|
||||||
|
}
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Each table's own settings come out last to first: the editor inserts a missing setting directly below its
|
||||||
|
* table header, so this order leaves inserted settings in their documented order.
|
||||||
|
*/
|
||||||
|
private static List<List<String>> settingPaths(JsonObject table) {
|
||||||
|
List<List<String>> paths = new ArrayList<>();
|
||||||
|
collectSettingPaths(table, List.of(), paths);
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void collectSettingPaths(JsonObject table, List<String> tablePath, List<List<String>> paths) {
|
||||||
|
List<List<String>> ownSettings = new ArrayList<>();
|
||||||
|
List<Map.Entry<String, JsonElement>> childTables = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, JsonElement> entry : table.entrySet()) {
|
||||||
|
if (entry.getValue().isJsonObject()) {
|
||||||
|
childTables.add(entry);
|
||||||
|
} else {
|
||||||
|
ownSettings.add(childPath(tablePath, entry.getKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
paths.addAll(ownSettings.reversed());
|
||||||
|
for (Map.Entry<String, JsonElement> child : childTables) {
|
||||||
|
collectSettingPaths(child.getValue().getAsJsonObject(), childPath(tablePath, child.getKey()), paths);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<String> childPath(List<String> parent, String key) {
|
||||||
|
List<String> path = new ArrayList<>(parent);
|
||||||
|
path.add(key);
|
||||||
|
return List.copyOf(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JsonObject settingsTree(IrisSettings settings) {
|
||||||
|
return ConfigJson.NORMAL.toJsonTree(settings).getAsJsonObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JsonElement valueAt(JsonObject document, List<String> path) {
|
||||||
|
JsonElement current = document;
|
||||||
|
for (String key : path) {
|
||||||
|
if (!current.isJsonObject()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
current = current.getAsJsonObject().get(key);
|
||||||
|
if (current == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JsonObject parseDocument(String toml) throws IOException {
|
||||||
|
JsonElement parsed = TomlCodec.toJsonElement(toml);
|
||||||
|
if (parsed == null || !parsed.isJsonObject()) {
|
||||||
|
throw new IOException("Iris settings did not contain a table");
|
||||||
|
}
|
||||||
|
return parsed.getAsJsonObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -112,7 +112,7 @@ public final class SettingsHotloadWatch implements AutoCloseable {
|
|||||||
boolean missing = "missing".equals(snapshot.signature());
|
boolean missing = "missing".equals(snapshot.signature());
|
||||||
if (isSettingsFile(file)) {
|
if (isSettingsFile(file)) {
|
||||||
if (missing) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
if (snapshot.normalizedContent() == null) {
|
if (snapshot.normalizedContent() == null) {
|
||||||
@@ -258,7 +258,7 @@ public final class SettingsHotloadWatch implements AutoCloseable {
|
|||||||
File file = delta.file();
|
File file = delta.file();
|
||||||
if (isSettingsFile(file)) {
|
if (isSettingsFile(file)) {
|
||||||
if (delta.after() != null) {
|
if (delta.after() != null) {
|
||||||
IrisLogging.debug("Hotloaded iris.json");
|
IrisLogging.debug("Hotloaded " + settingsFile.getName());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package art.arcane.iris.localization;
|
package art.arcane.iris.localization;
|
||||||
|
|
||||||
import art.arcane.iris.configuration.IrisSettings;
|
import art.arcane.iris.configuration.IrisSettings;
|
||||||
|
import art.arcane.iris.configuration.IrisSettingsFile;
|
||||||
import art.arcane.iris.spi.CapabilityProbe;
|
import art.arcane.iris.spi.CapabilityProbe;
|
||||||
import art.arcane.iris.spi.IrisLogging;
|
import art.arcane.iris.spi.IrisLogging;
|
||||||
import art.arcane.iris.spi.IrisPlatforms;
|
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.TomlLanguageParser;
|
||||||
import art.arcane.volmlib.util.localization.TomlLanguageWriter;
|
import art.arcane.volmlib.util.localization.TomlLanguageWriter;
|
||||||
import art.arcane.volmlib.util.localization.VolmitLocales;
|
import art.arcane.volmlib.util.localization.VolmitLocales;
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -49,7 +49,6 @@ import java.io.InputStream;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.LinkOption;
|
import java.nio.file.LinkOption;
|
||||||
import java.nio.file.StandardCopyOption;
|
|
||||||
import java.nio.file.attribute.FileTime;
|
import java.nio.file.attribute.FileTime;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -831,16 +830,9 @@ public final class IrisLanguage {
|
|||||||
|
|
||||||
private static void selectDefault(String locale, LocalizationSnapshot prepared) throws Exception {
|
private static void selectDefault(String locale, LocalizationSnapshot prepared) throws Exception {
|
||||||
IrisSettings current = IrisSettings.get();
|
IrisSettings current = IrisSettings.get();
|
||||||
JsonObject serialized = new Gson().toJsonTree(current).getAsJsonObject();
|
IrisSettings saved = new Gson().fromJson(new Gson().toJsonTree(current), IrisSettings.class);
|
||||||
serialized.getAsJsonObject("general").addProperty("language", locale);
|
saved.getGeneral().setLanguage(locale);
|
||||||
Path target = dataFolder.toPath().resolve("iris.json");
|
IrisSettingsFile.write(saved, new File(dataFolder, IrisSettingsFile.FILE_NAME));
|
||||||
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);
|
|
||||||
}
|
|
||||||
current.getGeneral().setLanguage(locale);
|
current.getGeneral().setLanguage(locale);
|
||||||
synchronized (SNAPSHOT_LOCK) {
|
synchronized (SNAPSHOT_LOCK) {
|
||||||
MANAGER.install(prepared);
|
MANAGER.install(prepared);
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ public final class ContentKeyValidator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether unresolved pack content keys are blocking errors instead of warnings. Enabled by
|
* 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() {
|
public static boolean strictContent() {
|
||||||
String property = System.getProperty(STRICT_PROPERTY);
|
String property = System.getProperty(STRICT_PROPERTY);
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ public class ServerConfigurator {
|
|||||||
timeouts.raise(file, configuration, "settings.timeout-time", minimum);
|
timeouts.raise(file, configuration, "settings.timeout-time", minimum);
|
||||||
IrisLogging.warn("Updated " + file + " settings.timeout-time: " + previous + " -> " + minimum
|
IrisLogging.warn("Updated " + file + " settings.timeout-time: " + previous + " -> " + minimum
|
||||||
+ " seconds. Takes effect after a server restart.");
|
+ " 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 {
|
private static void increasePaperWatchdog() throws IOException, InvalidConfigurationException, ReflectiveOperationException {
|
||||||
@@ -283,7 +283,7 @@ public class ServerConfigurator {
|
|||||||
timeouts.raise(file, configuration, "watchdog.early-warning-delay", minimum);
|
timeouts.raise(file, configuration, "watchdog.early-warning-delay", minimum);
|
||||||
IrisLogging.warn("Updated " + file + " watchdog.early-warning-delay: " + previous + " -> " + minimum
|
IrisLogging.warn("Updated " + file + " watchdog.early-warning-delay: " + previous + " -> " + minimum
|
||||||
+ " milliseconds. Takes effect after a server restart.");
|
+ " 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() {
|
private static ServerTimeoutConfiguration timeoutConfiguration() {
|
||||||
|
|||||||
@@ -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.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.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.seed" = "Seed-Informationen der Welt und Engine anzeigen"
|
||||||
"entry.command.debug" = "Iris-Debugprotokollierung umschalten und iris.json speichern"
|
"entry.command.debug" = "Iris-Debugprotokollierung umschalten und iris.toml speichern"
|
||||||
"entry.command.reload" = "iris.json neu laden; die Datei wird außerdem automatisch alle 3 Sekunden direkt neu geladen"
|
"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.download" = "Ein Pack-Projekt herunterladen"
|
||||||
"entry.command.catalog" = "Worldgen-Inhalte geladener Mods auflisten, einen Namespace anzeigen oder neu erfassen"
|
"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"
|
"entry.group.ingest" = "Iris-Packs aus den Worldgen-Inhalten geladener Mods erstellen"
|
||||||
|
|||||||
@@ -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.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.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.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.debug" = "Alternar el registro de depuración de Iris y guardar iris.toml"
|
||||||
"entry.command.reload" = "Recargar iris.json (también se recarga en caliente automáticamente cada 3s)"
|
"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.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.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"
|
"entry.group.ingest" = "Crear packs de Iris a partir del contenido de generación de los mods cargados"
|
||||||
|
|||||||
@@ -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.tp" = "Teleporttaa itsesi tai nimetty pelaaja ladattuun Iris-ulottuvuuteen"
|
||||||
"entry.command.evacuate" = "Teleportoi kaikki pelaajat Iris-ulottuvuudesta päämaailman spawn-pisteeseen"
|
"entry.command.evacuate" = "Teleportoi kaikki pelaajat Iris-ulottuvuudesta päämaailman spawn-pisteeseen"
|
||||||
"entry.command.seed" = "Tulosta maailman ja generaattorin siementiedot"
|
"entry.command.seed" = "Tulosta maailman ja generaattorin siementiedot"
|
||||||
"entry.command.debug" = "Vaihda Irisin vianetsintäloki päälle/pois ja tallenna iris.json"
|
"entry.command.debug" = "Vaihda Irisin vianetsintäloki päälle/pois ja tallenna iris.toml"
|
||||||
"entry.command.reload" = "Lataa iris.json uudelleen (ladataan myös automaattisesti 3 s välein)"
|
"entry.command.reload" = "Lataa iris.toml uudelleen (ladataan myös automaattisesti 3 s välein)"
|
||||||
"entry.command.download" = "Lataa pakettiprojekti"
|
"entry.command.download" = "Lataa pakettiprojekti"
|
||||||
"entry.command.catalog" = "Listaa ladattujen modien maailmangenerointisisältö, näytä yksi nimiavaruus tai kerää se uudelleen"
|
"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ä"
|
"entry.group.ingest" = "Luo Iris-paketteja ladattujen modien maailmangenerointisisällöstä"
|
||||||
|
|||||||
@@ -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.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.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.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.debug" = "Basculer les journaux de débogage Iris et enregistrer iris.toml"
|
||||||
"entry.command.reload" = "Recharger iris.json (également rechargé à chaud automatiquement toutes les 3s)"
|
"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.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.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"
|
"entry.group.ingest" = "Créer des packs Iris à partir du contenu de génération des mods chargés"
|
||||||
|
|||||||
@@ -365,8 +365,8 @@ operator_instruction = "יש להריץ את {command} מהקונסולה (או
|
|||||||
"entry.command.tp" = "שיגור שלך או של שחקן בשם לממד Iris טעון"
|
"entry.command.tp" = "שיגור שלך או של שחקן בשם לממד Iris טעון"
|
||||||
"entry.command.evacuate" = "שגר את כל השחקנים מממד Iris לנקודת הספאון של העולם הראשי"
|
"entry.command.evacuate" = "שגר את כל השחקנים מממד Iris לנקודת הספאון של העולם הראשי"
|
||||||
"entry.command.seed" = "הצג מידע על הזרע של העולם והמנוע"
|
"entry.command.seed" = "הצג מידע על הזרע של העולם והמנוע"
|
||||||
"entry.command.debug" = "הפעלה/כיבוי של רישום ניפוי באגים של Iris ושמירת iris.json"
|
"entry.command.debug" = "הפעלה/כיבוי של רישום ניפוי באגים של Iris ושמירת iris.toml"
|
||||||
"entry.command.reload" = "טעינה מחדש של iris.json (נטען מחדש גם אוטומטית כל 3 שניות)"
|
"entry.command.reload" = "טעינה מחדש של iris.toml (נטען מחדש גם אוטומטית כל 3 שניות)"
|
||||||
"entry.command.download" = "הורד פרויקט חבילה"
|
"entry.command.download" = "הורד פרויקט חבילה"
|
||||||
"entry.command.catalog" = "הצג את תוכן יצירת העולם של המודים הטעונים, הצג מרחב שמות אחד או אסוף אותו מחדש"
|
"entry.command.catalog" = "הצג את תוכן יצירת העולם של המודים הטעונים, הצג מרחב שמות אחד או אסוף אותו מחדש"
|
||||||
"entry.group.ingest" = "בנה חבילות Iris מתוכן יצירת העולם של המודים הטעונים"
|
"entry.group.ingest" = "בנה חבילות Iris מתוכן יצירת העולם של המודים הטעונים"
|
||||||
|
|||||||
@@ -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.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.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.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.debug" = "Attiva o disattiva la registrazione di debug Iris e salva iris.toml"
|
||||||
"entry.command.reload" = "Ricarica iris.json; il file viene anche ricaricato automaticamente ogni 3 secondi"
|
"entry.command.reload" = "Ricarica iris.toml; il file viene anche ricaricato automaticamente ogni 3 secondi"
|
||||||
"entry.command.download" = "Scarica un progetto Pack"
|
"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.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"
|
"entry.group.ingest" = "Crea pack Iris dai contenuti di generazione delle mod caricate"
|
||||||
|
|||||||
@@ -363,8 +363,8 @@ operator_instruction = "コンソールから {command} を実行してくださ
|
|||||||
"entry.command.tp" = "自分または指定したプレイヤーを読み込み済みの Iris ディメンションへテレポートします"
|
"entry.command.tp" = "自分または指定したプレイヤーを読み込み済みの Iris ディメンションへテレポートします"
|
||||||
"entry.command.evacuate" = "Iris ディメンション内の全プレイヤーをプライマリーワールドのスポーン地点へ退避させます"
|
"entry.command.evacuate" = "Iris ディメンション内の全プレイヤーをプライマリーワールドのスポーン地点へ退避させます"
|
||||||
"entry.command.seed" = "ワールドとエンジンのシード情報を表示します"
|
"entry.command.seed" = "ワールドとエンジンのシード情報を表示します"
|
||||||
"entry.command.debug" = "Iris のデバッグログを切り替えて iris.json を保存します"
|
"entry.command.debug" = "Iris のデバッグログを切り替えて iris.toml を保存します"
|
||||||
"entry.command.reload" = "iris.json を再読み込みします(3 秒ごとに自動でホットリロードもされます)"
|
"entry.command.reload" = "iris.toml を再読み込みします(3 秒ごとに自動でホットリロードもされます)"
|
||||||
"entry.command.download" = "パックプロジェクトをダウンロードします"
|
"entry.command.download" = "パックプロジェクトをダウンロードします"
|
||||||
"entry.command.catalog" = "読み込まれた Mod のワールド生成コンテンツを一覧表示し、1 つの名前空間を表示し、または再取得します"
|
"entry.command.catalog" = "読み込まれた Mod のワールド生成コンテンツを一覧表示し、1 つの名前空間を表示し、または再取得します"
|
||||||
"entry.group.ingest" = "読み込まれた Mod のワールド生成コンテンツから Iris パックを作成します"
|
"entry.group.ingest" = "読み込まれた Mod のワールド生成コンテンツから Iris パックを作成します"
|
||||||
|
|||||||
@@ -363,8 +363,8 @@ operator_instruction = "콘솔에서 {command}을(를) 실행하세요(싱글
|
|||||||
"entry.command.tp" = "자신 또는 지정한 플레이어를 로드된 Iris 차원으로 순간이동합니다"
|
"entry.command.tp" = "자신 또는 지정한 플레이어를 로드된 Iris 차원으로 순간이동합니다"
|
||||||
"entry.command.evacuate" = "Iris 차원의 모든 플레이어를 기본 월드 스폰으로 대피시킵니다"
|
"entry.command.evacuate" = "Iris 차원의 모든 플레이어를 기본 월드 스폰으로 대피시킵니다"
|
||||||
"entry.command.seed" = "월드와 엔진의 시드 정보를 표시합니다"
|
"entry.command.seed" = "월드와 엔진의 시드 정보를 표시합니다"
|
||||||
"entry.command.debug" = "Iris 디버그 로깅을 전환하고 iris.json을 저장합니다"
|
"entry.command.debug" = "Iris 디버그 로깅을 전환하고 iris.toml을 저장합니다"
|
||||||
"entry.command.reload" = "iris.json을 다시 로드합니다(3초마다 자동으로 핫 리로드도 수행)"
|
"entry.command.reload" = "iris.toml을 다시 로드합니다(3초마다 자동으로 핫 리로드도 수행)"
|
||||||
"entry.command.download" = "팩 프로젝트를 다운로드합니다"
|
"entry.command.download" = "팩 프로젝트를 다운로드합니다"
|
||||||
"entry.command.catalog" = "로드된 모드의 월드 생성 콘텐츠를 나열하거나, 네임스페이스 하나를 표시하거나, 다시 수집합니다"
|
"entry.command.catalog" = "로드된 모드의 월드 생성 콘텐츠를 나열하거나, 네임스페이스 하나를 표시하거나, 다시 수집합니다"
|
||||||
"entry.group.ingest" = "로드된 모드의 월드 생성 콘텐츠로 Iris 팩을 만듭니다"
|
"entry.group.ingest" = "로드된 모드의 월드 생성 콘텐츠로 Iris 팩을 만듭니다"
|
||||||
|
|||||||
@@ -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.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.evacuate" = "Teleportuoti visus žaidėjus iš Iris dimensijos į pagrindinio pasaulio atsiradimo vietą"
|
||||||
"entry.command.seed" = "Rodyti pasaulio ir variklio sėklos informaciją"
|
"entry.command.seed" = "Rodyti pasaulio ir variklio sėklos informaciją"
|
||||||
"entry.command.debug" = "Perjungti Iris derinimo žurnalą ir įrašyti iris.json"
|
"entry.command.debug" = "Perjungti Iris derinimo žurnalą ir įrašyti iris.toml"
|
||||||
"entry.command.reload" = "Įkelti iš naujo iris.json (taip pat įkeliamas automatiškai kas 3s)"
|
"entry.command.reload" = "Įkelti iš naujo iris.toml (taip pat įkeliamas automatiškai kas 3s)"
|
||||||
"entry.command.download" = "Parsisiųsti paketo projektą"
|
"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.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"
|
"entry.group.ingest" = "Kurti Iris paketus iš įkeltų modų pasaulio generavimo turinio"
|
||||||
|
|||||||
@@ -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.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.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.seed" = "Wereld- en engine-seedinformatie tonen"
|
||||||
"entry.command.debug" = "Iris-debuglogging in-/uitschakelen en iris.json opslaan"
|
"entry.command.debug" = "Iris-debuglogging in-/uitschakelen en iris.toml opslaan"
|
||||||
"entry.command.reload" = "iris.json opnieuw laden (wordt ook automatisch elke 3s opnieuw geladen)"
|
"entry.command.reload" = "iris.toml opnieuw laden (wordt ook automatisch elke 3s opnieuw geladen)"
|
||||||
"entry.command.download" = "Een pakketproject downloaden"
|
"entry.command.download" = "Een pakketproject downloaden"
|
||||||
"entry.command.catalog" = "De wereldgeneratie-inhoud van geladen mods tonen, één namespace weergeven of opnieuw vastleggen"
|
"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"
|
"entry.group.ingest" = "Iris-pakketten maken van de wereldgeneratie-inhoud van geladen mods"
|
||||||
|
|||||||
@@ -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.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.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.seed" = "Wyświetl informacje o ziarnie świata i silnika"
|
||||||
"entry.command.debug" = "Przełącz logowanie debugowania Iris i zapisz iris.json"
|
"entry.command.debug" = "Przełącz logowanie debugowania Iris i zapisz iris.toml"
|
||||||
"entry.command.reload" = "Wczytaj ponownie iris.json (wczytywany też automatycznie co 3 s)"
|
"entry.command.reload" = "Wczytaj ponownie iris.toml (wczytywany też automatycznie co 3 s)"
|
||||||
"entry.command.download" = "Pobierz projekt pakietu"
|
"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.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"
|
"entry.group.ingest" = "Twórz pakiety Iris z zawartości generowania świata wczytanych modów"
|
||||||
|
|||||||
@@ -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.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.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.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.debug" = "Alternar o registo de depuração do Iris e guardar iris.toml"
|
||||||
"entry.command.reload" = "Recarregar iris.json (também carregado automaticamente a cada 3s)"
|
"entry.command.reload" = "Recarregar iris.toml (também carregado automaticamente a cada 3s)"
|
||||||
"entry.command.download" = "Transferir um projeto de pacote"
|
"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.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"
|
"entry.group.ingest" = "Criar pacotes Iris a partir do conteúdo de geração dos mods carregados"
|
||||||
|
|||||||
@@ -365,8 +365,8 @@ operator_instruction = "Выполните {command} из консоли (или
|
|||||||
"entry.command.tp" = "Телепортировать себя или указанного игрока в загруженное измерение Iris"
|
"entry.command.tp" = "Телепортировать себя или указанного игрока в загруженное измерение Iris"
|
||||||
"entry.command.evacuate" = "Телепортировать всех игроков из измерения Iris на точку спавна основного мира"
|
"entry.command.evacuate" = "Телепортировать всех игроков из измерения Iris на точку спавна основного мира"
|
||||||
"entry.command.seed" = "Показать информацию о сиде мира и движка"
|
"entry.command.seed" = "Показать информацию о сиде мира и движка"
|
||||||
"entry.command.debug" = "Переключить журнал отладки Iris и сохранить iris.json"
|
"entry.command.debug" = "Переключить журнал отладки Iris и сохранить iris.toml"
|
||||||
"entry.command.reload" = "Перезагрузить iris.json (также автоматически загружается каждые 3 секунды)"
|
"entry.command.reload" = "Перезагрузить iris.toml (также автоматически загружается каждые 3 секунды)"
|
||||||
"entry.command.download" = "Скачать проект пакета"
|
"entry.command.download" = "Скачать проект пакета"
|
||||||
"entry.command.catalog" = "Показать генерацию мира загруженных модов, одно пространство имён или собрать каталог заново"
|
"entry.command.catalog" = "Показать генерацию мира загруженных модов, одно пространство имён или собрать каталог заново"
|
||||||
"entry.group.ingest" = "Создать пакеты Iris из генерации мира загруженных модов"
|
"entry.group.ingest" = "Создать пакеты Iris из генерации мира загруженных модов"
|
||||||
|
|||||||
@@ -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.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.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.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.debug" = "Iris hata ayıklama günlüğünü aç/kapat ve iris.toml 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.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.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.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"
|
"entry.group.ingest" = "Yüklü modların dünya oluşturma içeriğinden Iris paketleri oluştur"
|
||||||
|
|||||||
@@ -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.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.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.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.debug" = "Bật/tắt ghi log debug của Iris và lưu iris.toml"
|
||||||
"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.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.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.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"
|
"entry.group.ingest" = "Tạo gói Iris từ nội dung tạo thế giới của các mod đã tải"
|
||||||
|
|||||||
@@ -363,8 +363,8 @@ operator_instruction = "请从控制台执行 {command}(或在单人游戏中
|
|||||||
"entry.command.tp" = "将自己或指定玩家传送到已加载的 Iris 维度"
|
"entry.command.tp" = "将自己或指定玩家传送到已加载的 Iris 维度"
|
||||||
"entry.command.evacuate" = "将 Iris 维度中的所有玩家传送到主世界出生点"
|
"entry.command.evacuate" = "将 Iris 维度中的所有玩家传送到主世界出生点"
|
||||||
"entry.command.seed" = "显示世界和引擎的种子信息"
|
"entry.command.seed" = "显示世界和引擎的种子信息"
|
||||||
"entry.command.debug" = "切换 Iris 调试日志并保存 iris.json"
|
"entry.command.debug" = "切换 Iris 调试日志并保存 iris.toml"
|
||||||
"entry.command.reload" = "重新加载 iris.json(也会每 3 秒自动热加载)"
|
"entry.command.reload" = "重新加载 iris.toml(也会每 3 秒自动热加载)"
|
||||||
"entry.command.download" = "下载包项目"
|
"entry.command.download" = "下载包项目"
|
||||||
"entry.command.catalog" = "列出已加载模组的世界生成内容、显示单个命名空间或重新采集"
|
"entry.command.catalog" = "列出已加载模组的世界生成内容、显示单个命名空间或重新采集"
|
||||||
"entry.group.ingest" = "根据已加载模组的世界生成内容创建 Iris 包"
|
"entry.group.ingest" = "根据已加载模组的世界生成内容创建 Iris 包"
|
||||||
|
|||||||
@@ -363,8 +363,8 @@ operator_instruction = "請從主控台執行 {command}(或在單人遊戲中
|
|||||||
"entry.command.tp" = "將自己或指定玩家傳送到已載入的 Iris 維度"
|
"entry.command.tp" = "將自己或指定玩家傳送到已載入的 Iris 維度"
|
||||||
"entry.command.evacuate" = "將 Iris 維度中的所有玩家傳送到主要世界出生點"
|
"entry.command.evacuate" = "將 Iris 維度中的所有玩家傳送到主要世界出生點"
|
||||||
"entry.command.seed" = "顯示世界和引擎的種子資訊"
|
"entry.command.seed" = "顯示世界和引擎的種子資訊"
|
||||||
"entry.command.debug" = "切換 Iris 偵錯記錄並儲存 iris.json"
|
"entry.command.debug" = "切換 Iris 偵錯記錄並儲存 iris.toml"
|
||||||
"entry.command.reload" = "重新載入 iris.json(也會每 3 秒自動熱載入)"
|
"entry.command.reload" = "重新載入 iris.toml(也會每 3 秒自動熱載入)"
|
||||||
"entry.command.download" = "下載包專案"
|
"entry.command.download" = "下載包專案"
|
||||||
"entry.command.catalog" = "列出已載入模組的世界生成內容、顯示單一命名空間或重新擷取"
|
"entry.command.catalog" = "列出已載入模組的世界生成內容、顯示單一命名空間或重新擷取"
|
||||||
"entry.group.ingest" = "根據已載入模組的世界生成內容建立 Iris 包"
|
"entry.group.ingest" = "根據已載入模組的世界生成內容建立 Iris 包"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package art.arcane.iris.configuration;
|
package art.arcane.iris.configuration;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@@ -13,12 +12,11 @@ import static org.junit.Assert.assertThrows;
|
|||||||
|
|
||||||
public class IrisSettingsDefaultsTest {
|
public class IrisSettingsDefaultsTest {
|
||||||
@Test
|
@Test
|
||||||
public void updateChecksDefaultOnAndPersistAnExplicitOptOut() {
|
public void updateChecksDefaultOnAndPersistAnExplicitOptOut() throws Exception {
|
||||||
assertTrue(IrisSettings.parseHotloadSnapshot("{}").getGeneral().isUpdateNotifications());
|
assertTrue(IrisSettings.parseHotloadSnapshot("[general]").getGeneral().isUpdateNotifications());
|
||||||
IrisSettings optedOut = IrisSettings.parseHotloadSnapshot(
|
IrisSettings optedOut = IrisSettings.parseHotloadSnapshot("[general]\nupdateNotifications = false");
|
||||||
"{\"general\":{\"updateNotifications\":false}}");
|
|
||||||
assertFalse(optedOut.getGeneral().isUpdateNotifications());
|
assertFalse(optedOut.getGeneral().isUpdateNotifications());
|
||||||
assertFalse(new Gson().fromJson(new Gson().toJson(optedOut), IrisSettings.class)
|
assertFalse(IrisSettingsFile.parse(IrisSettingsFile.render(optedOut))
|
||||||
.getGeneral().isUpdateNotifications());
|
.getGeneral().isUpdateNotifications());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,20 +31,20 @@ public class IrisSettingsDefaultsTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void concurrencyIsNotSerializedIntoIrisJson() {
|
public void concurrencyIsNotWrittenToTheSettingsFile() {
|
||||||
String json = new Gson().toJson(new IrisSettings());
|
String toml = IrisSettingsFile.render(new IrisSettings());
|
||||||
|
|
||||||
assertFalse("iris.json must not advertise an unconfigurable concurrency block",
|
assertFalse("iris.toml must not advertise an unconfigurable concurrency block",
|
||||||
json.contains("\"concurrency\""));
|
toml.contains("concurrency"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void languageAndMetricsAreTheFirstGeneralControls() {
|
public void languageAndMetricsAreTheFirstGeneralControls() {
|
||||||
String json = new Gson().toJson(new IrisSettings());
|
String toml = IrisSettingsFile.render(new IrisSettings());
|
||||||
|
|
||||||
int language = json.indexOf("\"language\"");
|
int language = toml.indexOf("\nlanguage = ");
|
||||||
int metrics = json.indexOf("\"metrics\"");
|
int metrics = toml.indexOf("\nmetrics = ");
|
||||||
int commandSounds = json.indexOf("\"commandSounds\"");
|
int commandSounds = toml.indexOf("\ncommandSounds = ");
|
||||||
assertTrue(language >= 0);
|
assertTrue(language >= 0);
|
||||||
assertTrue(language < metrics);
|
assertTrue(language < metrics);
|
||||||
assertTrue(metrics < commandSounds);
|
assertTrue(metrics < commandSounds);
|
||||||
@@ -75,10 +73,10 @@ public class IrisSettingsDefaultsTest {
|
|||||||
public void studioBlendingDefaultsOnAndAcceptsDisabledHotload() {
|
public void studioBlendingDefaultsOnAndAcceptsDisabledHotload() {
|
||||||
IrisSettings defaults = new IrisSettings();
|
IrisSettings defaults = new IrisSettings();
|
||||||
assertTrue(defaults.getStudio().isBlendChanges());
|
assertTrue(defaults.getStudio().isBlendChanges());
|
||||||
assertTrue(new Gson().fromJson("{\"studio\":{}}", IrisSettings.class).getStudio().isBlendChanges());
|
assertTrue(IrisSettings.parseHotloadSnapshot("[studio]").getStudio().isBlendChanges());
|
||||||
assertTrue(new Gson().toJson(defaults).contains("\"blendChanges\":true"));
|
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());
|
assertFalse(changed.getStudio().isBlendChanges());
|
||||||
assertEquals(256, changed.getGenerator().getGenerationTransitionWidthBlocks());
|
assertEquals(256, changed.getGenerator().getGenerationTransitionWidthBlocks());
|
||||||
@@ -91,11 +89,10 @@ public class IrisSettingsDefaultsTest {
|
|||||||
IrisSettings.settings = live;
|
IrisSettings.settings = live;
|
||||||
try {
|
try {
|
||||||
assertThrows(IllegalArgumentException.class,
|
assertThrows(IllegalArgumentException.class,
|
||||||
() -> IrisSettings.installHotloadSnapshot("{\"general\":"));
|
() -> IrisSettings.installHotloadSnapshot("[general"));
|
||||||
assertSame(live, IrisSettings.settings);
|
assertSame(live, IrisSettings.settings);
|
||||||
|
|
||||||
IrisSettings installed = IrisSettings.installHotloadSnapshot(
|
IrisSettings installed = IrisSettings.installHotloadSnapshot("[general]\nlanguage = \"fr_FR\"");
|
||||||
"{\"general\":{\"language\":\"fr_FR\"},\"world\":null}");
|
|
||||||
assertSame(installed, IrisSettings.settings);
|
assertSame(installed, IrisSettings.settings);
|
||||||
assertEquals("fr_FR", installed.getGeneral().getLanguage());
|
assertEquals("fr_FR", installed.getGeneral().getLanguage());
|
||||||
assertNotNull(installed.getWorld());
|
assertNotNull(installed.getWorld());
|
||||||
@@ -112,7 +109,7 @@ public class IrisSettingsDefaultsTest {
|
|||||||
IrisSettings.settings = live;
|
IrisSettings.settings = live;
|
||||||
try {
|
try {
|
||||||
boolean applied = IrisSettings.applyHotloadSnapshot(
|
boolean applied = IrisSettings.applyHotloadSnapshot(
|
||||||
"{\"general\":{\"language\":\"de_DE\"}}",
|
"[general]\nlanguage = \"de_DE\"",
|
||||||
candidate -> false
|
candidate -> false
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -131,7 +128,7 @@ public class IrisSettingsDefaultsTest {
|
|||||||
IrisSettings.settings = live;
|
IrisSettings.settings = live;
|
||||||
try {
|
try {
|
||||||
boolean applied = IrisSettings.applyHotloadSnapshot(
|
boolean applied = IrisSettings.applyHotloadSnapshot(
|
||||||
"{\"general\":{\"language\":\"de_DE\"},\"world\":null}",
|
"[general]\nlanguage = \"de_DE\"",
|
||||||
candidate -> "de_DE".equals(candidate.getGeneral().getLanguage())
|
candidate -> "de_DE".equals(candidate.getGeneral().getLanguage())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,197 @@
|
|||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
@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);
|
||||||
|
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 legacyJsonIsConvertedAndRenamed() throws Exception {
|
||||||
|
File legacy = new File(settingsFile.getParentFile(), IrisSettingsFile.LEGACY_FILE_NAME);
|
||||||
|
Files.writeString(legacy.toPath(), "{\"general\":{\"debug\":true,\"language\":\"de_DE\"},\"pregen\":{\"chunkLoadTimeoutSeconds\":40}}");
|
||||||
|
|
||||||
|
IrisSettings loaded = IrisSettingsFile.load();
|
||||||
|
|
||||||
|
assertTrue(loaded.getGeneral().isDebug());
|
||||||
|
assertEquals("de_DE", loaded.getGeneral().getLanguage());
|
||||||
|
assertEquals(40, loaded.getPregen().chunkLoadTimeoutSeconds);
|
||||||
|
assertEquals(new Gson().toJson(loaded), new Gson().toJson(IrisSettingsFile.parse(Files.readString(settingsFile.toPath()))));
|
||||||
|
assertFalse(legacy.exists());
|
||||||
|
assertTrue(new File(settingsFile.getParentFile(), IrisSettingsFile.MIGRATED_FILE_NAME).isFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void brokenLegacyJsonIsLeftForTheAdmin() throws Exception {
|
||||||
|
File legacy = new File(settingsFile.getParentFile(), IrisSettingsFile.LEGACY_FILE_NAME);
|
||||||
|
Files.writeString(legacy.toPath(), "{\"general\":{\"debug\":tru");
|
||||||
|
|
||||||
|
IrisSettings loaded = IrisSettingsFile.load();
|
||||||
|
|
||||||
|
assertFalse(loaded.getGeneral().isDebug());
|
||||||
|
assertTrue(legacy.isFile());
|
||||||
|
assertFalse(settingsFile.exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void tomlWinsOverLegacyJson() throws Exception {
|
||||||
|
File legacy = new File(settingsFile.getParentFile(), IrisSettingsFile.LEGACY_FILE_NAME);
|
||||||
|
Files.writeString(legacy.toPath(), "{\"general\":{\"debug\":true}}");
|
||||||
|
Files.writeString(settingsFile.toPath(), IrisSettingsFile.render(new IrisSettings()));
|
||||||
|
|
||||||
|
IrisSettings loaded = IrisSettingsFile.load();
|
||||||
|
|
||||||
|
assertFalse(loaded.getGeneral().isDebug());
|
||||||
|
assertTrue(legacy.isFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 fileWithEverySettingIsNotRewritten() throws Exception {
|
||||||
|
String adminEdited = IrisSettingsFile.render(new IrisSettings())
|
||||||
|
.replace("debug = false\n", "")
|
||||||
|
.replace("[general]\n", "[general]\n# Turned on while chasing a bug\ndebug = true\n")
|
||||||
|
.replace("[world]\n", "[world]\nretiredOption = 3\n")
|
||||||
|
+ "\n[custom]\nnote = \"kept\"\n";
|
||||||
|
Files.writeString(settingsFile.toPath(), adminEdited);
|
||||||
|
Files.setLastModifiedTime(settingsFile.toPath(), LONG_AGO);
|
||||||
|
|
||||||
|
IrisSettings loaded = IrisSettingsFile.load();
|
||||||
|
|
||||||
|
assertTrue(loaded.getGeneral().isDebug());
|
||||||
|
assertEquals(adminEdited, Files.readString(settingsFile.toPath()));
|
||||||
|
assertEquals(LONG_AGO, Files.getLastModifiedTime(settingsFile.toPath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void missingKeysAreAddedOnLoad() throws Exception {
|
||||||
|
Files.writeString(settingsFile.toPath(), "# Admin header\n[general]\n# keep debug on\ndebug = true\n");
|
||||||
|
|
||||||
|
IrisSettings loaded = IrisSettingsFile.load();
|
||||||
|
|
||||||
|
String rewritten = Files.readString(settingsFile.toPath());
|
||||||
|
assertTrue(rewritten.startsWith("# Admin header\n[general]\nlanguage = \"en_US\"\nmetrics = true\n"));
|
||||||
|
assertTrue(rewritten.contains("\n# keep debug on\ndebug = true\n"));
|
||||||
|
assertTrue(rewritten.contains("\n[studio]\n"));
|
||||||
|
assertEquals(new Gson().toJson(loaded), new Gson().toJson(IrisSettingsFile.parse(rewritten)));
|
||||||
|
Files.setLastModifiedTime(settingsFile.toPath(), LONG_AGO);
|
||||||
|
IrisSettingsFile.load();
|
||||||
|
assertEquals(LONG_AGO, Files.getLastModifiedTime(settingsFile.toPath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void savingKeepsAdminComments() throws Exception {
|
||||||
|
String adminEdited = "# Admin header\n" + IrisSettingsFile.render(new IrisSettings());
|
||||||
|
Files.writeString(settingsFile.toPath(), adminEdited);
|
||||||
|
IrisSettings loaded = IrisSettingsFile.load();
|
||||||
|
loaded.getGeneral().setDebug(true);
|
||||||
|
|
||||||
|
loaded.forceSave();
|
||||||
|
|
||||||
|
assertEquals(adminEdited.replace("\ndebug = false\n", "\ndebug = true\n"), Files.readString(settingsFile.toPath()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void undocumentedSettingsHaveNoComment() {
|
||||||
|
String rendered = IrisSettingsFile.render(new IrisSettings());
|
||||||
|
|
||||||
|
assertFalse(lineBefore(rendered, "debug = false").startsWith("#"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String lineBefore(String text, String line) {
|
||||||
|
List<String> lines = text.lines().toList();
|
||||||
|
int index = lines.indexOf(line);
|
||||||
|
assertTrue(index > 0);
|
||||||
|
return lines.get(index - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
-8
@@ -21,7 +21,7 @@ import static org.mockito.Mockito.never;
|
|||||||
import static org.mockito.Mockito.verify;
|
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
|
* 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.
|
* settings change an operator made in game into something that silently vanished on the next boot.
|
||||||
*/
|
*/
|
||||||
@@ -53,10 +53,10 @@ public class IrisSettingsRewriteFailureTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void anUnwritableSettingsFileIsReported() throws Exception {
|
public void anUnwritableSettingsFileIsReported() throws Exception {
|
||||||
File settingsFile = temporaryFolder.newFile("iris.json");
|
File settingsFile = temporaryFolder.newFile(IrisSettingsFile.FILE_NAME);
|
||||||
Files.writeString(settingsFile.toPath(), "{}");
|
Files.writeString(settingsFile.toPath(), "[general]");
|
||||||
assertTrue("this test needs a file the JVM can mark read-only", settingsFile.setWritable(false));
|
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.invalidate();
|
||||||
IrisSettings.get();
|
IrisSettings.get();
|
||||||
@@ -66,14 +66,14 @@ public class IrisSettingsRewriteFailureTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void aWritableSettingsFileIsRewrittenQuietly() throws Exception {
|
public void aWritableSettingsFileIsRewrittenQuietly() throws Exception {
|
||||||
File settingsFile = temporaryFolder.newFile("iris.json");
|
File settingsFile = temporaryFolder.newFile(IrisSettingsFile.FILE_NAME);
|
||||||
Files.writeString(settingsFile.toPath(), "{}");
|
Files.writeString(settingsFile.toPath(), "[general]");
|
||||||
doReturn(settingsFile).when(capturingPlatform).dataFile("iris.json");
|
doReturn(settingsFile).when(capturingPlatform).dataFile(IrisSettingsFile.FILE_NAME);
|
||||||
|
|
||||||
IrisSettings.invalidate();
|
IrisSettings.invalidate();
|
||||||
IrisSettings.get();
|
IrisSettings.get();
|
||||||
|
|
||||||
verify(capturingPlatform, never()).reportError(anyString(), any(Throwable.class));
|
verify(capturingPlatform, never()).reportError(anyString(), any(Throwable.class));
|
||||||
assertTrue(Files.readString(settingsFile.toPath()).contains("general"));
|
assertTrue(Files.readString(settingsFile.toPath()).contains("[general]"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ public class SettingsHotloadWatchTest {
|
|||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
previousSettings = IrisSettings.settings;
|
previousSettings = IrisSettings.settings;
|
||||||
dataFolder = temporaryFolder.newFolder("iris-hotload");
|
dataFolder = temporaryFolder.newFolder("iris-hotload");
|
||||||
settingsFile = new File(dataFolder, "iris.json");
|
settingsFile = new File(dataFolder, IrisSettingsFile.FILE_NAME);
|
||||||
overrideFolder = new File(dataFolder, "languages");
|
overrideFolder = new File(dataFolder, "languages");
|
||||||
Files.createDirectories(overrideFolder.toPath());
|
Files.createDirectories(overrideFolder.toPath());
|
||||||
String settings = settings("en_US");
|
String settings = settings("en_US");
|
||||||
@@ -416,7 +416,7 @@ public class SettingsHotloadWatchTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String settings(String locale) {
|
private String settings(String locale) {
|
||||||
return "{\"general\":{\"language\":\"" + locale + "\"}}";
|
return "[general]\nlanguage = \"" + locale + "\"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String locale(String locale, String permissionMessage) {
|
private String locale(String locale, String permissionMessage) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package art.arcane.iris.generation.runtime;
|
package art.arcane.iris.generation.runtime;
|
||||||
|
|
||||||
|
import art.arcane.iris.configuration.IrisSettingsFile;
|
||||||
import art.arcane.iris.structure.nativegen.NativeStructureVolumeIndex;
|
import art.arcane.iris.structure.nativegen.NativeStructureVolumeIndex;
|
||||||
import art.arcane.iris.structure.placement.StructureReachability;
|
import art.arcane.iris.structure.placement.StructureReachability;
|
||||||
import art.arcane.iris.structure.placement.StructurePlacementScope;
|
import art.arcane.iris.structure.placement.StructurePlacementScope;
|
||||||
@@ -91,7 +92,7 @@ public class EngineShutdownDrainTest {
|
|||||||
previousPlatform = IrisPlatforms.isBound() ? IrisPlatforms.get() : null;
|
previousPlatform = IrisPlatforms.isBound() ? IrisPlatforms.get() : null;
|
||||||
IrisPlatforms.unbind();
|
IrisPlatforms.unbind();
|
||||||
IrisPlatform platform = mock(IrisPlatform.class);
|
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);
|
PlatformRegistries registries = mock(PlatformRegistries.class);
|
||||||
when(platform.registries()).thenReturn(registries);
|
when(platform.registries()).thenReturn(registries);
|
||||||
when(registries.block(anyString())).thenReturn(mock(NativeBlockState.class));
|
when(registries.block(anyString())).thenReturn(mock(NativeBlockState.class));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package art.arcane.iris.localization;
|
package art.arcane.iris.localization;
|
||||||
|
|
||||||
import art.arcane.iris.configuration.IrisSettings;
|
import art.arcane.iris.configuration.IrisSettings;
|
||||||
|
import art.arcane.iris.configuration.IrisSettingsFile;
|
||||||
import art.arcane.iris.testsupport.ProjectPaths;
|
import art.arcane.iris.testsupport.ProjectPaths;
|
||||||
import art.arcane.volmlib.util.localization.MessageArgument;
|
import art.arcane.volmlib.util.localization.MessageArgument;
|
||||||
import art.arcane.volmlib.util.localization.LocaleOverlay;
|
import art.arcane.volmlib.util.localization.LocaleOverlay;
|
||||||
@@ -171,7 +172,7 @@ public class IrisLanguageTest {
|
|||||||
IrisSettings previous = IrisSettings.settings;
|
IrisSettings previous = IrisSettings.settings;
|
||||||
IrisSettings current = new IrisSettings();
|
IrisSettings current = new IrisSettings();
|
||||||
IrisSettings.settings = current;
|
IrisSettings.settings = current;
|
||||||
Files.createDirectory(dataFolder.toPath().resolve("iris.json"));
|
Files.createDirectory(dataFolder.toPath().resolve(IrisSettingsFile.FILE_NAME));
|
||||||
IrisLanguage.start();
|
IrisLanguage.start();
|
||||||
try {
|
try {
|
||||||
assertThrows(ExecutionException.class,
|
assertThrows(ExecutionException.class,
|
||||||
@@ -525,7 +526,7 @@ public class IrisLanguageTest {
|
|||||||
IrisSettings.settings = live;
|
IrisSettings.settings = live;
|
||||||
try {
|
try {
|
||||||
boolean applied = IrisSettings.applyHotloadSnapshot(
|
boolean applied = IrisSettings.applyHotloadSnapshot(
|
||||||
"{\"general\":{\"language\":\"../invalid\"}}",
|
"[general]\nlanguage = \"../invalid\"",
|
||||||
IrisLanguage::reload
|
IrisLanguage::reload
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user