Revert "Add AsyncDetector util."

This reverts commit 42f868a9


Former-commit-id: b84e7357be9c8333c3aa9d244bd6c4b2de37818e [formerly e22c8edfe2097d801568e2d5dc0249b633b8bc9a]
Former-commit-id: 837665c221d3ca66859caa977ba905de79c6a94d
This commit is contained in:
Ghost_chu committed 2019-12-01 08:56:34 +08:00
1 parent 415e633d96
commit ef39a03f9a
1 file changed
-21
@@ -1,21 +0,0 @@
package org.maxgamer.quickshop.Util;
import org.maxgamer.quickshop.QuickShop;
public class AsyncDetector {
/**
* A helper to allow quickshop check the task is running under async thread.
* @return The calling method running under async thread.
*/
public static boolean isAsync() {
try {
Object serverInstance = Util.getNMSClass(null).getMethod("getServer").invoke(null);
Object serverThread = serverInstance.getClass().getField("serverThread");
return Thread.currentThread() != serverThread;
}catch (Throwable throwable){
QuickShop.instance.getLogger().warning("Failed to get Minecraft server instance, did you up-to-date the QuickShop?");
return false;
}
}
}