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

+16
View File
@@ -5,6 +5,20 @@
BetterRTP-Addons is a paid resource, adding optional middleware to BetterRTP to help financially support the developement of BetterRTP.
But this can be compiled free of charge if you know how to compile maven resources!
## Web configuration editor
[Open the BetterRTP Addons editor](https://www.minecentral.net/editor/betterrtp-addons) to start with defaults or upload config.yml. Edit addon toggles, menus, command lists, and flashback warnings. Install the matching updated BetterRTP JAR too: Addons shares its editor bridge.
1. Run `/rtp addons editor` on your server and open the private link it returns.
2. Edit the form or YAML and choose **Save and get sync command**.
3. Run `/betterrtp addons editorsync <token>` in Minecraft to apply that saved version.
Console and players with `betterrtp.addon.editor` (default: op) can use both commands. No account or premium is required for editing, downloading, or command sync. Upload links last 24 hours; each sync command works once and expires after 15 minutes. Keep links and commands private.
Sync validates config.yml, saves a backup in `editor-backups`, then replaces the file and reloads the plugin. Nothing changes until the sync command runs. If reload fails after writing, the new file remains in place and Minecraft reports the error.
Shared behavior, deployment, and verification are documented in the [webapp repository](https://github.com/RonanPlugins/BetterRTP-Webapp/blob/main/docs/web-editor.md#addons-deployment).
## Where's the Lang files?/Want to Contribute translating?
All language files are located [here](src/main/resources/lang)
feel free to fork one of the language files and help translate!
@@ -28,3 +42,5 @@ The wiki is available [here](../../../wiki)!
<br/>
<b><i><a href="https://www.spigotmc.org/resources/authors/superronancraft.13025/">Check out my other plugins!</a></i></b>
</p>
Build both BetterRTP and Addons together by running `mvn clean package` from the parent BetterRTP directory. Both finished JARs are written to the parent directory’s `dist/` folder.
+82 -14
View File
@@ -10,10 +10,23 @@
<version>1.8.10</version>
<properties>
<editor.website>https://www.minecentral.net</editor.website>
<bettersync.version>2.0.0</bettersync.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
<profile>
<id>dev</id>
<build><plugins><plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration><outputDirectory>../../../Java/plugins</outputDirectory></configuration>
</plugin></plugins></build>
</profile>
</profiles>
<build>
<resources>
<resource>
@@ -23,6 +36,14 @@
</resources>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<outputDirectory>${project.basedir}/../dist</outputDirectory>
</configuration>
</plugin>
<plugin>
<!-- Shade PaperLib into project -->
<groupId>org.apache.maven.plugins</groupId>
@@ -31,6 +52,8 @@
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<relocations>
<relocation><pattern>com.ronanplugins.bettersync</pattern><shadedPattern>me.SuperRonanCraft.BetterRTPAddons.lib.bettersync</shadedPattern></relocation>
<relocation>
<pattern>io.papermc.lib</pattern>
<shadedPattern>me.SuperRonanCraft.BetterRTPAddons.paperlib</shadedPattern>
@@ -46,15 +69,6 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- Local Server Building -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>../../../Java/plugins</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -64,10 +78,49 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<!-- Remove only Shade's unbundled backup, after the final JAR is ready. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/../dist</directory>
<includes>
<include>${project.artifactId}-*.jar</include>
<include>original-${project.artifactId}-*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
<executions>
<execution>
<id>remove-unshaded-backup</id>
<phase>package</phase>
<goals><goal>clean</goal></goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets combine.self="override">
<fileset>
<directory>${project.basedir}/../dist</directory>
<includes><include>original-${project.build.finalName}.jar</include></includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>minecodes-repository-releases</id>
<url>https://repository.minecodes.pl/releases</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
@@ -75,15 +128,22 @@
<!-- PaperMC Repo -->
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<!-- ProtocolLib Repo -->
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
</repository>
<repository><id>jitpack.io</id><url>https://jitpack.io</url></repository>
</repositories>
<dependencies>
<!-- Download the tagged GitHub library through JitPack; bundled by Shade. -->
<dependency>
<groupId>com.github.RonanPlugins</groupId>
<artifactId>BetterSync</artifactId>
<version>${bettersync.version}</version>
</dependency>
<!--Spigot API-->
<dependency>
<groupId>org.spigotmc</groupId>
@@ -102,14 +162,14 @@
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.5</version>
<version>1.0.8</version>
<scope>compile</scope>
</dependency>
<!-- BetterRTP -->
<dependency>
<groupId>me.SuperRonanCraft</groupId>
<artifactId>BetterRTP</artifactId>
<version>LATEST</version>
<version>3.6.13</version>
<scope>provided</scope>
</dependency>
<!-- ProtocolLib -->
@@ -118,11 +178,19 @@
<artifactId>ProtocolLib</artifactId>
<version>4.5.0</version>
<scope>provided</scope>
<exclusions>
<!-- ProtocolLib supplies its executor implementation; Addons does not use it.
Its legacy transitive snapshot is no longer available to fresh builds. -->
<exclusion>
<groupId>com.comphenix.executors</groupId>
<artifactId>BukkitExecutors</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<version>1.18.38</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -132,4 +200,4 @@
<scope>compile</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -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