mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
misc: Applied suggestions review
This commit is contained in:
3 files changed
+20
-47
No files matched your search
@@ -7,6 +7,7 @@ plugins:
|
||||
net.kyori.blossom: 1.3.0
|
||||
org.spongepowered.gradle.plugin: 2.1.1
|
||||
xyz.jpenilla.run-paper: 2.0.1
|
||||
xyz.jpenilla.run-velocity: 2.0.1
|
||||
io.papermc.hangar-publish-plugin: 0.0.5
|
||||
|
||||
versions:
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
import java.util.*
|
||||
import java.util.Locale
|
||||
|
||||
plugins {
|
||||
id("carbon.shadow-platform")
|
||||
id("net.kyori.blossom")
|
||||
}
|
||||
|
||||
val velocityRun: Configuration by configurations.creating {
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class, Usage.JAVA_RUNTIME))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category::class, Category.LIBRARY))
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements::class, LibraryElements.JAR))
|
||||
}
|
||||
id("xyz.jpenilla.run-velocity")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -20,9 +13,6 @@ dependencies {
|
||||
annotationProcessor(libs.velocityApi)
|
||||
|
||||
implementation(libs.cloudVelocity)
|
||||
|
||||
velocityRun("com.velocitypowered", "velocity-proxy", libs.versions.velocityApi.get())
|
||||
|
||||
compileOnly(libs.miniplaceholders)
|
||||
}
|
||||
|
||||
@@ -37,32 +27,14 @@ tasks {
|
||||
exclude(dependency("javax.inject:javax.inject"))
|
||||
}
|
||||
}
|
||||
register<JavaExec>("runProxy") {
|
||||
group = "carbon"
|
||||
standardInput = System.`in`
|
||||
classpath(velocityRun.asFileTree)
|
||||
workingDir = layout.projectDirectory.dir("run").asFile
|
||||
|
||||
val pluginJar = shadowJar.flatMap { it.archiveFile }
|
||||
inputs.file(pluginJar)
|
||||
|
||||
doFirst {
|
||||
if (!workingDir.exists()) {
|
||||
workingDir.mkdirs()
|
||||
}
|
||||
val plugins = workingDir.resolve("plugins")
|
||||
if (!plugins.exists()) {
|
||||
plugins.mkdirs()
|
||||
}
|
||||
|
||||
pluginJar.get().asFile.copyTo(plugins.resolve("carbon.jar"), overwrite = true)
|
||||
}
|
||||
runVelocity {
|
||||
velocityVersion(libs.versions.velocityApi.get())
|
||||
}
|
||||
}
|
||||
|
||||
blossom {
|
||||
mapOf(
|
||||
"ID" to rootProject.name.toLowerCase(Locale.ROOT),
|
||||
"ID" to rootProject.name.lowercase(Locale.ROOT),
|
||||
"NAME" to rootProject.name,
|
||||
"VERSION" to version,
|
||||
"DESCRIPTION" to description,
|
||||
|
||||
@@ -43,28 +43,28 @@ import java.nio.file.Path;
|
||||
@Dependency(id = "miniplaceholders", optional = true)
|
||||
}
|
||||
)
|
||||
public class CarbonVelocityBootstrap {
|
||||
public final class CarbonVelocityBootstrap {
|
||||
|
||||
private final CarbonChatVelocity carbonVelocity;
|
||||
|
||||
@Inject
|
||||
private Injector injector;
|
||||
@Inject
|
||||
private ProxyServer proxyServer;
|
||||
@Inject
|
||||
private PluginContainer pluginContainer;
|
||||
@Inject
|
||||
@DataDirectory
|
||||
private Path dataDirectory;
|
||||
private CarbonChatVelocity carbonVelocity;
|
||||
public CarbonVelocityBootstrap(
|
||||
final Injector injector,
|
||||
final ProxyServer proxyServer,
|
||||
final PluginContainer pluginContainer,
|
||||
@DataDirectory final Path dataDirectory
|
||||
) {
|
||||
this.carbonVelocity = injector.createChildInjector(new CarbonChatVelocityModule(
|
||||
pluginContainer, proxyServer, dataDirectory)).getInstance(CarbonChatVelocity.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
void onProxyInitialize(final ProxyInitializeEvent event) {
|
||||
this.carbonVelocity = this.injector.createChildInjector(new CarbonChatVelocityModule(
|
||||
this.pluginContainer, this.proxyServer, this.dataDirectory)).getInstance(CarbonChatVelocity.class);
|
||||
public void onProxyInitialize(final ProxyInitializeEvent event) {
|
||||
this.carbonVelocity.onInitialization(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
void onProxyShutdown(final ProxyShutdownEvent event) {
|
||||
public void onProxyShutdown(final ProxyShutdownEvent event) {
|
||||
this.carbonVelocity.onShutdown();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user