mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 01:04:29 +00:00
Store Iris settings in iris.toml
Moves an existing iris.json over on first load
This commit is contained in:
1 parent
1e04f61957
commit
0bf7c346a2
34 files changed
+403
-174
No files matched your search
@@ -21,6 +21,7 @@ package art.arcane.iris;
|
||||
import art.arcane.iris.api.terrain.IrisTerrainService;
|
||||
import art.arcane.iris.command.CommandSVC;
|
||||
import art.arcane.iris.configuration.IrisSettings;
|
||||
import art.arcane.iris.configuration.IrisSettingsFile;
|
||||
import art.arcane.iris.configuration.SettingsHotloadWatch;
|
||||
import art.arcane.iris.diagnostics.LogFilterSVC;
|
||||
import art.arcane.iris.diagnostics.splash.IrisSplashComposer;
|
||||
@@ -735,7 +736,7 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
(EngineWorldManagerProvider) IrisWorldManager::new);
|
||||
IrisServices.register(WorldDeletionQueue.class, pendingWorldDeletes);
|
||||
IrisServices.register(ManagedWorldLoader.class, (ManagedWorldLoader) this::loadManagedWorld);
|
||||
SettingsHotloadWatch watch = new SettingsHotloadWatch(plugin.getDataFile("iris.json"));
|
||||
SettingsHotloadWatch watch = new SettingsHotloadWatch(plugin.getDataFile(IrisSettingsFile.FILE_NAME));
|
||||
settingsHotloadWatch = watch;
|
||||
StudioSVC.gateDownloadsOnStaleTempCleanup(MultiBurst.ioBurst.completeValueAsync(() -> {
|
||||
IO.delete(getTemp());
|
||||
|
||||
@@ -4,12 +4,22 @@ import path from 'node:path'
|
||||
import { packKey, worldKey, seed, parsePhase, setup, exists, writeJson, readJson,
|
||||
openStudio, closeStudio, sampleTerrain, logPosition, logSince } from './studio-support.mjs'
|
||||
|
||||
async function disableStudioSideEffects(settingsFile) {
|
||||
let inStudio = false
|
||||
const lines = (await readFile(settingsFile, 'utf8')).split('\n').map(line => {
|
||||
const header = line.match(/^\[(.+)\]\s*$/)
|
||||
if (header) {
|
||||
inStudio = header[1] === 'studio'
|
||||
return line
|
||||
}
|
||||
return inStudio ? line.replace(/^(openVSCode|entitySpawning)\s*=.*$/, '$1 = false') : line
|
||||
})
|
||||
await writeFile(settingsFile, lines.join('\n'))
|
||||
}
|
||||
|
||||
async function prepare(context, fixture) {
|
||||
context.expect(!(await exists(fixture.marker)) && !(await exists(fixture.pack)), 'Prepare requires a new disposable instance and an unused fixture pack')
|
||||
const settingsFile = path.join(fixture.irisRoot, 'iris.json')
|
||||
const settings = await readJson(settingsFile)
|
||||
settings.studio = { ...settings.studio, openVSCode: false, entitySpawning: false }
|
||||
await writeJson(settingsFile, settings)
|
||||
await disableStudioSideEffects(path.join(fixture.irisRoot, 'iris.toml'))
|
||||
await context.command(`/iris studio create name=${packKey}`, new RegExp(`Created studio project '${packKey}'`), 180000)
|
||||
for (const relative of [`dimensions/${packKey}.json`, 'regions/starter.json', 'biomes/starter.json', `${packKey}.code-workspace`]) {
|
||||
context.expect(await exists(path.join(fixture.pack, relative)), `Studio create omitted ${relative}`)
|
||||
|
||||
+3
-3
@@ -38,11 +38,11 @@ public class IrisUpdateNotifierTest {
|
||||
|
||||
clearInvocations(service);
|
||||
assertFalse(IrisSettings.applyHotloadSnapshot(
|
||||
"{\"general\":{\"updateNotifications\":false}}", candidate -> false));
|
||||
"[general]\nupdateNotifications = false", candidate -> false));
|
||||
assertTrue(options.getValue().enabled().getAsBoolean());
|
||||
verifyNoInteractions(service);
|
||||
|
||||
IrisSettings.installHotloadSnapshot("{\"general\":{\"updateNotifications\":false}}");
|
||||
IrisSettings.installHotloadSnapshot("[general]\nupdateNotifications = false");
|
||||
assertFalse(options.getValue().enabled().getAsBoolean());
|
||||
verify(service).reconfigure();
|
||||
IrisSettings.settings.getGeneral().setUpdateNotifications(true);
|
||||
@@ -52,7 +52,7 @@ public class IrisUpdateNotifierTest {
|
||||
}
|
||||
verify(service).close();
|
||||
clearInvocations(service);
|
||||
IrisSettings.installHotloadSnapshot("{}");
|
||||
IrisSettings.installHotloadSnapshot("[general]");
|
||||
verifyNoInteractions(service);
|
||||
} finally {
|
||||
IrisSettings.settings = previous;
|
||||
|
||||
Reference in new issue
Block a user