c593e8510e
Log when the async catcher is tripped The chunk system can swallow the exception given it's all built with completablefuture, so ensure it is at least printed. Add/move several async catchers Async catch modifications to critical entity state These used to be here from Spigot, but were dropped with 1.17. Now in 1.17, this state is _even more_ critical than it was before, so these must exist to catch stupid plugins. Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
19 lines
561 B
Java
19 lines
561 B
Java
package org.spigotmc;
|
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
public class AsyncCatcher
|
|
{
|
|
|
|
public static boolean enabled = true;
|
|
|
|
public static void catchOp(String reason)
|
|
{
|
|
if ( AsyncCatcher.enabled && Thread.currentThread() != MinecraftServer.getServer().serverThread )
|
|
{
|
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); // Paper
|
|
throw new IllegalStateException( "Asynchronous " + reason + "!" );
|
|
}
|
|
}
|
|
}
|