mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +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
|
net.kyori.blossom: 1.3.0
|
||||||
org.spongepowered.gradle.plugin: 2.1.1
|
org.spongepowered.gradle.plugin: 2.1.1
|
||||||
xyz.jpenilla.run-paper: 2.0.1
|
xyz.jpenilla.run-paper: 2.0.1
|
||||||
|
xyz.jpenilla.run-velocity: 2.0.1
|
||||||
io.papermc.hangar-publish-plugin: 0.0.5
|
io.papermc.hangar-publish-plugin: 0.0.5
|
||||||
|
|
||||||
versions:
|
versions:
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
import java.util.*
|
import java.util.Locale
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("carbon.shadow-platform")
|
id("carbon.shadow-platform")
|
||||||
id("net.kyori.blossom")
|
id("net.kyori.blossom")
|
||||||
}
|
id("xyz.jpenilla.run-velocity")
|
||||||
|
|
||||||
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))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -20,9 +13,6 @@ dependencies {
|
|||||||
annotationProcessor(libs.velocityApi)
|
annotationProcessor(libs.velocityApi)
|
||||||
|
|
||||||
implementation(libs.cloudVelocity)
|
implementation(libs.cloudVelocity)
|
||||||
|
|
||||||
velocityRun("com.velocitypowered", "velocity-proxy", libs.versions.velocityApi.get())
|
|
||||||
|
|
||||||
compileOnly(libs.miniplaceholders)
|
compileOnly(libs.miniplaceholders)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,32 +27,14 @@ tasks {
|
|||||||
exclude(dependency("javax.inject:javax.inject"))
|
exclude(dependency("javax.inject:javax.inject"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
register<JavaExec>("runProxy") {
|
runVelocity {
|
||||||
group = "carbon"
|
velocityVersion(libs.versions.velocityApi.get())
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blossom {
|
blossom {
|
||||||
mapOf(
|
mapOf(
|
||||||
"ID" to rootProject.name.toLowerCase(Locale.ROOT),
|
"ID" to rootProject.name.lowercase(Locale.ROOT),
|
||||||
"NAME" to rootProject.name,
|
"NAME" to rootProject.name,
|
||||||
"VERSION" to version,
|
"VERSION" to version,
|
||||||
"DESCRIPTION" to description,
|
"DESCRIPTION" to description,
|
||||||
|
|||||||
@@ -43,28 +43,28 @@ import java.nio.file.Path;
|
|||||||
@Dependency(id = "miniplaceholders", optional = true)
|
@Dependency(id = "miniplaceholders", optional = true)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public class CarbonVelocityBootstrap {
|
public final class CarbonVelocityBootstrap {
|
||||||
|
|
||||||
|
private final CarbonChatVelocity carbonVelocity;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Injector injector;
|
public CarbonVelocityBootstrap(
|
||||||
@Inject
|
final Injector injector,
|
||||||
private ProxyServer proxyServer;
|
final ProxyServer proxyServer,
|
||||||
@Inject
|
final PluginContainer pluginContainer,
|
||||||
private PluginContainer pluginContainer;
|
@DataDirectory final Path dataDirectory
|
||||||
@Inject
|
) {
|
||||||
@DataDirectory
|
this.carbonVelocity = injector.createChildInjector(new CarbonChatVelocityModule(
|
||||||
private Path dataDirectory;
|
pluginContainer, proxyServer, dataDirectory)).getInstance(CarbonChatVelocity.class);
|
||||||
private CarbonChatVelocity carbonVelocity;
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
void onProxyInitialize(final ProxyInitializeEvent event) {
|
public void onProxyInitialize(final ProxyInitializeEvent event) {
|
||||||
this.carbonVelocity = this.injector.createChildInjector(new CarbonChatVelocityModule(
|
|
||||||
this.pluginContainer, this.proxyServer, this.dataDirectory)).getInstance(CarbonChatVelocity.class);
|
|
||||||
this.carbonVelocity.onInitialization(this);
|
this.carbonVelocity.onInitialization(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
void onProxyShutdown(final ProxyShutdownEvent event) {
|
public void onProxyShutdown(final ProxyShutdownEvent event) {
|
||||||
this.carbonVelocity.onShutdown();
|
this.carbonVelocity.onShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user