|
|
@ -55,30 +55,28 @@ class CmdGenerate(private val chunkmaster: Chunkmaster): Subcommand {
|
|
|
|
if (args.size > 1) {
|
|
|
|
if (args.size > 1) {
|
|
|
|
if (args[1].toIntOrNull() != null) {
|
|
|
|
if (args[1].toIntOrNull() != null) {
|
|
|
|
stopAfter = args[1].toInt()
|
|
|
|
stopAfter = args[1].toInt()
|
|
|
|
} else if (args[1] in units) {
|
|
|
|
} else if (args[1] in units && args[0].toIntOrNull() != null) {
|
|
|
|
when (args[1]) {
|
|
|
|
stopAfter = getStopAfter(stopAfter, args[1])
|
|
|
|
"radius" -> {
|
|
|
|
|
|
|
|
stopAfter = ((stopAfter * 2)+1).toDouble().pow(2.0).toInt()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
"diameter" -> {
|
|
|
|
|
|
|
|
stopAfter = stopAfter.toDouble().pow(2.0).toInt()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
"blockradius" -> {
|
|
|
|
|
|
|
|
stopAfter = ((stopAfter*32)+1).toDouble().pow(2.0).toInt()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
worldName = args[1]
|
|
|
|
worldName = args[1]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (args.size > 2 && args[2] in units && args[1].toIntOrNull() != null) {
|
|
|
|
|
|
|
|
stopAfter = getStopAfter(stopAfter, args[2])
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
worldName = sender.world.name
|
|
|
|
worldName = sender.world.name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (args.isNotEmpty()) {
|
|
|
|
if (args.isNotEmpty()) {
|
|
|
|
worldName = args[0]
|
|
|
|
worldName = args[0]
|
|
|
|
if (args.size > 1 && args[1].toIntOrNull() != null) {
|
|
|
|
if (args.size > 1) {
|
|
|
|
stopAfter = args[1].toInt()
|
|
|
|
if (args[1].toIntOrNull() != null) {
|
|
|
|
|
|
|
|
stopAfter = args[1].toInt()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (args.size > 2 && args[2] in units) {
|
|
|
|
|
|
|
|
stopAfter = getStopAfter(stopAfter, args[2])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
sender.spigot().sendMessage(
|
|
|
|
sender.spigot().sendMessage(
|
|
|
@ -89,6 +87,27 @@ class CmdGenerate(private val chunkmaster: Chunkmaster): Subcommand {
|
|
|
|
return createTask(sender, worldName, stopAfter)
|
|
|
|
return createTask(sender, worldName, stopAfter)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Returns stopAfter for a given unit
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private fun getStopAfter(number: Int, unit: String): Int {
|
|
|
|
|
|
|
|
if (unit in units) {
|
|
|
|
|
|
|
|
return when (unit) {
|
|
|
|
|
|
|
|
"radius" -> {
|
|
|
|
|
|
|
|
((number * 2)+1).toDouble().pow(2.0).toInt()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
"diameter" -> {
|
|
|
|
|
|
|
|
number.toDouble().pow(2.0).toInt()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
"blockradius" -> {
|
|
|
|
|
|
|
|
((number*32)+1).toDouble().pow(2.0).toInt()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else -> number
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return number
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Creates the task with the given arguments.
|
|
|
|
* Creates the task with the given arguments.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|