Dieser Commit ist enthalten in:
Ursprung
368195bed2
Commit
297791ec60
@ -143,7 +143,7 @@ public class Core extends JavaPlugin{
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
TinyProtocol.instance.close();
|
TinyProtocol.instance.close();
|
||||||
errorHandler.unregister();
|
errorHandler.unregister();
|
||||||
if(!standalone) {
|
if(!standalone && crashDetector.onMainThread()) {
|
||||||
Statement.close();
|
Statement.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.core;
|
package de.steamwar.core;
|
||||||
|
|
||||||
import de.steamwar.sql.SWException;
|
import de.steamwar.sql.SWException;
|
||||||
|
import de.steamwar.sql.Statement;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -47,6 +48,10 @@ public class CrashDetector {
|
|||||||
watchdog.interrupt();
|
watchdog.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean onMainThread() {
|
||||||
|
return Thread.currentThread() == mainThread;
|
||||||
|
}
|
||||||
|
|
||||||
private void run() {
|
private void run() {
|
||||||
while (run) {
|
while (run) {
|
||||||
long curTime = System.currentTimeMillis();
|
long curTime = System.currentTimeMillis();
|
||||||
@ -58,6 +63,7 @@ public class CrashDetector {
|
|||||||
if(Core.getInstance().isEnabled()) {
|
if(Core.getInstance().isEnabled()) {
|
||||||
Core.getInstance().onDisable();
|
Core.getInstance().onDisable();
|
||||||
}
|
}
|
||||||
|
Statement.close();
|
||||||
//System.exit(0); Does freeze, potential freezing issues: ConsoleRestoreHook, ApplicationShutdownHooks or DeleteOnExitHook
|
//System.exit(0); Does freeze, potential freezing issues: ConsoleRestoreHook, ApplicationShutdownHooks or DeleteOnExitHook
|
||||||
Runtime.getRuntime().halt(0);
|
Runtime.getRuntime().halt(0);
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren