diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dedaea630..fa2938765 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -46,6 +46,8 @@ jsoup = { group = "org.jsoup", name = "jsoup", version = "1.18.3" } junit-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junit" } junit-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit" } +slf4j-api = { group = "org.slf4j", name = "slf4j-api", version = "2.0.17" } + [bundles] junit = ["junit-api", "junit-engine"] nuvotifier = ["nuvotifier-api", "nuvotifier-bukkit"] diff --git a/libraries/build.gradle.kts b/libraries/build.gradle.kts new file mode 100644 index 000000000..d0e92edbc --- /dev/null +++ b/libraries/build.gradle.kts @@ -0,0 +1,40 @@ + +subprojects { + apply(plugin = "java-library") + + var javaVersion = 21 + configure { + toolchain { + languageVersion.set(JavaLanguageVersion.of(javaVersion)) + } + withSourcesJar() + withJavadocJar() + } + + tasks.withType { + options { + (this as CoreJavadocOptions).addBooleanOption("Xdoclint:none", true) + } + } + + tasks.withType { + options.encoding = "UTF-8" + options.release = javaVersion + } + + tasks.withType { + filteringCharset = "UTF-8" + } + + tasks.withType { + enabled = false + } + + pluginManager.withPlugin("com.gradleup.shadow") { + tasks { + named("build") { + dependsOn("shadowJar") + } + } + } +} diff --git a/libraries/name-api/build.gradle.kts b/libraries/name-api/build.gradle.kts new file mode 100644 index 000000000..b7af74bf3 --- /dev/null +++ b/libraries/name-api/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + id("java") +} + +group = "net.civmc" +version = "1.0.0" + +dependencies { + api(libs.hikaricp) + api(libs.configurate.yaml) + api("org.mariadb.jdbc:mariadb-java-client:3.5.6") + implementation(libs.slf4j.api) +} diff --git a/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/AssociationList.java b/libraries/name-api/src/main/java/net/civmc/nameApi/AssociationList.java similarity index 99% rename from plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/AssociationList.java rename to libraries/name-api/src/main/java/net/civmc/nameApi/AssociationList.java index c1a07182e..95314a42e 100644 --- a/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/AssociationList.java +++ b/libraries/name-api/src/main/java/net/civmc/nameApi/AssociationList.java @@ -1,4 +1,4 @@ -package net.civmc.civproxy.renamer; +package net.civmc.nameApi; import java.sql.Connection; import java.sql.PreparedStatement; @@ -8,7 +8,6 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; import javax.sql.DataSource; -import net.civmc.civproxy.database.Migrator; import org.slf4j.Logger; public class AssociationList { diff --git a/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/database/Migrator.java b/libraries/name-api/src/main/java/net/civmc/nameApi/Migrator.java similarity index 98% rename from plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/database/Migrator.java rename to libraries/name-api/src/main/java/net/civmc/nameApi/Migrator.java index d0c0ca959..2a1dd5c95 100644 --- a/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/database/Migrator.java +++ b/libraries/name-api/src/main/java/net/civmc/nameApi/Migrator.java @@ -1,4 +1,4 @@ -package net.civmc.civproxy.database; +package net.civmc.nameApi; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/plugins/civproxy-velocity/build.gradle.kts b/plugins/civproxy-velocity/build.gradle.kts index 288588003..841f74e57 100644 --- a/plugins/civproxy-velocity/build.gradle.kts +++ b/plugins/civproxy-velocity/build.gradle.kts @@ -11,4 +11,5 @@ dependencies { api("org.mariadb.jdbc:mariadb-java-client:3.5.6") compileOnly(libs.luckperms.api) annotationProcessor("com.velocitypowered:velocity-api:3.4.0-SNAPSHOT") + api(project(":libraries:name-api")) } diff --git a/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/ChangePlayerNameCommand.java b/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/ChangePlayerNameCommand.java index 7a91f03e7..4a2da2d75 100644 --- a/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/ChangePlayerNameCommand.java +++ b/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/ChangePlayerNameCommand.java @@ -3,6 +3,7 @@ package net.civmc.civproxy.renamer; import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.command.SimpleCommand; import com.velocitypowered.api.proxy.ProxyServer; +import net.civmc.nameApi.AssociationList; import net.kyori.adventure.text.Component; import java.util.UUID; diff --git a/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/PlayerRenamer.java b/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/PlayerRenamer.java index ef502bb3b..007fa62d7 100644 --- a/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/PlayerRenamer.java +++ b/plugins/civproxy-velocity/src/main/java/net/civmc/civproxy/renamer/PlayerRenamer.java @@ -6,6 +6,7 @@ import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.util.GameProfile; import javax.sql.DataSource; import net.civmc.civproxy.CivProxyPlugin; +import net.civmc.nameApi.AssociationList; public class PlayerRenamer { diff --git a/settings.gradle.kts b/settings.gradle.kts index 760ba3671..54ba8eed1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,6 +13,8 @@ plugins { include(":ansible") +include(":libraries:name-api") + include(":plugins:announcements-velocity") include(":plugins:banstick-paper") include(":plugins:bastion-paper") @@ -44,3 +46,7 @@ include(":plugins:voidworld-paper") include(":plugins:heliodor-paper") include(":plugins:civproxy-velocity") include(":plugins:kiragateway-velocity") + +include("libraries:name-api") +include("libraries:name-api") +include("libraries:name-api")