editor command help

This commit is contained in:
Ronan committed 2026-11-03 22:07:33 +01:00
1 parent 66fe5b9001
commit 9f0801fda4
7 files changed
+54 -3

No files matched your search

@@ -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}
+1
View File
@@ -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'