Online editor + auto deployment/releases (#264)

* web editor

* editor command help

* editor sync cmd

* removed same user restriction

* removed player executed restriction

* no server identifier sent to server

* editor url updated

* config harsher verification + send world names to editor api

* no more session controls

* addons editor commands

* moved rtp to /betterrtp-core to create a better env for maven compiling

* bettersync lib

* Own core and addon editor schemas with BetterSync validation

* Simplify editor metadata and publish core and addon schemas on release

* Release core and addons together using their Maven versions

* Exclude unavailable ProtocolLib executor snapshot from Addons build

* betterrtp compiling
This commit is contained in:
RonanCraft authored and GitHub committed 2026-11-12 14:17:03 -05:00
1 parent 4697f06163
commit c8c5a04a59
224 files changed
+2041 -388

No files matched your search

@@ -33,6 +33,14 @@ public class AddonsCommand implements RTPCommand, RTPCommandHelpable {
@Override
public void execute(CommandSender sendi, String label, String[] args) {
if (args.length >= 2 && (args[1].equalsIgnoreCase("editor") || args[1].equalsIgnoreCase("editorsync"))) {
Main plugin = Main.getInstance();
if (!plugin.canEdit(sendi)) { sendi.sendMessage("§cYou need betterrtp.addon.editor permission."); return; }
if (args[1].equalsIgnoreCase("editor") && args.length == 2) plugin.getEditorBridge().upload(sendi);
else if (args[1].equalsIgnoreCase("editorsync") && args.length == 3) plugin.getEditorBridge().redeem(sendi, args[2]);
else sendi.sendMessage("§eUsage: /" + label + " addons " + (args[1].equalsIgnoreCase("editor") ? "editor" : "editorsync <token>"));
return;
}
if (args.length == 2) {
for (AddonCmds cmds : AddonCmds.values()) {
if (cmds.name().equalsIgnoreCase(args[1])) {
@@ -44,6 +52,7 @@ public class AddonsCommand implements RTPCommand, RTPCommandHelpable {
} else {
List<String> list = new ArrayList<>();
list.add(MessagesHelp.PREFIX.get());
addEditorHelp(sendi, label, list);
for (AddonsHandler.Addons addon : Main.getInstance().getAddonsHandler().addons) {
RTPCommand cmd = addon.getCmd();
if (cmd instanceof RTPCommandHelpable)
@@ -57,6 +66,10 @@ public class AddonsCommand implements RTPCommand, RTPCommandHelpable {
@Override
public List<String> tabComplete(CommandSender sendi, String[] args) {
List<String> list = new ArrayList<>();
if (args.length == 2 && Main.getInstance().canEdit(sendi)) {
for (String command : new String[] { "editor", "editorsync" })
if (command.startsWith(args[1].toLowerCase(Locale.ROOT))) list.add(command);
}
if (args.length == 2)
for (AddonCmds cmds : AddonCmds.values()) {
if (cmds.name().toLowerCase().startsWith(args[1].toLowerCase()))
@@ -65,6 +78,13 @@ public class AddonsCommand implements RTPCommand, RTPCommandHelpable {
return list;
}
public static void addEditorHelp(CommandSender sender, String label, List<String> list) {
if (Main.getInstance().canEdit(sender)) {
list.add("§7- §e/" + label + " addons editor §7- Open the Addons web editor");
list.add("§7- §e/" + label + " addons editorsync <token> §7- Apply a saved Addons config");
}
}
@Override
public PermissionNode permission() {
return PermissionNode.USE;
@@ -30,7 +30,8 @@ public class AddonsHandler {
//addonCount++;
}
//Main.getInstance().getLogger().log(Level.INFO, addonCount + "/" + Addons.values().length + " addons were enabled!");
HelperRTP_Command.registerCommand(cmd, false);
if (!BetterRTP.getInstance().getCmd().commands.contains(cmd))
HelperRTP_Command.registerCommand(cmd, false);
}
public void unload() {
@@ -1,5 +1,8 @@
package me.SuperRonanCraft.BetterRTPAddons;
import com.ronanplugins.bettersync.editor.EditorClient;
import com.ronanplugins.bettersync.editor.EditorSchema;
import lombok.Getter;
import me.SuperRonanCraft.BetterRTPAddons.util.Files;
import me.SuperRonanCraft.BetterRTPAddons.util.ReloadListener;
@@ -17,15 +20,28 @@ public class Main extends JavaPlugin {
public final AddonMessages msgs = new AddonMessages();
private final ReloadListener reloadListener = new ReloadListener();
@Getter
private EditorClient editorBridge;
public boolean canEdit(org.bukkit.command.CommandSender sender) {
return !(sender instanceof org.bukkit.entity.Player) || sender.hasPermission("betterrtp.addon.editor");
}
@Override
public void onEnable() {
instance = this;
Bukkit.getPluginManager().registerEvents(reloadListener, this);
load();
editorBridge = new EditorClient(
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());
}
@Override
public void onDisable() {
if (editorBridge != null) editorBridge.close();
addonsHandler.unload();
}
@@ -21,6 +21,7 @@ public class AddonsCommand_Help implements AddonsCommands, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) {
List<String> list = new ArrayList<>();
list.add(MessagesHelp.PREFIX.get());
AddonsCommand.addEditorHelp(sendi, label, list);
for (AddonsCommand.AddonCmds cmds : AddonsCommand.AddonCmds.values()) {
if (cmds.cmd instanceof RTPCommandHelpable)
list.add(((RTPCommandHelpable) cmds.cmd).getHelp().replace("%command%", label));
@@ -0,0 +1 @@
website=${editor.website}
@@ -0,0 +1,245 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://schemas.ronanplugins.com/betterrtp-addons/2",
"title": "BetterRTP Addons editor configuration",
"type": "object",
"properties": {
"Flashback": {
"type": "object",
"properties": {
"Timer": {
"type": "object",
"properties": {
"Delay": {
"type": "number"
},
"Warnings": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"x-editor": {
"collection": "warnings"
}
}
}
},
"Enabled": {
"type": "boolean"
}
}
},
"Logger": {
"type": "object",
"properties": {
"Format": {
"type": "string"
},
"Enabled": {
"type": "boolean"
},
"LogToConsole": {
"type": "boolean"
}
}
},
"Portals": {
"type": "object",
"properties": {
"Enabled": {
"type": "boolean"
},
"IgnoreDelay": {
"type": "boolean"
},
"IgnoreCooldown": {
"type": "boolean"
}
}
},
"ExtraEffects": {
"type": "object",
"properties": {
"Enabled": {
"type": "boolean"
},
"YOffset": {
"type": "object",
"properties": {
"Enabled": {
"type": "boolean"
},
"Offset": {
"type": "number"
}
}
}
}
},
"MagicStick": {
"type": "object",
"properties": {
"GiveFirstJoin": {
"type": "object",
"properties": {
"Amount": {
"type": "integer"
},
"Enabled": {
"type": "boolean"
}
}
},
"Item": {
"type": "object",
"properties": {
"Material": {
"type": "string"
},
"Name": {
"type": "string"
},
"Lore": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Enabled": {
"type": "boolean"
},
"Take": {
"type": "boolean"
}
}
},
"Commands": {
"type": "object",
"properties": {
"Enabled": {
"type": "boolean"
},
"Events": {
"type": "object",
"properties": {
"Teleport": {
"type": "object",
"properties": {
"Enabled": {
"type": "boolean"
},
"Commands": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Cancelled": {
"type": "object",
"properties": {
"Enabled": {
"type": "boolean"
},
"Commands": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
},
"Parties": {
"type": "object",
"properties": {
"Enabled": {
"type": "boolean"
}
}
},
"RTPMenu": {
"type": "object",
"properties": {
"Lines": {
"type": "integer"
},
"AutoRefresh": {
"type": "number"
},
"WorldList": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"Name": {
"type": "string",
"default": ""
},
"Item": {
"type": "string",
"default": "MAP"
},
"Slot": {
"type": "integer",
"default": 0
},
"Lore": {
"type": "array",
"items": {
"type": "string"
},
"default": []
}
},
"x-editableProperties": true
}
},
"x-editor": {
"collection": "menu"
}
},
"Enabled": {
"type": "boolean"
},
"Title": {
"type": "string"
},
"AutoCenter": {
"type": "boolean"
}
}
},
"Language-File": {
"type": "string",
"description": "Change the language file locally."
}
},
"x-bettersync": {
"format": 1,
"plugin": "betterrtp-addons",
"schemaVersion": "2",
"displayName": "BetterRTP Addons"
},
"required": [
"Flashback",
"Logger",
"Portals",
"ExtraEffects",
"MagicStick",
"Commands",
"Parties",
"RTPMenu"
]
}
@@ -7,6 +7,9 @@ depend: [BetterRTP]
softdepend: [ProtocolLib]
permissions:
betterrtp.addon.editor:
description: Open and sync the BetterRTP Addons web editor
default: op
betterrtp.addon.portals:
description: Ability to use the portals addon commands