You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
Kotlin
37 lines
1.2 KiB
Kotlin
package net.trivernis.chunkmaster.commands
|
|
|
|
import net.md_5.bungee.api.ChatColor
|
|
import net.md_5.bungee.api.chat.ComponentBuilder
|
|
import net.trivernis.chunkmaster.Chunkmaster
|
|
import net.trivernis.chunkmaster.lib.Subcommand
|
|
import org.bukkit.command.Command
|
|
import org.bukkit.command.CommandSender
|
|
|
|
class CmdPause(private val chunkmaster: Chunkmaster) : Subcommand {
|
|
override val name: String = "pause"
|
|
|
|
override fun onTabComplete(
|
|
sender: CommandSender,
|
|
command: Command,
|
|
alias: String,
|
|
args: List<String>
|
|
): MutableList<String> {
|
|
return emptyList<String>().toMutableList()
|
|
}
|
|
|
|
override fun execute(sender: CommandSender, args: List<String>): Boolean {
|
|
return if (!chunkmaster.generationManager.paused) {
|
|
chunkmaster.generationManager.pauseAll()
|
|
sender.spigot().sendMessage(
|
|
*ComponentBuilder("Paused all generation tasks.")
|
|
.color(ChatColor.BLUE).create()
|
|
)
|
|
true
|
|
} else {
|
|
sender.spigot().sendMessage(
|
|
*ComponentBuilder("The generation process is already paused.").color(ChatColor.RED).create()
|
|
)
|
|
false
|
|
}
|
|
}
|
|
} |