mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-11-28 00:34:36 +00:00
editor command help
This commit is contained in:
1 parent
66fe5b9001
commit
9f0801fda4
7 files changed
+54
-3
No files matched your search
@@ -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.
|
||||
@@ -14,9 +14,18 @@
|
||||
<properties>
|
||||
<maven.compiler.release>8</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<editor.website>https://minecentral.net</editor.website>
|
||||
<editor.buildSuffix></editor.buildSuffix>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>staging</id>
|
||||
<properties>
|
||||
<editor.website>https://n2nm1thopoojau1ggnalixvr.minecentral.net</editor.website>
|
||||
<editor.buildSuffix>-staging</editor.buildSuffix>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<build>
|
||||
@@ -42,7 +51,7 @@
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<finalName>${project.artifactId}-${project.version}${editor.buildSuffix}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
@@ -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<String> 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();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ public enum MessagesHelp implements MessageData {
|
||||
MAIN("Main"),
|
||||
BIOME("Biome"),
|
||||
EDIT("Edit"),
|
||||
EDITOR("Editor"),
|
||||
HELP("Help"),
|
||||
INFO("Info"),
|
||||
PLAYER("Player"),
|
||||
|
||||
@@ -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<Runnable> sync;
|
||||
private final Consumer<CommandSender> reload;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# Build metadata embedded in the JAR; not a server configuration file.
|
||||
website=${editor.website}
|
||||
@@ -39,6 +39,7 @@ Help:
|
||||
Main: ' &7- &e/%command% &7- Randomly teleports you!'
|
||||
Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes'
|
||||
Edit: ' &7- &e/%command% edit <default/world> [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 <player> [world] [biome1, biome2...] &7- Randomly teleport another player'
|
||||
|
||||
Reference in new issue
Block a user