mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
dependency catalog & relocations
This commit is contained in:
1 parent
407de5479e
commit
6637830e86
9 files changed
+298
-209
No files matched your search
+26
-18
@@ -1,31 +1,39 @@
|
|||||||
import net.draycia.carbon.*
|
|
||||||
|
|
||||||
description="CarbonChat-API"
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("org.checkerframework:checker-qual:${CHECKER_QUAL_VER}")
|
compileOnlyApi(libs.checkerQual)
|
||||||
|
|
||||||
api("net.kyori:adventure-api:$ADVENTURE_VER")
|
api(platform(libs.adventureBom))
|
||||||
api("net.kyori:adventure-nbt:$ADVENTURE_VER")
|
compileOnlyApi(libs.adventureApi)
|
||||||
api("net.kyori:adventure-text-serializer-plain:$ADVENTURE_VER")
|
compileOnlyApi(libs.adventureTextSerializerPlain)
|
||||||
api("net.kyori:adventure-text-serializer-gson:$ADVENTURE_VER") {
|
compileOnlyApi(libs.adventureTextSerializerGson) {
|
||||||
//excludeGroup("com.google.code.gson")
|
exclude("com.google.code.gson")
|
||||||
|
}
|
||||||
|
api(libs.minimessage) {
|
||||||
|
isTransitive = false
|
||||||
}
|
}
|
||||||
api("net.kyori:adventure-text-minimessage:$MINIMESSAGE_VER")
|
|
||||||
|
|
||||||
api("net.kyori:event-api:$KYORI_EVENT_API_VER")
|
api(libs.kyoriEventApi)
|
||||||
api("net.kyori:registry:$KYORI_REGISTRY_VER")
|
api(libs.kyoriRegistry)
|
||||||
|
|
||||||
api("cloud.commandframework:cloud-core:$CLOUD_VER")
|
api(libs.cloudCore)
|
||||||
|
api(libs.cloudMinecraftExtras) {
|
||||||
|
isTransitive = false
|
||||||
|
}
|
||||||
|
|
||||||
api("org.spongepowered:configurate-core:$CONFIGURATE_VER")
|
api(libs.configurateCore)
|
||||||
|
api(libs.adventureSerializerConfigurate4) {
|
||||||
|
isTransitive = false
|
||||||
|
}
|
||||||
|
api(libs.configurateHocon)
|
||||||
|
api(libs.typesafeConfig)
|
||||||
|
|
||||||
api("com.google.guava:guava:$GUAVA_VER")
|
api(libs.moonshine)
|
||||||
|
|
||||||
compileOnlyApi("com.proximyst.moonshine:core:$MOONSHINE_VER")
|
// we shade and relocate a newer version than minecraft provides
|
||||||
|
api(libs.guava)
|
||||||
|
|
||||||
// Provided by Minecraft
|
// Provided by Minecraft
|
||||||
compileOnlyApi("org.apache.logging.log4j:log4j-api:2.11.2")
|
compileOnlyApi(libs.gson)
|
||||||
|
compileOnlyApi(libs.log4jApi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+15
-14
@@ -1,18 +1,17 @@
|
|||||||
import net.draycia.carbon.STYLECHECK_VER
|
|
||||||
import org.checkerframework.gradle.plugin.CheckerFrameworkPlugin
|
|
||||||
import org.checkerframework.gradle.plugin.CheckerFrameworkExtension
|
|
||||||
import net.kyori.indra.IndraExtension
|
|
||||||
import net.kyori.indra.IndraCheckstylePlugin
|
import net.kyori.indra.IndraCheckstylePlugin
|
||||||
import net.kyori.indra.IndraPlugin
|
import net.kyori.indra.IndraPlugin
|
||||||
import net.kyori.indra.IndraPublishingPlugin
|
import net.kyori.indra.IndraPublishingPlugin
|
||||||
|
import net.kyori.indra.repository.sonatypeSnapshots
|
||||||
|
import org.checkerframework.gradle.plugin.CheckerFrameworkExtension
|
||||||
|
import org.checkerframework.gradle.plugin.CheckerFrameworkPlugin
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
val indraVersion = "2.0.2"
|
id("net.kyori.indra")
|
||||||
id("net.kyori.indra") version indraVersion apply false
|
id("net.kyori.indra.git")
|
||||||
id("net.kyori.indra.checkstyle") version indraVersion apply false
|
id("net.kyori.indra.checkstyle")
|
||||||
id("net.kyori.indra.publishing") version indraVersion apply false
|
id("net.kyori.indra.publishing")
|
||||||
id("com.github.johnrengelman.shadow") version "7.0.0" apply false
|
id("com.github.johnrengelman.shadow") apply false
|
||||||
id("org.checkerframework") version "0.5.20" apply false
|
id("org.checkerframework") apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
ext["github"] = "https://github.com/Hexaoxide/Carbon"
|
ext["github"] = "https://github.com/Hexaoxide/Carbon"
|
||||||
@@ -31,9 +30,9 @@ subprojects {
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://nexus.proximyst.com/repository/maven-public/")
|
|
||||||
maven("https://repo.maven.apache.org/maven2")
|
|
||||||
maven("https://oss.sonatype.org/content/groups/public/")
|
maven("https://oss.sonatype.org/content/groups/public/")
|
||||||
|
sonatypeSnapshots()
|
||||||
|
maven("https://nexus.proximyst.com/repository/maven-public/")
|
||||||
//maven("https://repo.incendo.org/content/repositories/snapshots") // normal cloud snapshot repo
|
//maven("https://repo.incendo.org/content/repositories/snapshots") // normal cloud snapshot repo
|
||||||
maven("https://repo.jpenilla.xyz/snapshots/") { // temp cloud snapshot repo for sponge-8
|
maven("https://repo.jpenilla.xyz/snapshots/") { // temp cloud snapshot repo for sponge-8
|
||||||
content {
|
content {
|
||||||
@@ -51,7 +50,7 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
"checkstyle"("ca.stellardrift:stylecheck:$STYLECHECK_VER")
|
checkstyle(rootProject.libs.stylecheck)
|
||||||
}
|
}
|
||||||
|
|
||||||
configure<JavaPluginConvention> {
|
configure<JavaPluginConvention> {
|
||||||
@@ -64,12 +63,14 @@ subprojects {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
configure<IndraExtension> {
|
indra {
|
||||||
gpl3OnlyLicense()
|
gpl3OnlyLicense()
|
||||||
|
|
||||||
javaVersions {
|
javaVersions {
|
||||||
target(11)
|
target(11)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
github("Hexaoxide", "Carbon")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,10 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// sadly can't use the version catalog here (?), need to keep in sync manually
|
||||||
|
implementation("gradle.plugin.com.github.jengelman.gradle.plugins", "shadow", "7.0.0")
|
||||||
}
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
package net.draycia.carbon
|
|
||||||
|
|
||||||
// Misc
|
|
||||||
const val CHECKSTYLE_VER = "8.34"
|
|
||||||
const val CHECKER_QUAL_VER = "3.13.0"
|
|
||||||
const val GUAVA_VER = "26.0-jre"
|
|
||||||
const val STYLECHECK_VER = "0.1-SNAPSHOT"
|
|
||||||
const val MOONSHINE_VER = "0.2.4-SNAPSHOT"
|
|
||||||
const val CLOUD_VER = "1.5.0-SNAPSHOT"
|
|
||||||
const val CONFIGURATE_VER = "4.1.1-SNAPSHOT"
|
|
||||||
|
|
||||||
// Kyori
|
|
||||||
const val ADVENTURE_VER = "4.7.0"
|
|
||||||
const val ADVENTURE_PLATFORM_VER = "4.0.0-SNAPSHOT"
|
|
||||||
const val MINIMESSAGE_VER = "4.1.0-SNAPSHOT"
|
|
||||||
const val KYORI_EVENT_API_VER = "3.0.0"
|
|
||||||
const val KYORI_REGISTRY_VER = "1.0.0-SNAPSHOT"
|
|
||||||
const val BSTATS_VER = "2.2.1"
|
|
||||||
|
|
||||||
// Common
|
|
||||||
const val LETTUCE_CORE_VER = "6.0.0.M1"
|
|
||||||
const val IDB_CORE_VER = "1.0.0-SNAPSHOT"
|
|
||||||
const val HIKARI_VER = "2.4.1"
|
|
||||||
const val GSON_VER = "2.8.0"
|
|
||||||
|
|
||||||
// Bukkit
|
|
||||||
const val PAPER_API_VER = "1.16.5-R0.1-SNAPSHOT"
|
|
||||||
const val SNAKEYAML_VER = "1.27"
|
|
||||||
|
|
||||||
// Plugins
|
|
||||||
const val LUCKPERMS_API_VER = "5.1"
|
|
||||||
const val PLACEHOLDER_API_VER = "2.10.9"
|
|
||||||
const val VAULT_VER = "1.7"
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relocate a package into the `net.draycia.carbon.libs` namespace.
|
||||||
|
*/
|
||||||
|
fun ShadowJar.relocateDependency(pkg: String) {
|
||||||
|
relocate(pkg, "net.draycia.carbon.libs.$pkg")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relocates dependencies which we bundle and relocate on all platforms.
|
||||||
|
*/
|
||||||
|
fun ShadowJar.standardRelocations() {
|
||||||
|
relocateDependency("org.bstats")
|
||||||
|
relocateDependency("net.kyori.adventure.text.minimessage")
|
||||||
|
relocateDependency("net.kyori.adventure.serializer.configurate4")
|
||||||
|
relocateDependency("net.kyori.event")
|
||||||
|
relocateDependency("net.kyori.registry")
|
||||||
|
relocateDependency("cloud.commandframework")
|
||||||
|
relocateDependency("org.spongepowered.configurate")
|
||||||
|
relocateDependency("com.typesafe.config")
|
||||||
|
relocateDependency("com.google.common")
|
||||||
|
relocateDependency("com.google.thirdparty.publicsuffix")
|
||||||
|
relocateDependency("com.proximyst.moonshine")
|
||||||
|
relocateDependency("it.unimi.dsi.fastutil")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ShadowJar.configureShadow() {
|
||||||
|
minimize()
|
||||||
|
|
||||||
|
standardRelocations()
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
val archive = archiveFile.get().asFile
|
||||||
|
val libs = project.rootProject.buildDir.resolve("libs")
|
||||||
|
libs.mkdirs()
|
||||||
|
archive.copyTo(libs.resolve(archive.name), overwrite = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// not needed at runtime
|
||||||
|
exclude(dependency("com.google.code.findbugs:jsr305"))
|
||||||
|
exclude(dependency("org.checkerframework:checker-qual"))
|
||||||
|
exclude(dependency("com.google.errorprone:error_prone_annotations"))
|
||||||
|
exclude(dependency("com.google.j2objc:j2objc-annotations"))
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
-86
@@ -1,31 +1,38 @@
|
|||||||
import net.draycia.carbon.*
|
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription.Permission.Default.TRUE
|
||||||
import java.nio.charset.StandardCharsets
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.johnrengelman.shadow")
|
id("com.github.johnrengelman.shadow")
|
||||||
id("net.minecrell.plugin-yml.bukkit") version "0.4.0"
|
id("net.minecrell.plugin-yml.bukkit")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.carbonchatApi)
|
implementation(projects.carbonchatApi)
|
||||||
|
|
||||||
// Server
|
// Server
|
||||||
compileOnly("com.destroystokyo.paper:paper-api:$PAPER_API_VER")
|
compileOnly(libs.paperApi)
|
||||||
implementation("io.papermc", "paperlib", "1.0.6")
|
implementation(libs.paperLib)
|
||||||
|
|
||||||
// Config
|
|
||||||
implementation("org.spongepowered:configurate-yaml:$CONFIGURATE_VER")
|
|
||||||
implementation("org.yaml:snakeyaml:$SNAKEYAML_VER")
|
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
implementation("cloud.commandframework:cloud-paper:$CLOUD_VER")
|
implementation(libs.cloudPaper)
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
implementation("org.bstats:bstats-bukkit:$BSTATS_VER")
|
implementation(libs.bstatsBukkit)
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
compileOnly("me.clip:placeholderapi:$PLACEHOLDER_API_VER")
|
compileOnly("me.clip:placeholderapi:2.10.9")
|
||||||
compileOnly("com.github.MilkBowl:VaultAPI:$VAULT_VER")
|
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
build {
|
||||||
|
dependsOn(shadowJar)
|
||||||
|
}
|
||||||
|
shadowJar {
|
||||||
|
archiveFileName.set(project.name + "-" + project.version + ".jar")
|
||||||
|
configureShadow()
|
||||||
|
relocateDependency("io.papermc.lib")
|
||||||
|
relocateDependency("io.leangen.geantyref")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generates plugin.yml automatically
|
// Generates plugin.yml automatically
|
||||||
@@ -40,81 +47,10 @@ bukkit {
|
|||||||
website = rootProject.ext["github"] as String
|
website = rootProject.ext["github"] as String
|
||||||
permissions {
|
permissions {
|
||||||
create("carbonchat.channels.global.see") {
|
create("carbonchat.channels.global.see") {
|
||||||
//default = "TRUE"
|
default = TRUE
|
||||||
}
|
}
|
||||||
|
|
||||||
create("carbonchat.channels.global.use") {
|
create("carbonchat.channels.global.use") {
|
||||||
//default = "TRUE"
|
default = TRUE
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
checkstyle {
|
|
||||||
def configRoot = new File(rootProject.projectDir, '.checkstyle')
|
|
||||||
toolVersion = vers['checkstyle']
|
|
||||||
configDirectory = configRoot
|
|
||||||
configProperties = [basedir: configRoot.getAbsolutePath()]
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Set output directory and encoding
|
|
||||||
tasks {
|
|
||||||
withType<JavaCompile> {
|
|
||||||
options.encoding = StandardCharsets.UTF_8.name()
|
|
||||||
options.compilerArgs.addAll(listOf("-Xlint:all"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Automatically shadowJar when building
|
|
||||||
tasks {
|
|
||||||
build {
|
|
||||||
dependsOn(shadowJar)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Output a single jar
|
|
||||||
tasks {
|
|
||||||
shadowJar {
|
|
||||||
minimize()
|
|
||||||
archiveFileName.set(project.name + "-" + project.version + ".jar")
|
|
||||||
doLast {
|
|
||||||
val archive = archiveFile.get().asFile
|
|
||||||
val libs = rootProject.buildDir.resolve("libs")
|
|
||||||
libs.mkdirs()
|
|
||||||
archive.copyTo(libs.resolve(archive.name), overwrite = true)
|
|
||||||
}
|
|
||||||
relocate("org.yaml", "net.draycia.carbon.libs.org.yaml")
|
|
||||||
relocate("org.spongepowered.configurate", "net.draycia.carbon.libs.configurate")
|
|
||||||
relocate("org.checkerframework", "net.draycia.carbon.libs.checkerframework")
|
|
||||||
relocate("org.reactivestreams", "net.draycia.carbon.libs.reactivestreams")
|
|
||||||
relocate("org.codehaus", "net.draycia.carbon.libs.codehaus")
|
|
||||||
relocate("io.leangen.geantyref", "net.draycia.carbon.libs.typereference")
|
|
||||||
relocate("io.lettuce", "net.draycia.carbon.libs.lettuce")
|
|
||||||
relocate("cloud.commandframework", "net.draycia.carbon.libs.cloud")
|
|
||||||
relocate("com.zaxxer.hikari", "net.draycia.carbon.libs.hikari")
|
|
||||||
relocate("com.typesafe.config", "net.draycia.carbon.libs.typesafe.config")
|
|
||||||
relocate("com.google.common", "net.draycia.carbon.libs.google.common")
|
|
||||||
relocate("reactor", "net.draycia.carbon.libs.reactor")
|
|
||||||
relocate("javax.annotation", "net.draycia.carbon.libs.javax.annotation")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//// Automatically relocate all shaded dependencies
|
|
||||||
//import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
|
||||||
//
|
|
||||||
//task relocateShadowJar(type: ConfigureShadowRelocation) {
|
|
||||||
// target = tasks.shadowJar
|
|
||||||
// prefix = "net.draycia.carbon.libs" // Default value is "shadow"
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//tasks.shadowJar.dependsOn tasks.relocateShadowJar
|
|
||||||
|
|
||||||
// Cleanup custom output directory on clean task
|
|
||||||
tasks {
|
|
||||||
clean {
|
|
||||||
doFirst {
|
|
||||||
delete("$rootDir/build/bundled")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
metadata:
|
||||||
|
format: { version: 1.0 }
|
||||||
|
polyglot-extensions:
|
||||||
|
- plugins
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
net.kyori.indra: &indra 2.0.2
|
||||||
|
net.kyori.indra.checkstyle: *indra
|
||||||
|
net.kyori.indra.publishing: *indra
|
||||||
|
net.kyori.indra.git: *indra
|
||||||
|
com.github.johnrengelman.shadow: 7.0.0
|
||||||
|
net.minecrell.plugin-yml.bukkit: 0.4.0
|
||||||
|
org.spongepowered.gradle.plugin: 1.0.3
|
||||||
|
org.checkerframework: 0.5.20
|
||||||
|
|
||||||
|
versions:
|
||||||
|
adventure: 4.7.0
|
||||||
|
minimessage: 4.1.0-SNAPSHOT
|
||||||
|
cloud: 1.5.0-SNAPSHOT
|
||||||
|
configurate: 4.1.1-SNAPSHOT
|
||||||
|
typesafeConfig: 1.+
|
||||||
|
checkerQual: 3.13.0
|
||||||
|
stylecheck: 0.1-SNAPSHOT
|
||||||
|
gson: 2.8.0
|
||||||
|
guava: 30.1-jre
|
||||||
|
bstats: 2.2.1
|
||||||
|
paperApi: 1.16.5-R0.1-SNAPSHOT
|
||||||
|
paperLib: 1.0.6
|
||||||
|
kyoriEventApi: 3.0.0
|
||||||
|
kyoriRegistry: 1.0.0-SNAPSHOT
|
||||||
|
log4j: 2.11.2
|
||||||
|
moonshine: 0.2.4-SNAPSHOT
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
adventureBom:
|
||||||
|
group: net.kyori
|
||||||
|
name: adventure-bom
|
||||||
|
version: { ref: adventure }
|
||||||
|
adventureApi:
|
||||||
|
group: net.kyori
|
||||||
|
name: adventure-api
|
||||||
|
adventureTextSerializerGson:
|
||||||
|
group: net.kyori
|
||||||
|
name: adventure-text-serializer-gson
|
||||||
|
adventureTextSerializerPlain:
|
||||||
|
group: net.kyori
|
||||||
|
name: adventure-text-serializer-plain
|
||||||
|
adventureSerializerConfigurate4:
|
||||||
|
group: net.kyori
|
||||||
|
name: adventure-serializer-configurate4
|
||||||
|
version: { ref: adventure }
|
||||||
|
minimessage:
|
||||||
|
group: net.kyori
|
||||||
|
name: adventure-text-minimessage
|
||||||
|
version: { ref: minimessage }
|
||||||
|
|
||||||
|
log4jApi:
|
||||||
|
group: org.apache.logging.log4j
|
||||||
|
name: log4j-api
|
||||||
|
version: { ref: log4j }
|
||||||
|
|
||||||
|
moonshine:
|
||||||
|
group: com.proximyst.moonshine
|
||||||
|
name: core
|
||||||
|
version: { ref: moonshine }
|
||||||
|
|
||||||
|
kyoriEventApi:
|
||||||
|
group: net.kyori
|
||||||
|
name: event-api
|
||||||
|
version: { ref: kyoriEventApi }
|
||||||
|
kyoriRegistry:
|
||||||
|
group: net.kyori
|
||||||
|
name: registry
|
||||||
|
version: { ref: kyoriRegistry }
|
||||||
|
|
||||||
|
cloudCore:
|
||||||
|
group: cloud.commandframework
|
||||||
|
name: cloud-core
|
||||||
|
version: { ref: cloud }
|
||||||
|
cloudMinecraftExtras:
|
||||||
|
group: cloud.commandframework
|
||||||
|
name: cloud-minecraft-extras
|
||||||
|
version: { ref: cloud }
|
||||||
|
cloudPaper:
|
||||||
|
group: cloud.commandframework
|
||||||
|
name: cloud-paper
|
||||||
|
version: { ref: cloud }
|
||||||
|
cloudSponge:
|
||||||
|
group: cloud.commandframework
|
||||||
|
name: cloud-sponge
|
||||||
|
version: { ref: cloud }
|
||||||
|
|
||||||
|
configurateCore:
|
||||||
|
group: org.spongepowered
|
||||||
|
name: configurate-core
|
||||||
|
version: { ref: configurate }
|
||||||
|
configurateHocon:
|
||||||
|
group: org.spongepowered
|
||||||
|
name: configurate-hocon
|
||||||
|
version: { ref: configurate }
|
||||||
|
typesafeConfig:
|
||||||
|
group: com.typesafe
|
||||||
|
name: config
|
||||||
|
version: { ref: typesafeConfig }
|
||||||
|
|
||||||
|
checkerQual:
|
||||||
|
group: org.checkerframework
|
||||||
|
name: checker-qual
|
||||||
|
version: { ref: checkerQual }
|
||||||
|
stylecheck:
|
||||||
|
group: ca.stellardrift
|
||||||
|
name: stylecheck
|
||||||
|
version: { ref: stylecheck }
|
||||||
|
|
||||||
|
gson:
|
||||||
|
group: com.google.code.gson
|
||||||
|
name: gson
|
||||||
|
version: { ref: gson }
|
||||||
|
guava:
|
||||||
|
group: com.google.guava
|
||||||
|
name: guava
|
||||||
|
version: { ref: guava }
|
||||||
|
|
||||||
|
bstatsBukkit:
|
||||||
|
group: org.bstats
|
||||||
|
name: bstats-bukkit
|
||||||
|
version: { ref: bstats }
|
||||||
|
bstatsSponge:
|
||||||
|
group: org.bstats
|
||||||
|
name: bstats-sponge
|
||||||
|
version: { ref: bstats }
|
||||||
|
|
||||||
|
paperApi:
|
||||||
|
group: com.destroystokyo.paper
|
||||||
|
name: paper-api
|
||||||
|
version: { ref: paperApi }
|
||||||
|
paperLib:
|
||||||
|
group: io.papermc
|
||||||
|
name: paperlib
|
||||||
|
version: { ref: paperLib }
|
||||||
|
|
||||||
|
bundles:
|
||||||
+7
-23
@@ -1,18 +1,16 @@
|
|||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import net.draycia.carbon.BSTATS_VER
|
|
||||||
import net.draycia.carbon.CLOUD_VER
|
|
||||||
import org.spongepowered.plugin.metadata.PluginDependency
|
import org.spongepowered.plugin.metadata.PluginDependency
|
||||||
import org.spongepowered.gradle.plugin.config.PluginLoaders
|
import org.spongepowered.gradle.plugin.config.PluginLoaders
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.johnrengelman.shadow")
|
id("com.github.johnrengelman.shadow")
|
||||||
id("org.spongepowered.gradle.plugin") version "1.0.3"
|
id("org.spongepowered.gradle.plugin")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(projects.carbonchatApi)
|
implementation(projects.carbonchatApi)
|
||||||
implementation("cloud.commandframework:cloud-sponge:$CLOUD_VER")
|
implementation(libs.cloudSponge)
|
||||||
implementation("org.bstats:bstats-sponge:$BSTATS_VER")
|
//implementation(libs.bstatsSponge) // not updated for api 8 yet
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
@@ -23,26 +21,12 @@ tasks {
|
|||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
shadowJar {
|
shadowJar {
|
||||||
minimize()
|
|
||||||
archiveFileName.set(project.name + "-" + project.version + ".jar")
|
archiveFileName.set(project.name + "-" + project.version + ".jar")
|
||||||
doLast {
|
configureShadow()
|
||||||
val archive = archiveFile.get().asFile
|
dependencies {
|
||||||
val libs = rootProject.buildDir.resolve("libs")
|
// included in sponge
|
||||||
libs.mkdirs()
|
exclude(dependency("io.leangen.geantyref:geantyref"))
|
||||||
archive.copyTo(libs.resolve(archive.name), overwrite = true)
|
|
||||||
}
|
}
|
||||||
relocate("org.yaml", "net.draycia.carbon.libs.org.yaml")
|
|
||||||
relocate("org.checkerframework", "net.draycia.carbon.libs.checkerframework")
|
|
||||||
relocate("org.reactivestreams", "net.draycia.carbon.libs.reactivestreams")
|
|
||||||
relocate("org.codehaus", "net.draycia.carbon.libs.codehaus")
|
|
||||||
relocate("io.leangen.geantyref", "net.draycia.carbon.libs.typereference")
|
|
||||||
relocate("io.lettuce", "net.draycia.carbon.libs.lettuce")
|
|
||||||
relocate("cloud.commandframework", "net.draycia.carbon.libs.cloud")
|
|
||||||
relocate("com.zaxxer.hikari", "net.draycia.carbon.libs.hikari")
|
|
||||||
relocate("com.typesafe.config", "net.draycia.carbon.libs.typesafe.config")
|
|
||||||
relocate("com.google.common", "net.draycia.carbon.libs.google.common")
|
|
||||||
relocate("reactor", "net.draycia.carbon.libs.reactor")
|
|
||||||
relocate("javax.annotation", "net.draycia.carbon.libs.javax.annotation")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import net.draycia.carbon.api.CarbonChat;
|
|||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.bstats.sponge.Metrics;
|
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
import org.spongepowered.api.data.Keys;
|
import org.spongepowered.api.data.Keys;
|
||||||
@@ -15,7 +14,6 @@ import org.spongepowered.api.item.inventory.ItemStack;
|
|||||||
import org.spongepowered.plugin.PluginContainer;
|
import org.spongepowered.plugin.PluginContainer;
|
||||||
import org.spongepowered.plugin.jvm.Plugin;
|
import org.spongepowered.plugin.jvm.Plugin;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static net.kyori.adventure.text.Component.empty;
|
import static net.kyori.adventure.text.Component.empty;
|
||||||
@@ -31,14 +29,14 @@ public class CarbonChatSponge implements CarbonChat {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public CarbonChatSponge(
|
public CarbonChatSponge(
|
||||||
|
//final Metrics.@NonNull Factory metricsFactory,
|
||||||
final @NonNull PluginContainer pluginContainer,
|
final @NonNull PluginContainer pluginContainer,
|
||||||
final @NonNull Logger logger,
|
final @NonNull Logger logger
|
||||||
final Metrics.Factory metricsFactory
|
|
||||||
) {
|
) {
|
||||||
this.pluginContainer = pluginContainer;
|
this.pluginContainer = pluginContainer;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
|
||||||
metricsFactory.make(BSTATS_PLUGIN_ID);
|
//metricsFactory.make(BSTATS_PLUGIN_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,36 +46,37 @@ public class CarbonChatSponge implements CarbonChat {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Component createComponent(final @NonNull UUID uuid) {
|
public @NonNull Component createComponent(final @NonNull UUID uuid) {
|
||||||
final Optional<ServerPlayer> player = Sponge.server().player(uuid);
|
final ServerPlayer player = Sponge.server().player(uuid).orElse(null);
|
||||||
|
if (player == null) {
|
||||||
if (player.isPresent()) {
|
return empty();
|
||||||
ItemStack itemStack = null;
|
|
||||||
|
|
||||||
final ItemStack mainHand = player.get().itemInHand(HandTypes.MAIN_HAND);
|
|
||||||
|
|
||||||
if (!mainHand.isEmpty()) {
|
|
||||||
itemStack = mainHand;
|
|
||||||
} else {
|
|
||||||
final ItemStack offHand = player.get().itemInHand(HandTypes.OFF_HAND);
|
|
||||||
|
|
||||||
if (!offHand.isEmpty()) {
|
|
||||||
itemStack = offHand;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemStack == null || itemStack.isEmpty()) {
|
|
||||||
return empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
final TextComponent.Builder builder = text();
|
|
||||||
|
|
||||||
builder.append(text("[", WHITE));
|
|
||||||
builder.append(itemStack.get(Keys.DISPLAY_NAME).orElse(itemStack.type().asComponent()));
|
|
||||||
builder.append(text("]", WHITE));
|
|
||||||
|
|
||||||
return builder.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty();
|
final ItemStack itemStack;
|
||||||
|
|
||||||
|
final ItemStack mainHand = player.itemInHand(HandTypes.MAIN_HAND);
|
||||||
|
|
||||||
|
if (!mainHand.isEmpty()) {
|
||||||
|
itemStack = mainHand;
|
||||||
|
} else {
|
||||||
|
final ItemStack offHand = player.itemInHand(HandTypes.OFF_HAND);
|
||||||
|
|
||||||
|
if (!offHand.isEmpty()) {
|
||||||
|
itemStack = offHand;
|
||||||
|
} else {
|
||||||
|
itemStack = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemStack == null || itemStack.isEmpty()) {
|
||||||
|
return empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
final TextComponent.Builder builder = text();
|
||||||
|
|
||||||
|
builder.append(text('[', WHITE));
|
||||||
|
builder.append(itemStack.get(Keys.DISPLAY_NAME).orElse(itemStack.type().asComponent()));
|
||||||
|
builder.append(text(']', WHITE));
|
||||||
|
|
||||||
|
return builder.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user