Add FightServer to configure those

This commit is contained in:
2025-04-18 08:20:59 +02:00
parent 76e00b07db
commit 86ff619548
+64 -1
View File
@@ -40,7 +40,9 @@ class DevServer extends DefaultTask {
@Optional @Optional
String jar = null String jar = null
// Add Configs for FightServer! @Input
@Optional
Map<String, String> dParams = {}
DevServer() { DevServer() {
super() super()
@@ -131,6 +133,9 @@ class DevServer extends DefaultTask {
if (worldName != null) devPy.append(" -w $template/$worldName") if (worldName != null) devPy.append(" -w $template/$worldName")
if (plugins != null) devPy.append(" -p $plugins") if (plugins != null) devPy.append(" -p $plugins")
if (jar != null) devPy.append(" --jar $jar") if (jar != null) devPy.append(" --jar $jar")
for (Map.Entry<String, String> dParam : dParams.entrySet()) {
devPy.append("-D${dParam.key}=${dParam.value}")
}
println("Starting $template with command ${devPy.toString()}") println("Starting $template with command ${devPy.toString()}")
devPy.append(" $template") devPy.append(" $template")
@@ -161,4 +166,62 @@ class DevServer extends DefaultTask {
processInput = null processInput = null
running = false running = false
} }
}
class FightServer extends DevServer {
@Input
@Optional
int checkSchemID = 0
@Input
@Optional
int prepareSchemID = 0
@Input
@Optional
int replay = 0
@Input
@Optional
String config = null
@Input
@Optional
// Property: fightID
int eventKampfID = 0
@Input
@Optional
UUID blueLeader = null
@Input
@Optional
UUID redLeader = null
FightServer() {
super()
doFirst {
{
int count = 0
if (checkSchemID != 0) count++
if (prepareSchemID != 0) count++
if (replay != 0) count++
if (eventKampfID != 0) count++
if (count > 1) {
throw new GradleException("You can only set one of 'checkSchemID', 'prepareSchemID', 'replay' and 'eventKampfID'")
}
if (checkSchemID != 0) dParams.put("checkSchemID", "$checkSchemID")
if (prepareSchemID != 0) dParams.put("prepareSchemID", "$prepareSchemID")
if (replay != 0) dParams.put("replay", "$replay")
if (eventKampfID != 0) dParams.put("fightID", "$eventKampfID")
}
if (blueLeader != null && redLeader == null || blueLeader == null && redLeader != null) {
logger.log(LogLevel.WARN, "Please provide both a blue and a red leader. If this is intended ignore this message!")
}
if (blueLeader != null) dParams.put("blueLeader", blueLeader.toString())
if (redLeader != null) dParams.put("redLeader", redLeader.toString())
if (config != null) dParams.put("config", config)
}
}
} }