pref: add velocity-plugin.json

This commit is contained in:
thehrz 2025-02-05 17:55:32 +08:00
parent 889313a734
commit 49440ddc0a
Signed by: thehrz
GPG Key ID: C84CBCE7D5F88855
4 changed files with 13 additions and 30 deletions

View File

@ -1,12 +1,7 @@
import org.jetbrains.gradle.ext.settings
import org.jetbrains.gradle.ext.taskTriggers
plugins {
kotlin("jvm") version "2.0.20-Beta1"
kotlin("kapt") version "2.0.20-Beta1"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("eclipse")
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.8"
}
group = "io.github.thehrz"
@ -39,18 +34,11 @@ tasks.build {
dependsOn("shadowJar")
}
val templateSource = file("src/main/templates")
val templateDest = layout.buildDirectory.dir("generated/sources/templates")
val generateTemplates = tasks.register<Copy>("generateTemplates") {
val props = mapOf("version" to project.version)
tasks.processResources {
val props = mapOf("version" to version)
inputs.properties(props)
from(templateSource)
into(templateDest)
expand(props)
filteringCharset = "UTF-8"
filesMatching("velocity-plugin.json") {
expand(props)
}
}
sourceSets.main.configure { java.srcDir(generateTemplates.map { it.outputs }) }
project.idea.project.settings.taskTriggers.afterSync(generateTemplates)
project.eclipse.synchronizationTasks(generateTemplates)

View File

@ -4,7 +4,6 @@ import com.google.inject.Inject
import com.moandjiezana.toml.Toml
import com.velocitypowered.api.event.Subscribe
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent
import com.velocitypowered.api.plugin.Plugin
import com.velocitypowered.api.plugin.annotation.DataDirectory
import com.velocitypowered.api.proxy.ProxyServer
import io.github.thehrz.proxyServerHelper.listeners.PlayerDisconnectListener
@ -14,10 +13,6 @@ import org.slf4j.Logger
import java.nio.file.Files
import java.nio.file.Path
@Plugin(
id = "proxyserverhelper", name = "ProxyServerHelper", version = BuildConstants.VERSION, authors = ["thehrz"]
)
class ProxyServerHelper @Inject constructor(
val server: ProxyServer,
val logger: Logger,

View File

@ -0,0 +1,7 @@
{
"id": "proxyserverhelper",
"name": "ProxyServerHelper",
"version": "${version}",
"authors": ["thehrz"],
"main": "io.github.thehrz.proxyServerHelper.ProxyServerHelper"
}

View File

@ -1,7 +0,0 @@
package io.github.thehrz.proxyServerHelper;
// The constants are replaced before compilation
public class BuildConstants {
public static final String VERSION = "${version}";
}