diff --git a/BetterRTP-Core/pom.xml b/BetterRTP-Core/pom.xml index 28904b8..153106f 100644 --- a/BetterRTP-Core/pom.xml +++ b/BetterRTP-Core/pom.xml @@ -12,7 +12,7 @@ - 1.0.1 + 1.1.0 8 UTF-8 https://www.minecentral.net diff --git a/BetterRTP-Core/src/main/java/me/SuperRonanCraft/BetterRTP/BetterRTP.java b/BetterRTP-Core/src/main/java/me/SuperRonanCraft/BetterRTP/BetterRTP.java index d7a5fa8..a8525e8 100644 --- a/BetterRTP-Core/src/main/java/me/SuperRonanCraft/BetterRTP/BetterRTP.java +++ b/BetterRTP-Core/src/main/java/me/SuperRonanCraft/BetterRTP/BetterRTP.java @@ -1,7 +1,7 @@ package me.SuperRonanCraft.BetterRTP; import com.ronanplugins.bettersync.editor.EditorClient; -import com.ronanplugins.bettersync.editor.EditorProfile; +import com.ronanplugins.bettersync.editor.EditorSchema; import lombok.Getter; import me.SuperRonanCraft.BetterRTP.player.PlayerInfo; @@ -58,7 +58,7 @@ public class BetterRTP extends JavaPlugin { registerDependencies(); loadAll(); editorBridge = new EditorClient( - this, EditorProfile.BETTERRTP, + this, EditorSchema.load(this, "META-INF/editor-schema.json"), EditorClient.website(this, "META-INF/betterrtp-editor.properties"), me.SuperRonanCraft.BetterRTP.versions.AsyncHandler::sync, this::reload, me.SuperRonanCraft.BetterRTP.references.PermissionNode.EDITOR::check, diff --git a/BetterRTP-Core/src/main/resources/META-INF/editor-schema.json b/BetterRTP-Core/src/main/resources/META-INF/editor-schema.json new file mode 100644 index 0000000..021073a --- /dev/null +++ b/BetterRTP-Core/src/main/resources/META-INF/editor-schema.json @@ -0,0 +1,343 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.ronanplugins.com/betterrtp/1", + "title": "BetterRTP editor configuration", + "type": "object", + "required": [ + "Settings", + "Default" + ], + "properties": { + "Settings": { + "type": "object" + }, + "Default": { + "type": "object", + "properties": { + "Biomes": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "string", + "pattern": "\\S" + } + } + }, + "x-ranges": [ + { + "min": "MinRadius", + "max": "MaxRadius", + "strict": true + }, + { + "min": "MinY", + "max": "MaxY", + "strict": false + } + ] + }, + "Language-File": { + "type": "string", + "x-immutable": true, + "description": "Change the language file locally." + }, + "BlacklistedBlocks": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "string", + "pattern": "\\S" + } + }, + "DisabledWorlds": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "string", + "pattern": "\\S" + } + }, + "Overrides": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "object", + "minProperties": 1, + "additionalProperties": { + "type": "string", + "x-entryName": true + } + }, + "x-named": true, + "x-editor": { + "collection": "overrides" + } + }, + "WorldType": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "object", + "minProperties": 1, + "additionalProperties": { + "type": "string", + "enum": [ + "NORMAL", + "NETHER" + ], + "x-caseInsensitive": true + } + }, + "x-named": true, + "x-editor": { + "collection": "types" + } + }, + "CustomWorlds": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "object", + "minProperties": 1, + "additionalProperties": { + "type": "object", + "properties": { + "UseWorldBorder": { + "type": "boolean", + "default": false + }, + "MaxRadius": { + "type": "integer", + "default": 1000 + }, + "MinRadius": { + "type": "integer", + "default": 10 + }, + "CenterX": { + "type": "integer", + "default": 0 + }, + "CenterZ": { + "type": "integer", + "default": 0 + }, + "Price": { + "type": "integer", + "default": 0 + }, + "Shape": { + "type": "string", + "default": "square" + }, + "MaxY": { + "type": "integer", + "default": 320 + }, + "MinY": { + "type": "integer", + "default": 0 + }, + "Cooldown": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "RTPOnDeath": { + "type": "boolean", + "default": false + }, + "Biomes": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "string", + "pattern": "\\S" + } + } + }, + "x-editableProperties": true, + "x-inherit": "Default", + "x-ranges": [ + { + "min": "MinRadius", + "max": "MaxRadius", + "strict": true + }, + { + "min": "MinY", + "max": "MaxY", + "strict": false + } + ] + } + }, + "x-named": true, + "x-editor": { + "collection": "worlds" + } + }, + "PermissionGroup": { + "type": "object", + "properties": { + "Groups": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "object", + "minProperties": 1, + "additionalProperties": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "object", + "minProperties": 1, + "additionalProperties": { + "type": "object", + "properties": { + "UseWorldBorder": { + "type": "boolean", + "default": false + }, + "MaxRadius": { + "type": "integer", + "default": 1000 + }, + "MinRadius": { + "type": "integer", + "default": 10 + }, + "CenterX": { + "type": "integer", + "default": 0 + }, + "CenterZ": { + "type": "integer", + "default": 0 + }, + "Price": { + "type": "integer", + "default": 0 + }, + "Shape": { + "type": "string", + "default": "square" + }, + "MaxY": { + "type": "integer", + "default": 320 + }, + "MinY": { + "type": "integer", + "default": 0 + }, + "Cooldown": { + "type": "integer", + "minimum": 0, + "default": 0 + }, + "RTPOnDeath": { + "type": "boolean", + "default": false + }, + "Biomes": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "string", + "pattern": "\\S" + } + }, + "Priority": { + "type": "integer", + "default": 0 + } + }, + "x-editableProperties": true, + "x-inherit": "Default", + "x-ranges": [ + { + "min": "MinRadius", + "max": "MaxRadius", + "strict": true + }, + { + "min": "MinY", + "max": "MaxY", + "strict": false + } + ] + } + }, + "x-named": true, + "x-editor": { + "collection": "worlds" + } + } + }, + "x-named": true, + "x-editor": { + "collection": "groups" + } + } + } + } + }, + "x-bettersync": { + "format": 1, + "plugin": "betterrtp", + "schemaVersion": "1", + "displayName": "BetterRTP" + }, + "x-rules": [ + { + "path": ".*Radius$", + "schema": { + "minimum": 0, + "maximum": 30000000 + } + }, + { + "path": ".*\\.(Time|LockAfter)$", + "schema": { + "minimum": 0 + } + }, + { + "path": ".*\\.PreloadRadius$", + "schema": { + "minimum": 0, + "maximum": 16 + } + }, + { + "path": ".*\\.MaxAttempts$", + "schema": { + "minimum": 1, + "maximum": 10000 + } + }, + { + "path": ".*\\.Shape$", + "schema": { + "enum": [ + "square", + "circle" + ], + "x-caseInsensitive": true + } + } + ], + "x-objectRanges": [ + { + "min": "MinRadius", + "max": "MaxRadius", + "strict": true + }, + { + "min": "MinY", + "max": "MaxY", + "strict": false + } + ] +} diff --git a/BetterRTPAddons/pom.xml b/BetterRTPAddons/pom.xml index 1437ff9..dc59acc 100644 --- a/BetterRTPAddons/pom.xml +++ b/BetterRTPAddons/pom.xml @@ -11,7 +11,7 @@ https://www.minecentral.net - 1.0.1 + 1.1.0 1.8 1.8 UTF-8 diff --git a/BetterRTPAddons/src/main/java/me/SuperRonanCraft/BetterRTPAddons/Main.java b/BetterRTPAddons/src/main/java/me/SuperRonanCraft/BetterRTPAddons/Main.java index 8a5e806..0ebb533 100644 --- a/BetterRTPAddons/src/main/java/me/SuperRonanCraft/BetterRTPAddons/Main.java +++ b/BetterRTPAddons/src/main/java/me/SuperRonanCraft/BetterRTPAddons/Main.java @@ -1,7 +1,7 @@ package me.SuperRonanCraft.BetterRTPAddons; import com.ronanplugins.bettersync.editor.EditorClient; -import com.ronanplugins.bettersync.editor.EditorProfile; +import com.ronanplugins.bettersync.editor.EditorSchema; import lombok.Getter; import me.SuperRonanCraft.BetterRTPAddons.util.Files; @@ -33,7 +33,7 @@ public class Main extends JavaPlugin { Bukkit.getPluginManager().registerEvents(reloadListener, this); load(); editorBridge = new EditorClient( - this, EditorProfile.BETTERRTP_ADDONS, + this, EditorSchema.load(this, "META-INF/editor-schema.json"), EditorClient.website(this, "META-INF/betterrtp-addons-editor.properties"), me.SuperRonanCraft.BetterRTP.versions.AsyncHandler::sync, sender -> load(), this::canEdit, () -> Files.FILETYPE.CONFIG.getConfig().saveToString()); diff --git a/BetterRTPAddons/src/main/resources/META-INF/editor-schema.json b/BetterRTPAddons/src/main/resources/META-INF/editor-schema.json new file mode 100644 index 0000000..b6ccdb2 --- /dev/null +++ b/BetterRTPAddons/src/main/resources/META-INF/editor-schema.json @@ -0,0 +1,217 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://schemas.ronanplugins.com/betterrtp-addons/1", + "title": "BetterRTP Addons editor configuration", + "type": "object", + "required": [ + "Flashback", + "Logger", + "Portals", + "ExtraEffects", + "MagicStick", + "Commands", + "Parties", + "RTPMenu" + ], + "properties": { + "Flashback": { + "type": "object", + "properties": { + "Timer": { + "type": "object", + "properties": { + "Delay": { + "minimum": 0 + }, + "Warnings": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "object", + "minProperties": 1, + "additionalProperties": { + "type": "string" + }, + "propertyNames": { + "pattern": "^[0-9]+$", + "x-maxNumericName": 2147483647 + } + }, + "x-named": true, + "x-editor": { + "collection": "warnings" + } + } + } + } + } + }, + "Logger": { + "type": "object", + "properties": { + "Format": { + "type": "string", + "x-serverCheck": "date" + } + } + }, + "Portals": { + "type": "object" + }, + "ExtraEffects": { + "type": "object" + }, + "MagicStick": { + "type": "object", + "properties": { + "GiveFirstJoin": { + "type": "object", + "properties": { + "Amount": { + "type": "integer", + "minimum": 1, + "maximum": 64 + } + } + }, + "Item": { + "type": "object", + "properties": { + "Material": { + "type": "string", + "x-serverCheck": "material" + } + } + } + } + }, + "Commands": { + "type": "object" + }, + "Parties": { + "type": "object" + }, + "RTPMenu": { + "type": "object", + "properties": { + "Lines": { + "type": "integer", + "minimum": 1, + "maximum": 6 + }, + "AutoRefresh": { + "minimum": 0 + }, + "WorldList": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "object", + "minProperties": 1, + "additionalProperties": { + "type": "object", + "properties": { + "Name": { + "type": "string", + "default": "" + }, + "Item": { + "type": "string", + "default": "MAP", + "x-serverCheck": "material" + }, + "Slot": { + "type": "integer", + "minimum": 0, + "default": 0, + "x-lessThan": { + "path": "RTPMenu.Lines", + "multiply": 9 + } + }, + "Lore": { + "type": "array", + "maxItems": 1000, + "items": { + "type": "string" + }, + "default": [] + } + }, + "x-editableProperties": true, + "x-defaultChecks": { + "Slot": 0 + } + } + }, + "x-named": true, + "x-editor": { + "collection": "menu" + } + } + } + }, + "Language-File": { + "type": "string", + "x-immutable": true, + "description": "Change the language file locally." + } + }, + "x-bettersync": { + "format": 1, + "plugin": "betterrtp-addons", + "schemaVersion": "1", + "displayName": "BetterRTP Addons" + }, + "x-rules": [ + { + "path": ".*Radius$", + "schema": { + "minimum": 0, + "maximum": 30000000 + } + }, + { + "path": ".*\\.(Time|LockAfter)$", + "schema": { + "minimum": 0 + } + }, + { + "path": ".*\\.PreloadRadius$", + "schema": { + "minimum": 0, + "maximum": 16 + } + }, + { + "path": ".*\\.MaxAttempts$", + "schema": { + "minimum": 1, + "maximum": 10000 + } + }, + { + "path": ".*\\.Shape$", + "schema": { + "enum": [ + "square", + "circle" + ], + "x-caseInsensitive": true + } + } + ], + "x-objectRanges": [ + { + "min": "MinRadius", + "max": "MaxRadius", + "strict": true + }, + { + "min": "MinY", + "max": "MaxY", + "strict": false + } + ] +} diff --git a/README.md b/README.md index 7016c7a..f1faa04 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,28 @@ The wiki is available [here](../../wiki)! ## Shared editor library The web editor uses [BetterSync](https://github.com/RonanPlugins/BetterSync), -downloaded by Maven from JitPack as `com.github.RonanPlugins:BetterSync:1.0.1`. -No local BetterSync project or manual Maven install is required. Release `1.0.1` is published on JitPack. Update `bettersync.version` in the plugin and editor-test +downloaded by Maven from JitPack as `com.github.RonanPlugins:BetterSync:1.1.0`. +No local BetterSync project or manual Maven install is required. Release `1.1.0` is published on JitPack. Update `bettersync.version` in the plugin and editor-test POMs together when upgrading. Shade bundles and relocates the library into the plugin JAR; server owners do not install a separate BetterSync plugin. The plugin retains its scheduler, permissions, reload callbacks, and filtered `editor.website` setting. Editor transport and configuration validation are maintained in BetterSync. + +### Editor schema ownership + +Each plugin module owns `src/main/resources/META-INF/editor-schema.json`. Edit rules here, +not in the website or BetterSync's deprecated legacy profiles. `EditorSchema.load` reads +this resource from the plugin JAR; the client sends its independent `schemaVersion` and +checks the version returned by the website before applying changes. + +Publish the same schema bytes as a public BetterSync GitHub release asset, then add the +asset URL and SHA-256 to the website's `editor-schemas.lock.json`. Keep old versions in the +lock for older servers. A changed rule requires a new schema version; plugin bug fixes +that do not affect configuration can retain the version. Schema publication does not +publish the rest of a private plugin repository. + +Deploy the matching website and its schema-version database migrations before installing +the new plugin JARs. Schema resources are bundled automatically by Maven; no sibling +plugin/library checkout is needed to compile this project. diff --git a/tests/editor/pom.xml b/tests/editor/pom.xml index cbb7df5..1f7e8ef 100644 --- a/tests/editor/pom.xml +++ b/tests/editor/pom.xml @@ -1,7 +1,7 @@ 4.0.0 me.SuperRonanCraftbetterrtp-editor-tests1.0 - 1.0.18UTF-8 + 1.1.08UTF-8 spigothttps://hub.spigotmc.org/nexus/content/repositories/snapshots/jitpack.iohttps://jitpack.io com.github.RonanPluginsBetterSync${bettersync.version} diff --git a/tests/editor/src/test/java/EditorConfigTest.java b/tests/editor/src/test/java/EditorConfigTest.java index 9759116..ec4675d 100644 --- a/tests/editor/src/test/java/EditorConfigTest.java +++ b/tests/editor/src/test/java/EditorConfigTest.java @@ -1,4 +1,3 @@ -import com.ronanplugins.bettersync.editor.betterrtp.EditorConfig; import org.junit.Test; import static org.junit.Assert.*; import java.nio.file.*; @@ -7,7 +6,7 @@ import java.nio.charset.StandardCharsets; public class EditorConfigTest { private final String original = "Language-File: en.yml\nSettings:\n MaxAttempts: 32\n PreloadRadius: 5\nDefault:\n MinRadius: 10\n MaxRadius: 1000\n Shape: square\n Biomes: []\n"; private void rejected(String edited) throws Exception { - try { EditorConfig.validate(original, edited); fail("Expected rejection"); } + try { SchemaConfig.validate(original, edited); fail("Expected rejection"); } catch (java.io.IOException expected) { } } private String addons() throws Exception { @@ -15,15 +14,15 @@ public class EditorConfigTest { } @Test public void acceptsAddonDefaultsAndCollectionEdits() throws Exception { String before = addons(); - EditorConfig.validate(before, before); + SchemaConfig.validate(before, before); String after = before.replace("600: ", "300: ").replace("world_nether:", "survival:").replace("Lines: 3", "Lines: 4"); - EditorConfig.validate(before, after); + SchemaConfig.validate(before, after); Path dir = Files.createTempDirectory("addons-editor"); Path file = dir.resolve("config.yml"); Files.write(file, before.getBytes(StandardCharsets.UTF_8)); - Path backup = EditorConfig.apply(file, before.getBytes(StandardCharsets.UTF_8), after, () -> {}); + Path backup = SchemaConfig.apply(file, before.getBytes(StandardCharsets.UTF_8), after, () -> {}); assertEquals(before, new String(Files.readAllBytes(backup), StandardCharsets.UTF_8)); - assertTrue(EditorConfig.equivalent(after, new String(Files.readAllBytes(file), StandardCharsets.UTF_8))); + assertTrue(SchemaConfig.equivalent(after, new String(Files.readAllBytes(file), StandardCharsets.UTF_8))); } @Test public void rejectsInvalidAddonSettingsAndUnsafeYaml() throws Exception { String before = addons(); @@ -32,13 +31,13 @@ public class EditorConfigTest { before.replace("AutoRefresh: 0", "AutoRefresh: -1"), before.replace("600:", "bad:"), before.replace("en.yml", "other.yml"), before + "Bad: &anchor value\n", before + "Bad: !!java/object something\n", before + "Bad:\n ==: org.bukkit.inventory.ItemStack\n" }) { - try { EditorConfig.validate(before, after); fail("Expected addon validation failure"); } + try { SchemaConfig.validate(before, after); fail("Expected addon validation failure"); } catch (java.io.IOException expected) { } } - try { EditorConfig.validate(original, before); fail("Expected cross-plugin failure"); } + try { SchemaConfig.validate(original, before); fail("Expected cross-plugin failure"); } catch (java.io.IOException expected) { } } - @Test public void acceptsValidChange() throws Exception { EditorConfig.validate(original, original.replace("1000", "2000")); } + @Test public void acceptsValidChange() throws Exception { SchemaConfig.validate(original, original.replace("1000", "2000")); } @Test public void rejectsWrongTypeAndRange() throws Exception { rejected(original.replace("1000", "false")); rejected(original.replace("1000", "5")); @@ -57,7 +56,7 @@ public class EditorConfigTest { } @Test public void validatesBundledConfig() throws Exception { String bundled = new String(Files.readAllBytes(Paths.get("../../BetterRTP-Core/src/main/resources/config.yml")), StandardCharsets.UTF_8); - EditorConfig.validate(bundled, bundled.replace("MaxRadius: 1000\n", "MaxRadius: 2000\n")); + SchemaConfig.validate(bundled, bundled.replace("MaxRadius: 1000\n", "MaxRadius: 2000\n")); } @Test public void allowsStaleWritesAndKeepsNewFileAfterReloadFailure() throws Exception { Path dir = Files.createTempDirectory("betterrtp-editor-apply"); Path file = dir.resolve("config.yml"); @@ -65,22 +64,22 @@ public class EditorConfigTest { try { Files.write(file, snapshot); String edited = original.replace("1000", "2000"); - Path backup = EditorConfig.apply(file, snapshot, edited, () -> {}); + Path backup = SchemaConfig.apply(file, snapshot, edited, () -> {}); assertArrayEquals(snapshot, Files.readAllBytes(backup)); - assertTrue(EditorConfig.equivalent(edited, new String(Files.readAllBytes(file), StandardCharsets.UTF_8))); + assertTrue(SchemaConfig.equivalent(edited, new String(Files.readAllBytes(file), StandardCharsets.UTF_8))); // The original snapshot is now stale; applying it is intentionally allowed. - EditorConfig.apply(file, snapshot, original, () -> {}); + SchemaConfig.apply(file, snapshot, original, () -> {}); assertArrayEquals(snapshot, Files.readAllBytes(file)); byte[] current = Files.readAllBytes(file); final int[] reloads = { 0 }; try { - EditorConfig.apply(file, current, edited, () -> { reloads[0]++; throw new java.io.IOException("Simulated reload failure"); }); + SchemaConfig.apply(file, current, edited, () -> { reloads[0]++; throw new java.io.IOException("Simulated reload failure"); }); fail("Reload should fail"); } catch (java.io.IOException expected) { } assertEquals(1, reloads[0]); assertArrayEquals(edited.getBytes(StandardCharsets.UTF_8), Files.readAllBytes(file)); byte[] unchanged = Files.readAllBytes(file); - try { EditorConfig.apply(file, snapshot, "broken: [", () -> fail("Must not reload")); fail("Must reject invalid config"); } + try { SchemaConfig.apply(file, snapshot, "broken: [", () -> fail("Must not reload")); fail("Must reject invalid config"); } catch (Exception expected) { } assertArrayEquals(unchanged, Files.readAllBytes(file)); } finally { @@ -96,9 +95,9 @@ public class EditorConfigTest { for (Path file : (Iterable) files::iterator) { String value = new String(Files.readAllBytes(file), StandardCharsets.UTF_8); if (file.getFileName().toString().startsWith("invalid-")) { - try { EditorConfig.validate(baseline, value); fail("Expected rejection: " + file); } + try { SchemaConfig.validate(baseline, value); fail("Expected rejection: " + file); } catch (java.io.IOException expected) { } - } else EditorConfig.validate(baseline, value); + } else SchemaConfig.validate(baseline, value); } } } @@ -108,9 +107,9 @@ public class EditorConfigTest { try { Files.write(file, original.getBytes(StandardCharsets.UTF_8)); byte[] replacement = original.replace("1000", "2000").getBytes(StandardCharsets.UTF_8); - EditorConfig.replace(file, replacement); assertArrayEquals(replacement, EditorConfig.read(file)); - Files.write(file, new byte[EditorConfig.MAX_BYTES + 1]); - try { EditorConfig.read(file); fail("Oversized read"); } catch (java.io.IOException expected) { } + SchemaConfig.replace(file, replacement); assertArrayEquals(replacement, SchemaConfig.read(file)); + Files.write(file, new byte[SchemaConfig.MAX_BYTES + 1]); + try { SchemaConfig.read(file); fail("Oversized read"); } catch (java.io.IOException expected) { } } finally { Files.deleteIfExists(file); Files.deleteIfExists(dir); } } } diff --git a/tests/editor/src/test/java/SchemaConfig.java b/tests/editor/src/test/java/SchemaConfig.java new file mode 100644 index 0000000..851bd4b --- /dev/null +++ b/tests/editor/src/test/java/SchemaConfig.java @@ -0,0 +1,19 @@ +import com.ronanplugins.bettersync.editor.EditorSchema; +import com.ronanplugins.bettersync.editor.EditorFiles; +import java.nio.file.*; +import java.nio.charset.StandardCharsets; + +/** Tests the actual plugin-owned resource, not BetterSync's legacy profile. */ +final class SchemaConfig { + static final int MAX_BYTES = EditorFiles.MAX_BYTES; + private static EditorSchema schema(String text) throws Exception { + return new EditorSchema(new String(Files.readAllBytes(Paths.get(text.contains("Flashback:") ? "../../BetterRTPAddons/src/main/resources/META-INF/editor-schema.json" : "../../BetterRTP-Core/src/main/resources/META-INF/editor-schema.json")), StandardCharsets.UTF_8)); + } + static void validate(String before, String after) throws Exception { schema(before).validate(before, after); } + static boolean equivalent(String before, String after) throws Exception { return schema(before).equivalent(before, after); } + static Path apply(Path file, byte[] before, String after, EditorFiles.Reload reload) throws Exception { + return EditorFiles.apply(schema(new String(before, StandardCharsets.UTF_8)), file, before, after, reload); + } + static byte[] read(Path file) throws Exception { return EditorFiles.read(file); } + static void replace(Path file, byte[] bytes) throws Exception { EditorFiles.replace(file, bytes); } +}