forked from SteamWar/SteamWar
Add FightServer to configure those
This commit is contained in:
@@ -40,7 +40,9 @@ class DevServer extends DefaultTask {
|
||||
@Optional
|
||||
String jar = null
|
||||
|
||||
// Add Configs for FightServer!
|
||||
@Input
|
||||
@Optional
|
||||
Map<String, String> dParams = {}
|
||||
|
||||
DevServer() {
|
||||
super()
|
||||
@@ -131,6 +133,9 @@ class DevServer extends DefaultTask {
|
||||
if (worldName != null) devPy.append(" -w $template/$worldName")
|
||||
if (plugins != null) devPy.append(" -p $plugins")
|
||||
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()}")
|
||||
devPy.append(" $template")
|
||||
|
||||
@@ -161,4 +166,62 @@ class DevServer extends DefaultTask {
|
||||
processInput = null
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user