Archive eaglerxbackendrpc (plugin, 1.8.8, clean)

This commit is contained in:
2026-11-27 22:18:45 -06:00
parent b4485b1e38
commit a5de87e600
1280 changed files with 142208 additions and 0 deletions
@@ -0,0 +1,11 @@
plugins {
id "java-library"
}
dependencies {
api project(":eaglerweb")
compileOnly project(":api-velocity")
compileOnly(libs.velocity.api)
annotationProcessor(libs.velocity.api)
}
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.eaglerweb.velocity;
import java.io.IOException;
import com.velocitypowered.api.command.CommandManager;
import com.velocitypowered.api.command.CommandMeta;
import com.velocitypowered.api.command.SimpleCommand;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.lax1dude.eaglercraft.backend.eaglerweb.adapter.IEaglerWebPlatform;
class CommandEaglerWeb implements SimpleCommand {
private final PlatformPluginVelocity plugin;
CommandEaglerWeb(PlatformPluginVelocity plugin) {
this.plugin = plugin;
}
@Override
public boolean hasPermission(Invocation invocation) {
return invocation.source().hasPermission("eaglercraft.eaglerweb.refresh");
}
@Override
public void execute(Invocation invocation) {
String[] args = invocation.arguments();
if (args.length == 1 && "refresh".equalsIgnoreCase(args[0])) {
IEaglerWebPlatform.IHandleRefresh handler = plugin.handleRefresh;
if (handler == null) {
invocation.source().sendMessage(Component.text("Plugin is not enabled!", NamedTextColor.RED));
return;
}
invocation.source().sendMessage(Component.text("Indexing pages, please wait...", NamedTextColor.AQUA));
int cnt;
try {
cnt = handler.refresh();
} catch (IOException ex) {
plugin.logger().error("Failed to index pages!", ex);
invocation.source()
.sendMessage(Component.text("Failed to index pages! (Check Proxy Log)", NamedTextColor.RED));
invocation.source().sendMessage(Component.text(ex.toString(), NamedTextColor.RED));
return;
}
invocation.source().sendMessage(Component.text("Indexed " + cnt + " pages total!", NamedTextColor.AQUA));
} else {
invocation.source().sendMessage(Component.text("Usage: /eaglerweb refresh", NamedTextColor.RED));
}
}
public CommandMeta register() {
CommandManager mgr = plugin.proxy().getCommandManager();
CommandMeta meta = mgr.metaBuilder("eaglerweb").plugin(plugin).build();
mgr.register(meta, this);
return meta;
}
}
@@ -0,0 +1,118 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.eaglerweb.velocity;
import java.io.File;
import java.nio.file.Path;
import org.slf4j.Logger;
import com.google.inject.Inject;
import com.velocitypowered.api.command.CommandMeta;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
import com.velocitypowered.api.plugin.Dependency;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
import net.lax1dude.eaglercraft.backend.eaglerweb.adapter.IEaglerWebImpl;
import net.lax1dude.eaglercraft.backend.eaglerweb.adapter.IEaglerWebLogger;
import net.lax1dude.eaglercraft.backend.eaglerweb.adapter.IEaglerWebPlatform;
import net.lax1dude.eaglercraft.backend.eaglerweb.adapter.SLF4JLogger;
import net.lax1dude.eaglercraft.backend.eaglerweb.base.EaglerWeb;
import net.lax1dude.eaglercraft.backend.eaglerweb.base.EaglerWebVersion;
import net.lax1dude.eaglercraft.backend.server.api.velocity.EaglerXServerAPI;
@Plugin(
id = PlatformPluginVelocity.PLUGIN_ID,
name = PlatformPluginVelocity.PLUGIN_NAME,
authors = {
PlatformPluginVelocity.PLUGIN_AUTHOR
},
version = PlatformPluginVelocity.PLUGIN_VERSION,
description = "Official EaglerWeb plugin for EaglercraftXServer",
dependencies = {
@Dependency(id = EaglerXServerAPI.PLUGIN_ID, optional = false)
}
)
public class PlatformPluginVelocity implements IEaglerWebPlatform<Player> {
public static final String PLUGIN_ID = "eaglerweb";
public static final String PLUGIN_NAME = EaglerWebVersion.PLUGIN_BRAND;
public static final String PLUGIN_AUTHOR = EaglerWebVersion.PLUGIN_AUTHOR;
public static final String PLUGIN_VERSION = EaglerWebVersion.PLUGIN_VERSION;
private final ProxyServer proxy;
private final Logger logger;
private final File dataDir;
private final SLF4JLogger rewindLogger;
private final IEaglerWebImpl<Player> plugin;
private CommandMeta refreshCommandMeta;
IHandleRefresh handleRefresh;
@Inject
public PlatformPluginVelocity(ProxyServer proxyIn, Logger loggerIn, @DataDirectory Path dataDirIn) {
proxy = proxyIn;
logger = loggerIn;
dataDir = dataDirIn.toFile();
rewindLogger = new SLF4JLogger(loggerIn);
plugin = new EaglerWeb<>(this);
}
@Subscribe
public void onProxyInit(ProxyInitializeEvent e) {
refreshCommandMeta = (new CommandEaglerWeb(this)).register();
plugin.onEnable(EaglerXServerAPI.instance());
}
@Subscribe
public void onProxyShutdown(ProxyShutdownEvent e) {
if (refreshCommandMeta != null) {
proxy.getCommandManager().unregister(refreshCommandMeta);
refreshCommandMeta = null;
}
plugin.onDisable(EaglerXServerAPI.instance());
}
public ProxyServer proxy() {
return proxy;
}
@Override
public IEaglerWebLogger logger() {
return rewindLogger;
}
@Override
public String getVersionString() {
return PLUGIN_NAME + "/" + PLUGIN_VERSION;
}
@Override
public File getDataFolder() {
return dataDir;
}
@Override
public void setHandleRefresh(IHandleRefresh handleRefresh) {
this.handleRefresh = handleRefresh;
}
}