public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -1623,8 +1624,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
long i = Util.getNanos();
int j = this.pauseWhileEmptySeconds() * 20;
+ this.removeDisabledPluginsBlockingSleep(); // Paper - API to allow/disallow tick sleeping
if (j > 0) {
- if (this.playerList.getPlayerCount() == 0 && !this.tickRateManager.isSprinting()) {
+ if (this.playerList.getPlayerCount() == 0 && !this.tickRateManager.isSprinting() && this.pluginsBlockingSleep.isEmpty()) { // Paper - API to allow/disallow tick sleeping
++this.emptyTicks;
} else {
this.emptyTicks = 0;
@@ -3191,5 +3193,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa