Commit fe2ff806 authored by Linus K.'s avatar Linus K.
Browse files

Bugfix

parent 1bc894e1
Pipeline #168 passed with stage
in 1 minute and 11 seconds
......@@ -10,15 +10,8 @@ class Plugin: JavaPlugin() {
override fun onEnable() {
try {
Signal.handle(Signal("USR2")) { signal: Signal ->
val pl = Bukkit.getPluginManager().getPlugin(name);
if(pl == null) {
println("[$name] Cannot get plugin instance!")
return@handle
}
Bukkit.getScheduler().scheduleSyncDelayedTask(pl) {
println("[$name] Got signal ${signal.name} ({$signal.number}). Executing /stop from console...")
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "stop")
};
println("[$name] Got signal ${signal.name} ({$signal.number}). Executing /stop from console...")
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