wo ist denn hier das wohnzimmer
This commit is contained in:
parent
7d05c16fe1
commit
d773c8537d
@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.0.0"
|
||||
kotlin("plugin.serialization") version "1.7.0"
|
||||
id("io.github.goooler.shadow") version "8.1.7"
|
||||
id("net.kyori.blossom") version "2.1.0"
|
||||
id("net.kyori.indra.git") version "3.1.3"
|
||||
|
@ -1,14 +1,22 @@
|
||||
package moe.jansel.platinum
|
||||
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.call.*
|
||||
import io.ktor.client.engine.cio.*
|
||||
import io.ktor.client.plugins.*
|
||||
import io.ktor.client.plugins.contentnegotiation.*
|
||||
import io.ktor.client.request.*
|
||||
import io.ktor.http.*
|
||||
import io.ktor.serialization.kotlinx.json.*
|
||||
import io.papermc.paper.command.brigadier.Commands
|
||||
import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager
|
||||
import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.buildJsonArray
|
||||
import net.kyori.adventure.text.Component
|
||||
import net.kyori.adventure.text.format.TextColor
|
||||
import org.bukkit.Server
|
||||
import org.bukkit.command.CommandExecutor
|
||||
import org.bukkit.command.PluginCommand
|
||||
@ -46,7 +54,7 @@ class Platinum : JavaPlugin() {
|
||||
hash = props.getProperty("gitCommit")
|
||||
logger.info("Loading Platinum v$version")
|
||||
if (version.contains("SNAPSHOT")) {
|
||||
logger.info("Git Commit: $hash")
|
||||
logger.info("Local Git Commit: $hash")
|
||||
}
|
||||
webClient = HttpClient(CIO) {
|
||||
install(ContentNegotiation) {
|
||||
@ -56,6 +64,24 @@ class Platinum : JavaPlugin() {
|
||||
agent = "https://git.jansel.moe/jreimers/Platinum v$version(jansel@jansel.moe)"
|
||||
}
|
||||
}
|
||||
if (version.contains("SNAPSHOT")) {
|
||||
logger.info("Getting remote Git Commit...")
|
||||
runBlocking {
|
||||
val res = webClient.get("https://git.jansel.moe/api/v1/") {
|
||||
url {
|
||||
path("repos/jreimers/platinum/commits?limit=1")
|
||||
}
|
||||
}
|
||||
val apires: List<CommitApiResponse> = res.body()
|
||||
logger.info("Remote hash: ${apires[0].sha}")
|
||||
if (apires[0].sha == hash) {
|
||||
componentLogger.info(Component.text("Commit Hashes match, ur on the latest snapshot version", TextColor.color(0,255,0)))
|
||||
} else {
|
||||
logger.info("Commit Hashes mismatch, either you\'re using a commit that isnt pushed yet or you\'re out of date")
|
||||
componentLogger.info(Component.text("Commit Hashes mismatch, either you\'re using a commit that isnt pushed yet or you\'re out of date", TextColor.color(255,0,0)))
|
||||
}
|
||||
}
|
||||
}
|
||||
Companion.server = server
|
||||
pluginManager = server.pluginManager
|
||||
instance = this
|
||||
@ -68,4 +94,9 @@ class Platinum : JavaPlugin() {
|
||||
private fun registerCommands() {
|
||||
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class CommitApiResponse(
|
||||
val sha: String
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user