chore: improve dev tasks

This commit is contained in:
sekwah 2023-12-03 14:19:57 +00:00 committed by Sekwah
parent 852221533f
commit 00ab7e4fec

View File

@ -186,6 +186,36 @@ task discordupload {
}
}
// This is used to download my plugin for helping reload the server in tandem with the copyPlugin task
tasks.register('downloadSekCDevToolsPlugin') {
doLast {
// Define the URL and destination path
def url = 'https://github.com/sekwah41/SekCDevToolsPlugin/releases/download/v1.0.0/SekCDevToolsPlugin-1.0-SNAPSHOT.jar'
def destinationDir = new File("$buildDir/MinecraftServer/plugins")
def destinationFile = new File(destinationDir, 'SekCDevToolsPlugin-1.0-SNAPSHOT.jar')
// Create the directory if it doesn't exist
if (!destinationDir.exists()) {
destinationDir.mkdirs()
}
// Download the file if it doesn't exist
if (!destinationFile.exists()) {
println "Downloading SekCDevToolsPlugin..."
new URL(url).withInputStream { i ->
destinationFile.withOutputStream {
it << i
}
}
} else {
println "SekCDevToolsPlugin already downloaded"
}
}
}
tasks.launchMinecraftServer.dependsOn(downloadSekCDevToolsPlugin)
minecraftServerConfig {
jarUrl.set('https://download.getbukkit.org/spigot/spigot-1.20.2.jar')
jvmArgument = ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", "-DIReallyKnowWhatIAmDoingISwear=true"]
@ -195,7 +225,11 @@ tasks.withType(Jar) {
duplicatesStrategy = DuplicatesStrategy.WARN
}
/**
* Will build then copy it to the minecraft server folder for use with the launch task and dev tools plugin
*/
task copyPlugin() {
dependsOn(build)
doLast {
copy {
println "$buildDir/libs/Advanced-Portals-${getVersion()}.jar"