Remove volatile from HandlerList to improve event performance

This commit is contained in:
Sotr
2019-03-25 16:51:55 +08:00
parent de28a2ab0b
commit 45ef83a3a2
3 changed files with 235 additions and 2 deletions

View File

@@ -107,7 +107,7 @@ public class AkarinUserCache {
Runnable find = () -> profileRepo.findProfilesByNames(new String[] { keyUsername }, Agent.MINECRAFT, callbackHandler);
if (async) {
MCUtil.scheduleAsyncTask(find);
return null; // TODO: future
return null;
} else {
find.run();
return gameProfile[0];

View File

@@ -51,7 +51,7 @@ public final class MCUtil {
}
public static boolean isMainThread() {
return MinecraftServer.getServer().isMainThread();
return ThreadAssertion.isMainThread() && MinecraftServer.getServer().isMainThread(); // Akarin
}
private static class DelayedRunnable implements Runnable {