From 9f0801fda44d1a9420e3cac42d916d19d0276225 Mon Sep 17 00:00:00 2001 From: Ronan Date: Tue, 3 Nov 2026 22:07:33 +0100 Subject: [PATCH] editor command help --- docs/web-editor.md | 16 ++++++++++++++++ pom.xml | 11 ++++++++++- .../player/commands/types/CmdEditor.java | 8 +++++++- .../references/messages/MessagesHelp.java | 1 + .../references/web/editor/EditorBridge.java | 18 +++++++++++++++++- .../META-INF/betterrtp-editor.properties | 2 ++ src/main/resources/lang/en.yml | 1 + 7 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/META-INF/betterrtp-editor.properties diff --git a/docs/web-editor.md b/docs/web-editor.md index ad28bbf..bdcd957 100644 --- a/docs/web-editor.md +++ b/docs/web-editor.md @@ -27,3 +27,19 @@ The website is trusted with the submitted config; this protocol is not end-to-en ## Validation Run `mvn -f tests/editor/pom.xml test` for the isolated config validator/file-write suite. It uses the actual Spigot YAML implementation without requiring all of the plugin's protection integrations. Run `mvn package` for the full plugin. Before production use, test the complete flow on a staging Minecraft server, including permissions, disconnect, reload failure and Folia scheduling if applicable. + +## Production and staging builds + +The normal `mvn clean package` build embeds `https://minecentral.net` and produces +`target/BetterRTP-3.6.13.jar`. Use `mvn clean package -Pstaging` to embed +`https://n2nm1thopoojau1ggnalixvr.minecentral.net` and produce +`target/BetterRTP-3.6.13-staging.jar` for the test Minecraft server. + +The address is filtered into internal JAR metadata at build time. It is not read +from `editor.yml`, a server-side file, or an environment variable. Upload only one +BetterRTP JAR to a server's plugins directory. The staging website should use its +own origin as `APP_ORIGIN` and have the editor enabled and migrations applied. + +This profile changes only the destination website. The implementation described +above still uses the original polling protocol; the agreed `editorsync` command, +24-hour sessions, and independent 15-minute save tokens remain implementation work. diff --git a/pom.xml b/pom.xml index 9e58583..eb423ce 100644 --- a/pom.xml +++ b/pom.xml @@ -14,9 +14,18 @@ 8 UTF-8 + https://minecentral.net + + + staging + + https://n2nm1thopoojau1ggnalixvr.minecentral.net + -staging + + dev @@ -42,7 +51,7 @@ true - ${project.artifactId}-${project.version} + ${project.artifactId}-${project.version}${editor.buildSuffix} org.apache.maven.plugins diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdEditor.java b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdEditor.java index daf1a7b..088c1ee 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdEditor.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdEditor.java @@ -4,6 +4,8 @@ import me.SuperRonanCraft.BetterRTP.BetterRTP; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable; import me.SuperRonanCraft.BetterRTP.references.PermissionNode; +import me.SuperRonanCraft.BetterRTP.references.messages.MessagesHelp; + import org.bukkit.command.CommandSender; import java.util.Collections; import java.util.List; @@ -11,7 +13,6 @@ import java.util.List; public class CmdEditor implements RTPCommand, RTPCommandHelpable { public String getName() { return "editor"; } public PermissionNode permission() { return PermissionNode.EDITOR; } - public String getHelp() { return "&7Open a private web config editor: &f/rtp editor &7(or cancel)"; } public List tabComplete(CommandSender sender, String[] args) { return args.length == 2 && "cancel".startsWith(args[1].toLowerCase()) ? Collections.singletonList("cancel") : Collections.emptyList(); } @@ -20,4 +21,9 @@ public class CmdEditor implements RTPCommand, RTPCommandHelpable { else if (args.length == 2 && "cancel".equalsIgnoreCase(args[1])) BetterRTP.getInstance().getEditorBridge().cancel(sender); else sender.sendMessage("Usage: /" + label + " editor [cancel]"); } + + @Override + public String getHelp() { + return MessagesHelp.EDITOR.get(); + } } diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/references/messages/MessagesHelp.java b/src/main/java/me/SuperRonanCraft/BetterRTP/references/messages/MessagesHelp.java index a2a655d..e5c6a43 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/references/messages/MessagesHelp.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/references/messages/MessagesHelp.java @@ -8,6 +8,7 @@ public enum MessagesHelp implements MessageData { MAIN("Main"), BIOME("Biome"), EDIT("Edit"), + EDITOR("Editor"), HELP("Help"), INFO("Info"), PLAYER("Player"), diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/references/web/editor/EditorBridge.java b/src/main/java/me/SuperRonanCraft/BetterRTP/references/web/editor/EditorBridge.java index 10120e6..8f9105b 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/references/web/editor/EditorBridge.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/references/web/editor/EditorBridge.java @@ -20,7 +20,23 @@ import java.util.concurrent.*; /** One active session per server, all HTTP on a dedicated daemon worker. No inbound server port. */ public final class EditorBridge { - private static final String WEBSITE = "https://minecentral.net"; + private static final String WEBSITE = loadWebsite(); + + private static String loadWebsite() { + Properties metadata = new Properties(); + try (InputStream input = EditorBridge.class.getResourceAsStream("/META-INF/betterrtp-editor.properties")) { + if (input == null) throw new IllegalStateException("Missing editor build metadata"); + metadata.load(input); + } catch (IOException e) { + throw new IllegalStateException("Cannot read editor build metadata", e); + } + String website = metadata.getProperty("website"); + if (!"https://minecentral.net".equals(website) + && !"https://n2nm1thopoojau1ggnalixvr.minecentral.net".equals(website)) { + throw new IllegalStateException("Invalid editor website in build metadata"); + } + return website; + } private final JavaPlugin plugin; private final Consumer sync; private final Consumer reload; diff --git a/src/main/resources/META-INF/betterrtp-editor.properties b/src/main/resources/META-INF/betterrtp-editor.properties new file mode 100644 index 0000000..5d6185d --- /dev/null +++ b/src/main/resources/META-INF/betterrtp-editor.properties @@ -0,0 +1,2 @@ +# Build metadata embedded in the JAR; not a server configuration file. +website=${editor.website} diff --git a/src/main/resources/lang/en.yml b/src/main/resources/lang/en.yml index 965673d..ed43402 100644 --- a/src/main/resources/lang/en.yml +++ b/src/main/resources/lang/en.yml @@ -39,6 +39,7 @@ Help: Main: ' &7- &e/%command% &7- Randomly teleports you!' Biome: ' &7- &e/%command% biome &7- Randomly teleport withing these biomes' Edit: ' &7- &e/%command% edit [args...] &7- Edit some plugin settings' + Editor: ' &7- &e/%command% editor &7- Initialize an online config editor for easier configuration' Help: ' &7- &e/%command% help &7- Shows help list' Info: ' &7- &e/%command% info [world/particles/shapes/potion_effects] &7- View specific information about plugin parameters' Player: ' &7- &e/%command% player [world] [biome1, biome2...] &7- Randomly teleport another player'