Split up backend-rpc-core gradle project into more subprojects

This commit is contained in:
lax1dude 2025-05-10 21:24:10 -07:00
parent 61c93c4e42
commit d90704742a
35 changed files with 124 additions and 8 deletions

View File

@ -25,6 +25,9 @@ import net.lax1dude.eaglercraft.backend.rpc.api.internal.factory.EaglerXBackendR
public class EaglerXBackendRPC {
@Nonnull
public static final String PLUGIN_NAME = "EaglercraftXBackendRPC";
@Nonnull
public static IEaglerXBackendRPC<Player> instance() {
return EaglerXBackendRPCFactory.INSTANCE.getAPI(Player.class);

View File

@ -0,0 +1,11 @@
plugins {
id "java-library"
}
dependencies {
api project(":backend-rpc-api")
compileOnly project(":api")
compileOnly(libs.guava)
compileOnly(libs.jsr305)
}

View File

@ -0,0 +1,36 @@
/*
* 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.rpc.base;
import net.lax1dude.eaglercraft.backend.rpc.adapter.IBackendRPCImpl;
/**
* Class to invoke the EaglerXBackendRPC constructor without a static dependency
*/
public class EaglerXBackendRPCFactory {
@SuppressWarnings("unchecked")
public static <PlayerObject> IBackendRPCImpl<PlayerObject> create() {
try {
Class<?> clz = Class.forName("net.lax1dude.eaglercraft.backend.rpc.base.EaglerXBackendRPCBase");
return (IBackendRPCImpl<PlayerObject>) clz.getMethod("init").invoke(null);
} catch (ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
}

View File

@ -0,0 +1,25 @@
/*
* 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.rpc.base;
public class EaglerXBackendRPCVersion {
public static final String BRAND = "EaglercraftXBackendRPC";
public static final String AUTHOR = "lax1dude";
public static final String VERSION = "1.0.0";
}

View File

@ -0,0 +1,14 @@
plugins {
id "java-library"
}
dependencies {
implementation project(":backend-rpc-api-bukkit")
implementation project(":backend-rpc-core:backend-rpc-core-common")
compileOnly project(":api-bukkit")
compileOnly(libs.paper.api)
compileOnly(libs.bungeecord.chat)
compileOnly(libs.pluginannotations)
annotationProcessor(libs.pluginannotations)
}

View File

@ -32,6 +32,10 @@ import org.bukkit.scheduler.BukkitTask;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.MapMaker;
import eu.hexagonmc.spigot.annotation.meta.DependencyType;
import eu.hexagonmc.spigot.annotation.plugin.Dependency;
import eu.hexagonmc.spigot.annotation.plugin.Plugin;
import eu.hexagonmc.spigot.annotation.plugin.Plugin.Spigot;
import net.lax1dude.eaglercraft.backend.rpc.adapter.EnumAdapterPlatformType;
import net.lax1dude.eaglercraft.backend.rpc.adapter.IBackendRPCMessageChannel;
import net.lax1dude.eaglercraft.backend.rpc.adapter.IBackendRPCMessageHandler;
@ -45,15 +49,37 @@ import net.lax1dude.eaglercraft.backend.rpc.adapter.IPlatformPlayerInitializer;
import net.lax1dude.eaglercraft.backend.rpc.adapter.IPlatformScheduler;
import net.lax1dude.eaglercraft.backend.rpc.adapter.JavaLogger;
import net.lax1dude.eaglercraft.backend.rpc.adapter.event.IEventDispatchAdapter;
import net.lax1dude.eaglercraft.backend.rpc.base.EaglerXBackendRPCBase;
import net.lax1dude.eaglercraft.backend.rpc.api.bukkit.EaglerXBackendRPC;
import net.lax1dude.eaglercraft.backend.rpc.base.EaglerXBackendRPCFactory;
import net.lax1dude.eaglercraft.backend.rpc.base.EaglerXBackendRPCVersion;
import net.lax1dude.eaglercraft.backend.rpc.bukkit.event.BukkitEventDispatchAdapter;
import net.lax1dude.eaglercraft.backend.server.api.bukkit.EaglerXServerAPI;
import net.lax1dude.eaglercraft.backend.server.api.event.IEaglercraftInitializePlayerEvent;
import net.lax1dude.eaglercraft.backend.server.api.event.IEaglercraftVoiceChangeEvent;
import net.lax1dude.eaglercraft.backend.server.api.event.IEaglercraftWebViewChannelEvent;
import net.lax1dude.eaglercraft.backend.server.api.event.IEaglercraftWebViewMessageEvent;
@Plugin(
name = PlatformPluginBukkit.PLUGIN_NAME,
version = PlatformPluginBukkit.PLUGIN_VERSION,
description = "Official backend RPC plugin for EaglercraftXServer",
spigot = @Spigot(
authors = {
PlatformPluginBukkit.PLUGIN_AUTHOR
},
website = "https://lax1dude.net/eaglerxserver",
prefix = "EaglerXBackendRPC"
),
dependencies = {
@Dependency(name = EaglerXServerAPI.PLUGIN_NAME, type = DependencyType.SOFTDEPEND)
}
)
public class PlatformPluginBukkit extends JavaPlugin implements IPlatform<Player> {
public static final String PLUGIN_NAME = EaglerXBackendRPC.PLUGIN_NAME;
public static final String PLUGIN_AUTHOR = EaglerXBackendRPCVersion.AUTHOR;
public static final String PLUGIN_VERSION = EaglerXBackendRPCVersion.VERSION;
private IPlatformLogger loggerImpl;
private IEventDispatchAdapter<Player> eventDispatcher;
protected Runnable onServerEnable;
@ -145,7 +171,7 @@ public class PlatformPluginBukkit extends JavaPlugin implements IPlatform<Player
};
}
};
EaglerXBackendRPCBase.<Player>init().load(init);
EaglerXBackendRPCFactory.<Player>create().load(init);
}
@Override

View File

@ -4,10 +4,12 @@ plugins {
}
dependencies {
compileOnly project(":api-bukkit")
implementation project(":voice-rpc-protocol")
implementation project(":backend-rpc-api-bukkit")
implementation project(":backend-rpc-protocol")
implementation project(":backend-rpc-core:backend-rpc-core-common")
implementation project(":backend-rpc-core:backend-rpc-core-platform-bukkit")
compileOnly project(":api")
compileOnly(libs.paper.api)
compileOnly(libs.bungeecord.chat)
compileOnly(libs.bundles.netty.all)
@ -19,6 +21,8 @@ jar {
dependsOn ":backend-rpc-api:jar" // Workaround
dependsOn ":backend-rpc-api-bukkit:jar" // Workaround
dependsOn ":backend-rpc-protocol:jar" // Workaround
dependsOn ":backend-rpc-core:backend-rpc-core-common:jar" // Workaround
dependsOn ":backend-rpc-core:backend-rpc-core-platform-bukkit:jar" // Workaround
archiveFileName = "EaglerXBackendRPC.jar"

View File

@ -1,5 +0,0 @@
name: EaglercraftXBackendRPC
version: 1.0.0
main: net.lax1dude.eaglercraft.backend.rpc.bukkit.PlatformPluginBukkit
description: Official backend RPC plugin for EaglercraftXServer
author: lax1dude

View File

@ -26,6 +26,8 @@ include "voice-rpc-protocol"
include "backend-rpc-api"
include "backend-rpc-api-bukkit"
include "backend-rpc-core"
include "backend-rpc-core:backend-rpc-core-common"
include "backend-rpc-core:backend-rpc-core-platform-bukkit"
include "backend-rpc-protocol"
include "plan"
include "supervisor-core"