mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 09:07:37 +00:00
Revamp the build system
This commit is contained in:
parent
d4710f1808
commit
6d80d5f4e3
72
build.gradle
72
build.gradle
@ -1,72 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id "java"
|
|
||||||
id "maven-publish"
|
|
||||||
id "com.github.johnrengelman.shadow" version "8.1.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
group = "dev.plex"
|
|
||||||
version = "1.4-SNAPSHOT"
|
|
||||||
description = "Plex"
|
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply plugin: "java"
|
|
||||||
apply plugin: "maven-publish"
|
|
||||||
apply plugin: "com.github.johnrengelman.shadow"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url = uri("https://repo.papermc.io/repository/maven-public/")
|
|
||||||
}
|
|
||||||
|
|
||||||
maven {
|
|
||||||
url = uri("https://repository.apache.org/content/repositories/snapshots/")
|
|
||||||
}
|
|
||||||
|
|
||||||
maven {
|
|
||||||
url = uri("https://repo.maven.apache.org/maven2/")
|
|
||||||
}
|
|
||||||
|
|
||||||
maven {
|
|
||||||
url = uri("https://jitpack.io")
|
|
||||||
content {
|
|
||||||
includeGroup("com.github.MilkBowl")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
def releasesRepoUrl = uri("https://nexus.telesphoreo.me/repository/plex-releases/")
|
|
||||||
def snapshotsRepoUrl = uri("https://nexus.telesphoreo.me/repository/plex-snapshots/")
|
|
||||||
url = rootProject.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
|
||||||
credentials {
|
|
||||||
username = System.getenv("plexUser")
|
|
||||||
password = System.getenv("plexPassword")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
clean {
|
|
||||||
dependsOn(":server:clean")
|
|
||||||
dependsOn(":proxy:clean")
|
|
||||||
}
|
|
||||||
|
|
||||||
task copyJars(type: Copy, dependsOn: subprojects.jar) {
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
||||||
from(subprojects.jar)
|
|
||||||
from(subprojects.shadowJar)
|
|
||||||
into project.file('build/libs')
|
|
||||||
}
|
|
86
build.gradle.kts
Normal file
86
build.gradle.kts
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
plugins {
|
||||||
|
id("java")
|
||||||
|
id("maven-publish")
|
||||||
|
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7"
|
||||||
|
id("net.kyori.blossom") version "2.1.0"
|
||||||
|
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "dev.plex"
|
||||||
|
version = "1.4-SNAPSHOT"
|
||||||
|
description = "Plex"
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
apply(plugin = "java")
|
||||||
|
apply(plugin = "maven-publish")
|
||||||
|
apply(plugin = "org.jetbrains.gradle.plugin.idea-ext")
|
||||||
|
apply(plugin = "net.kyori.blossom")
|
||||||
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url = uri("https://repo.papermc.io/repository/maven-public/")
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url = uri("https://repository.apache.org/content/repositories/snapshots/")
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url = uri("https://repo.maven.apache.org/maven2/")
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url = uri("https://jitpack.io")
|
||||||
|
content {
|
||||||
|
includeGroup("com.github.MilkBowl")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
compileJava {
|
||||||
|
options.encoding = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
|
javadoc {
|
||||||
|
options.encoding = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
|
processResources {
|
||||||
|
filteringCharset = Charsets.UTF_8.name()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
val releasesRepoUrl = uri("https://nexus.telesphoreo.me/repository/plex-releases/")
|
||||||
|
val snapshotsRepoUrl = uri("https://nexus.telesphoreo.me/repository/plex-snapshots/")
|
||||||
|
url = if (rootProject.version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("plexUser")
|
||||||
|
password = System.getenv("plexPassword")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.clean {
|
||||||
|
// Is there any way to not need to specify each subproject?
|
||||||
|
dependsOn(":server:clean")
|
||||||
|
dependsOn(":proxy:clean")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.create<Copy>("copyJars") {
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
|
// Is there any way to not need to specify each subproject?
|
||||||
|
from(tasks.getByPath(":server:shadowJar"))
|
||||||
|
from(tasks.getByPath(":proxy:jar"))
|
||||||
|
into(file("build/libs"))
|
||||||
|
}
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
plugins {
|
|
||||||
id("net.kyori.blossom") version "1.3.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
group = rootProject.group
|
group = rootProject.group
|
||||||
version = rootProject.version
|
version = rootProject.version
|
||||||
description = "Plex-Velocity"
|
description = "Plex-Velocity"
|
||||||
@ -24,8 +20,14 @@ tasks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
blossom {
|
blossom {
|
||||||
replaceToken("@version@", rootProject.version)
|
javaSources {
|
||||||
|
property("version", project.version.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package dev.plex;
|
||||||
|
|
||||||
|
class BuildParameters {
|
||||||
|
public static final String VERSION = "{{ version }}";
|
||||||
|
}
|
@ -28,7 +28,7 @@ import java.util.logging.Logger;
|
|||||||
@Plugin(
|
@Plugin(
|
||||||
name = "Plex",
|
name = "Plex",
|
||||||
id = "plex",
|
id = "plex",
|
||||||
version = "@version@",
|
version = BuildParameters.VERSION,
|
||||||
url = "https://plex.us.org",
|
url = "https://plex.us.org",
|
||||||
description = "Plex provides a new experience for freedom servers.",
|
description = "Plex provides a new experience for freedom servers.",
|
||||||
authors = {"Telesphoreo", "Taah"}
|
authors = {"Telesphoreo", "Taah"}
|
||||||
|
@ -1,154 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id "net.minecrell.plugin-yml.paper" version "0.6.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
library "org.projectlombok:lombok:1.18.30"
|
|
||||||
annotationProcessor "org.projectlombok:lombok:1.18.30"
|
|
||||||
library "org.json:json:20231013"
|
|
||||||
library "commons-io:commons-io:2.15.0"
|
|
||||||
library "redis.clients:jedis:5.0.2"
|
|
||||||
library "org.mariadb.jdbc:mariadb-java-client:3.2.0"
|
|
||||||
library "com.zaxxer:HikariCP:5.0.1"
|
|
||||||
library "org.apache.maven.resolver:maven-resolver-transport-http:1.9.16"
|
|
||||||
library "org.jetbrains:annotations:24.0.1"
|
|
||||||
compileOnly "dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT"
|
|
||||||
compileOnly("com.github.MilkBowl:VaultAPI:1.7.1") {
|
|
||||||
exclude group: "org.bukkit", module: "bukkit"
|
|
||||||
}
|
|
||||||
implementation "org.bstats:bstats-base:3.0.2"
|
|
||||||
implementation "org.bstats:bstats-bukkit:3.0.2"
|
|
||||||
}
|
|
||||||
|
|
||||||
group = rootProject.group
|
|
||||||
version = rootProject.version
|
|
||||||
description = "Plex-Server"
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
archiveBaseName.set("Plex")
|
|
||||||
archiveClassifier.set("")
|
|
||||||
relocate "org.bstats", "dev.plex"
|
|
||||||
}
|
|
||||||
|
|
||||||
paper {
|
|
||||||
name = "Plex"
|
|
||||||
version = project.version
|
|
||||||
description = "Plex provides a new experience for freedom servers."
|
|
||||||
main = "dev.plex.Plex"
|
|
||||||
loader = "dev.plex.PlexLibraryManager"
|
|
||||||
website = "https://plex.us.org"
|
|
||||||
authors = ["Telesphoreo", "taahanis", "supernt"]
|
|
||||||
apiVersion = "1.19"
|
|
||||||
foliaSupported = true
|
|
||||||
generateLibrariesJson = true
|
|
||||||
// Load BukkitTelnet and LibsDisguises before Plex so the modules register properly
|
|
||||||
serverDependencies {
|
|
||||||
'BukkitTelnet' {
|
|
||||||
required = false
|
|
||||||
load = 'BEFORE'
|
|
||||||
}
|
|
||||||
'LibsDisguises' {
|
|
||||||
required = false
|
|
||||||
load = 'BEFORE'
|
|
||||||
}
|
|
||||||
'Vault' {
|
|
||||||
required = false
|
|
||||||
load = 'BEFORE'
|
|
||||||
}
|
|
||||||
'Essentials' {
|
|
||||||
required = false
|
|
||||||
load = 'BEFORE'
|
|
||||||
}
|
|
||||||
'SlimeWorldManager' {
|
|
||||||
required = false
|
|
||||||
load = 'AFTER'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String getGitHash() {
|
|
||||||
def stdout = new ByteArrayOutputStream()
|
|
||||||
try {
|
|
||||||
exec {
|
|
||||||
commandLine "git", "rev-parse", "--short", "HEAD"
|
|
||||||
standardOutput = stdout
|
|
||||||
ignoreExitValue = true
|
|
||||||
}
|
|
||||||
} catch (GradleException e) {
|
|
||||||
logger.error("Couldn't determine Git head because Git is not installed. " + e.getMessage())
|
|
||||||
}
|
|
||||||
return stdout.size() > 0 ? stdout.toString().trim() : "unknown"
|
|
||||||
}
|
|
||||||
|
|
||||||
String getBuildNumber() {
|
|
||||||
def stdout = new ByteArrayOutputStream()
|
|
||||||
try {
|
|
||||||
exec {
|
|
||||||
commandLine "git", "rev-list", "HEAD", "--count"
|
|
||||||
standardOutput = stdout
|
|
||||||
ignoreExitValue = true
|
|
||||||
}
|
|
||||||
} catch (GradleException e) {
|
|
||||||
logger.error("Couldn't determine build number because Git is not installed. " + e.getMessage())
|
|
||||||
}
|
|
||||||
return stdout.size() ? stdout.toString().trim() + " (local)" : "unknown"
|
|
||||||
}
|
|
||||||
|
|
||||||
static def getDate() {
|
|
||||||
return new Date().format("MM/dd/yyyy '<light_purple>at<gold>' hh:mm:ss a z")
|
|
||||||
}
|
|
||||||
|
|
||||||
task buildProperties {
|
|
||||||
ant.propertyfile(file: "$project.projectDir/src/main/resources/build.properties") {
|
|
||||||
entry(key: "buildAuthor", default: System.getenv("JENKINS_URL") != null ? "jenkins" : "unknown")
|
|
||||||
entry(key: "buildNumber", value: System.getenv("JENKINS_URL") != null ? System.getenv("BUILD_NUMBER") + " (Jenkins)" : getBuildNumber())
|
|
||||||
entry(key: "buildDate", value: getDate())
|
|
||||||
entry(key: "buildHead", value: getGitHash())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
|
||||||
build {
|
|
||||||
dependsOn(shadowJar)
|
|
||||||
finalizedBy(buildProperties)
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
finalizedBy(rootProject.tasks.copyJars)
|
|
||||||
}
|
|
||||||
|
|
||||||
javadoc {
|
|
||||||
options.memberLevel = JavadocMemberLevel.PRIVATE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
maven(MavenPublication) {
|
|
||||||
pom.withXml {
|
|
||||||
def dependenciesNode = asNode().appendNode("dependencies")
|
|
||||||
configurations.getByName("library").getAllDependencies().each { dependency ->
|
|
||||||
dependenciesNode.appendNode("dependency").with {
|
|
||||||
it.appendNode("groupId", dependency.group)
|
|
||||||
it.appendNode("artifactId", dependency.name)
|
|
||||||
it.appendNode("version", dependency.version)
|
|
||||||
it.appendNode("scope", "provided")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
configurations.getByName("implementation").getAllDependencies().each { dependency ->
|
|
||||||
dependenciesNode.appendNode("dependency").with {
|
|
||||||
it.appendNode("groupId", dependency.group)
|
|
||||||
it.appendNode("artifactId", dependency.name)
|
|
||||||
it.appendNode("version", dependency.version)
|
|
||||||
it.appendNode("scope", "runtime")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
artifacts = [shadowJar]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
123
server/build.gradle.kts
Normal file
123
server/build.gradle.kts
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
import net.minecrell.pluginyml.paper.PaperPluginDescription
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("org.ajoberstar.grgit") version "5.2.1"
|
||||||
|
id("net.minecrell.plugin-yml.paper") version "0.6.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
library("org.projectlombok:lombok:1.18.30")
|
||||||
|
annotationProcessor("org.projectlombok:lombok:1.18.30")
|
||||||
|
library("org.json:json:20231013")
|
||||||
|
library("commons-io:commons-io:2.15.1")
|
||||||
|
library("redis.clients:jedis:5.1.0")
|
||||||
|
library("org.mariadb.jdbc:mariadb-java-client:3.3.1")
|
||||||
|
library("com.zaxxer:HikariCP:5.1.0")
|
||||||
|
library("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
||||||
|
library("org.jetbrains:annotations:24.1.0")
|
||||||
|
compileOnly("dev.folia:folia-api:1.20.2-R0.1-SNAPSHOT")
|
||||||
|
compileOnly("com.github.MilkBowl:VaultAPI:1.7.1")
|
||||||
|
implementation("org.bstats:bstats-base:3.0.2")
|
||||||
|
implementation("org.bstats:bstats-bukkit:3.0.2")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = rootProject.group
|
||||||
|
version = rootProject.version
|
||||||
|
description = "Plex-Server"
|
||||||
|
|
||||||
|
paper {
|
||||||
|
name = "Plex"
|
||||||
|
version = rootProject.version.toString()
|
||||||
|
description = "Plex provides a new experience for freedom servers."
|
||||||
|
main = "dev.plex.Plex"
|
||||||
|
loader = "dev.plex.PlexLibraryManager"
|
||||||
|
website = "https://plex.us.org"
|
||||||
|
authors = listOf("Telesphoreo", "taahanis", "supernt")
|
||||||
|
apiVersion = "1.19"
|
||||||
|
foliaSupported = true
|
||||||
|
generateLibrariesJson = true
|
||||||
|
// Load BukkitTelnet and LibsDisguises before Plex so the modules register properly
|
||||||
|
serverDependencies {
|
||||||
|
register("BukkitTelnet") {
|
||||||
|
required = false
|
||||||
|
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
|
||||||
|
}
|
||||||
|
register("LibsDisguises") {
|
||||||
|
required = false
|
||||||
|
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
|
||||||
|
}
|
||||||
|
register("Vault") {
|
||||||
|
required = false
|
||||||
|
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
|
||||||
|
}
|
||||||
|
register("Essentials") {
|
||||||
|
required = false
|
||||||
|
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
|
||||||
|
}
|
||||||
|
register("SlimeWorldManager") {
|
||||||
|
required = false
|
||||||
|
load = PaperPluginDescription.RelativeLoadOrder.AFTER
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
build {
|
||||||
|
dependsOn(shadowJar)
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
blossom {
|
||||||
|
resources {
|
||||||
|
property("author", if (System.getenv("JENKINS_URL") != null) "jenkins" else System.getProperty("user.name"))
|
||||||
|
property("buildNumber", if (System.getenv("BUILD_NUMBER") != null) System.getenv("BUILD_NUMBER") else "unknown")
|
||||||
|
property("date", SimpleDateFormat("MM/dd/yyyy '<light_purple>at<gold>' hh:mm:ss a z").format(Date()))
|
||||||
|
property("gitCommit", grgit.head().abbreviatedId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
archiveBaseName.set("Plex")
|
||||||
|
archiveClassifier.set("")
|
||||||
|
relocate("org.bstats", "dev.plex")
|
||||||
|
finalizedBy(rootProject.tasks["copyJars"])
|
||||||
|
}
|
||||||
|
|
||||||
|
javadoc {
|
||||||
|
options.memberLevel = JavadocMemberLevel.PRIVATE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("maven") {
|
||||||
|
pom.withXml {
|
||||||
|
val dependenciesNode = asNode().appendNode("dependencies")
|
||||||
|
configurations.getByName("library").allDependencies.configureEach {
|
||||||
|
dependenciesNode.appendNode("dependency")
|
||||||
|
.appendNode("groupId", group).parent()
|
||||||
|
.appendNode("artifactId", name).parent()
|
||||||
|
.appendNode("version", version).parent()
|
||||||
|
.appendNode("scope", "provided").parent()
|
||||||
|
}
|
||||||
|
configurations.getByName("implementation").allDependencies.configureEach {
|
||||||
|
dependenciesNode.appendNode("dependency")
|
||||||
|
.appendNode("groupId", group).parent()
|
||||||
|
.appendNode("artifactId", name).parent()
|
||||||
|
.appendNode("version", version).parent()
|
||||||
|
.appendNode("scope", "provided").parent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
artifacts.artifact(tasks.shadowJar)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package dev.plex;
|
package dev.plex;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import dev.plex.cache.DataUtils;
|
import dev.plex.cache.DataUtils;
|
||||||
import dev.plex.cache.PlayerCache;
|
import dev.plex.cache.PlayerCache;
|
||||||
import dev.plex.config.Config;
|
import dev.plex.config.Config;
|
||||||
@ -18,13 +17,11 @@ import dev.plex.storage.punishment.SQLNotes;
|
|||||||
import dev.plex.storage.punishment.SQLPunishment;
|
import dev.plex.storage.punishment.SQLPunishment;
|
||||||
import dev.plex.util.*;
|
import dev.plex.util.*;
|
||||||
import dev.plex.util.redis.MessageUtil;
|
import dev.plex.util.redis.MessageUtil;
|
||||||
import dev.plex.util.sql.SQLUtil;
|
|
||||||
import dev.plex.world.CustomWorld;
|
import dev.plex.world.CustomWorld;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.milkbowl.vault.chat.Chat;
|
import net.milkbowl.vault.chat.Chat;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
@ -46,7 +43,6 @@ public class Plex extends JavaPlugin
|
|||||||
public File modulesFolder;
|
public File modulesFolder;
|
||||||
private StorageType storageType = StorageType.SQLITE;
|
private StorageType storageType = StorageType.SQLITE;
|
||||||
private SQLConnection sqlConnection;
|
private SQLConnection sqlConnection;
|
||||||
// private MongoConnection mongoConnection;
|
|
||||||
private RedisConnection redisConnection;
|
private RedisConnection redisConnection;
|
||||||
|
|
||||||
private PlayerCache playerCache;
|
private PlayerCache playerCache;
|
||||||
|
@ -35,7 +35,7 @@ public class PlexCMD extends PlexCommand
|
|||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
send(sender, mmString("<light_purple>Plex - A new freedom plugin."));
|
send(sender, mmString("<light_purple>Plex - A new freedom plugin."));
|
||||||
send(sender, mmString("<light_purple>Plugin version: <gold>" + plugin.getDescription().getVersion() + " #" + BuildInfo.getNumber() + " <light_purple>Git: <gold>" + BuildInfo.getHead()));
|
send(sender, mmString("<light_purple>Plugin version: <gold>" + plugin.getDescription().getVersion() + " #" + BuildInfo.getNumber() + " <light_purple>Git: <gold>" + BuildInfo.getCommit()));
|
||||||
send(sender, mmString("<light_purple>Authors: <gold>Telesphoreo, Taahh"));
|
send(sender, mmString("<light_purple>Authors: <gold>Telesphoreo, Taahh"));
|
||||||
send(sender, mmString("<light_purple>Built by: <gold>" + BuildInfo.getAuthor() + " <light_purple>on <gold>" + BuildInfo.getDate()));
|
send(sender, mmString("<light_purple>Built by: <gold>" + BuildInfo.getAuthor() + " <light_purple>on <gold>" + BuildInfo.getDate()));
|
||||||
send(sender, mmString("<light_purple>Run <gold>/plex modules <light_purple>to see a list of modules."));
|
send(sender, mmString("<light_purple>Run <gold>/plex modules <light_purple>to see a list of modules."));
|
||||||
|
@ -8,30 +8,30 @@ import java.util.Properties;
|
|||||||
|
|
||||||
public class BuildInfo
|
public class BuildInfo
|
||||||
{
|
{
|
||||||
@Getter
|
|
||||||
public static String number;
|
|
||||||
@Getter
|
@Getter
|
||||||
public static String author;
|
public static String author;
|
||||||
@Getter
|
@Getter
|
||||||
|
public static String commit;
|
||||||
|
@Getter
|
||||||
public static String date;
|
public static String date;
|
||||||
@Getter
|
@Getter
|
||||||
public static String head;
|
public static String number;
|
||||||
|
|
||||||
public void load(Plex plugin)
|
public void load(Plex plugin)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Properties props;
|
Properties props;
|
||||||
try (InputStream in = plugin.getResource("build.properties"))
|
try (InputStream in = plugin.getResource("build-vars.properties"))
|
||||||
{
|
{
|
||||||
props = new Properties();
|
props = new Properties();
|
||||||
props.load(in);
|
props.load(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
author = props.getProperty("author", "unknown");
|
||||||
|
commit = props.getProperty("gitCommit", "unknown");
|
||||||
|
date = props.getProperty("date", "unknown");
|
||||||
number = props.getProperty("buildNumber", "unknown");
|
number = props.getProperty("buildNumber", "unknown");
|
||||||
author = props.getProperty("buildAuthor", "unknown");
|
|
||||||
date = props.getProperty("buildDate", "unknown");
|
|
||||||
head = props.getProperty("buildHead", "unknown");
|
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
|
@ -96,7 +96,7 @@ public class UpdateChecker implements PlexBase
|
|||||||
// If it's -4, it hasn't checked for updates yet
|
// If it's -4, it hasn't checked for updates yet
|
||||||
if (distance == -4)
|
if (distance == -4)
|
||||||
{
|
{
|
||||||
distance = fetchDistanceFromGitHub(REPO, BRANCH, BuildInfo.getHead());
|
distance = fetchDistanceFromGitHub(REPO, BRANCH, BuildInfo.getCommit());
|
||||||
PlexLog.debug("Never checked for updates, checking now...");
|
PlexLog.debug("Never checked for updates, checking now...");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -104,7 +104,7 @@ public class UpdateChecker implements PlexBase
|
|||||||
// If the request isn't asked to be cached, fetch it
|
// If the request isn't asked to be cached, fetch it
|
||||||
if (!cached)
|
if (!cached)
|
||||||
{
|
{
|
||||||
distance = fetchDistanceFromGitHub(REPO, BRANCH, BuildInfo.getHead());
|
distance = fetchDistanceFromGitHub(REPO, BRANCH, BuildInfo.getCommit());
|
||||||
PlexLog.debug("We have checked for updates before, but this request was not asked to be cached.");
|
PlexLog.debug("We have checked for updates before, but this request was not asked to be cached.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
10
server/src/main/resource-templates/build-vars.properties
Normal file
10
server/src/main/resource-templates/build-vars.properties
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
author={{ author | default("unknown") }}
|
||||||
|
|
||||||
|
buildNumber={{ buildNumber }}
|
||||||
|
|
||||||
|
date={{ date }}
|
||||||
|
|
||||||
|
gitCommit={{ gitCommit | default("unknown") }}
|
||||||
|
|
||||||
|
gitHead={{ gitHead | default("unknown") }}
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
rootProject.name = "Plex"
|
|
||||||
include 'server'
|
|
||||||
include 'proxy'
|
|
||||||
|
|
2
settings.gradle.kts
Normal file
2
settings.gradle.kts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
rootProject.name = "Plex"
|
||||||
|
include("server", "proxy")
|
Loading…
Reference in New Issue
Block a user