Files
playit-minecraft-plugin/build.gradle
T
Patrick LorioandGitHub 87dfaec9f7 Upgrade to new protocol (#33)
* New API and upgrade control to new proto

* Rename api2 to api

* Add not null and get proto version 2 working

* Fix bugs

* update deps

* Connect over MC server and use pipeline to set true IP

* fix claim url and format code
2026-02-19 12:45:36 -08:00

100 lines
2.8 KiB
Groovy

plugins {
id 'java'
id 'application'
id 'com.gradleup.shadow' version '9.0.0'
}
group = 'gg.playit.gg'
version = '0.2.0'
def playitConstantsFile = file("src/main/java/gg/playit/minecraft/PlayitConstants.java")
tasks.register('generatePlayitConstants') {
def versionStr = project.version.toString()
def baseVersion = versionStr.split('-')[0]
def parts = baseVersion.split('\\.')
def major = parts.length > 0 ? (parts[0].replaceAll('[^0-9]', '') ?: '0') : '0'
def minor = parts.length > 1 ? (parts[1].replaceAll('[^0-9]', '') ?: '0') : '0'
def patch = parts.length > 2 ? (parts[2].replaceAll('[^0-9].*', '') ?: '0') : '0'
outputs.file(playitConstantsFile)
doLast {
playitConstantsFile.text = """package gg.playit.minecraft;
import gg.playit.api.model.request.AgentVersion;
/** Generated by build - version is injected from build.gradle. */
public final class PlayitConstants {
private PlayitConstants() {}
public static final AgentVersion MINECRAFT_AGENT_VERSION =
new AgentVersion("f4e73f52-f35c-4f18-9ab2-3aaa5c4488c1", ${major}, ${minor}, ${patch});
/** Version string for ReqClaimSetup (e.g. "0.2.0") */
public static final String VERSION_STRING = "${versionStr}";
}
"""
}
}
compileJava.dependsOn generatePlayitConstants
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
processResources {
expand(version: project.version)
}
application {
mainClass = 'gg.playit.api.example.ApiExample'
}
tasks.register('runApiExample', JavaExec) {
group = 'application'
description = 'Run the API example'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'gg.playit.api.example.ApiExample'
}
tasks.register('runControlExample', JavaExec) {
group = 'application'
description = 'Run the control channel example'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'gg.playit.control.example.ControlExample'
}
repositories {
mavenCentral()
maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/public/' }
maven { url = 'https://repo.dmulloy2.net/repository/public/' }
}
jar {
enabled = false
}
dependencies {
implementation 'jakarta.validation:jakarta.validation-api:3.0.2'
implementation 'commons-io:commons-io:2.11.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.0-rc1'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.0-rc1'
compileOnly 'io.netty:netty-all:4.1.82.Final'
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
}
shadowJar {
archiveBaseName.set('playit-minecraft-plugin')
archiveClassifier.set('')
archiveVersion.set(project.version as String)
exclude('META-INF/LICENSE*')
exclude('META-INF/NOTICE*')
}
build.dependsOn shadowJar