Commit 55ce1251 authored by Linus K.'s avatar Linus K.
Browse files

Bugfix 3

parent 667ff382
Pipeline #170 passed with stage
in 1 minute and 11 seconds
......@@ -10,8 +10,16 @@ class Plugin: JavaPlugin() {
override fun onEnable() {
try {
Signal.handle(Signal("USR2")) { signal: Signal ->
println("[$name] Got signal ${} ({$signal.number}). Executing /stop from console...")
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "stop")
println("[$name] Got signal ${} ({$signal.number})")
val pl = Bukkit.getPluginManager().getPlugin(name);
if(pl == null) {
println("[$name] Failed to find plugin instance. Can't execute /stop command!")
println("[$name] Executing /stop from console...")
Bukkit.getScheduler().scheduleSyncDelayedTask(pl) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "stop")
}catch (ex: IllegalArgumentException) {
println("[$name] Failed to register signal handler for USR2. This might not be a problem if this plugin was previously loaded.")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment