Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-16 16:10:07 +01:00
align adapters
Dieser Commit ist enthalten in:
Ursprung
fbe69bdc81
Commit
c0903e71f7
@ -58,8 +58,8 @@ import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import net.minecraft.world.level.chunk.SingleValuePalette;
|
||||
import net.minecraft.world.level.entity.PersistentEntitySectionManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_19_R3.CraftChunk;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@ -283,7 +283,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
} catch (TimeoutException e) {
|
||||
String world = serverLevel.getWorld().getName();
|
||||
// We've already taken 10 seconds we can afford to wait a little here.
|
||||
boolean loaded = false; // TODO TaskManager.taskManager().sync(() -> Bukkit.getWorld(world) != null);
|
||||
boolean loaded = TaskManager.taskManager().syncGlobal(() -> Bukkit.getWorld(world) != null);
|
||||
if (loaded) {
|
||||
LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world);
|
||||
// Retry chunk load
|
||||
|
@ -63,6 +63,7 @@ import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import net.minecraft.world.level.chunk.SingleValuePalette;
|
||||
import net.minecraft.world.level.entity.PersistentEntitySectionManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.CraftChunk;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -309,7 +310,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
} catch (TimeoutException e) {
|
||||
String world = serverLevel.getWorld().getName();
|
||||
// We've already taken 10 seconds we can afford to wait a little here.
|
||||
boolean loaded = false; // TODO TaskManager.taskManager().sync(() -> Bukkit.getWorld(world) != null);
|
||||
boolean loaded = TaskManager.taskManager().syncGlobal(() -> Bukkit.getWorld(world) != null);
|
||||
if (loaded) {
|
||||
LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world);
|
||||
// Retry chunk load
|
||||
|
@ -48,6 +48,11 @@ public class BukkitTaskManager extends TaskManager {
|
||||
|
||||
@Override
|
||||
public void later(@NotNull final Runnable runnable, final Location location, final int delay) {
|
||||
laterGlobal(runnable, delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void laterGlobal(@NotNull final Runnable runnable, final int delay) {
|
||||
this.plugin.getServer().getScheduler().runTaskLater(this.plugin, runnable, delay);
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,15 @@ public class FoliaTaskManager extends TaskManager {
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void laterGlobal(@NotNull final Runnable runnable, final int delay) {
|
||||
Bukkit.getGlobalRegionScheduler().runDelayed(
|
||||
WorldEditPlugin.getInstance(),
|
||||
asConsumer(runnable),
|
||||
delay
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void laterAsync(@NotNull final Runnable runnable, final int delay) {
|
||||
Bukkit.getAsyncScheduler().runDelayed(
|
||||
|
@ -130,13 +130,12 @@ public class Fawe {
|
||||
this.timer = new FaweTimer();
|
||||
|
||||
// Delayed worldedit setup
|
||||
// TODO support again
|
||||
/*TaskManager.taskManager().later(() -> {
|
||||
TaskManager.taskManager().laterGlobal(() -> {
|
||||
try {
|
||||
WEManager.weManager().addManagers(Fawe.this.implementation.getMaskManagers());
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}, 0);*/
|
||||
}, 0);
|
||||
|
||||
if (!FoliaSupport.isFolia()) {
|
||||
// TODO TaskManager.taskManager().repeat(timer, 1);
|
||||
|
@ -170,7 +170,7 @@ public abstract class TaskManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a task later on the main thread.
|
||||
* Run a task later on the ticking thread at the given location.
|
||||
*
|
||||
* @param runnable the task to run
|
||||
* @param location the location context to run at
|
||||
@ -178,6 +178,14 @@ public abstract class TaskManager {
|
||||
*/
|
||||
public abstract void later(@Nonnull final Runnable runnable, Location location, final int delay);
|
||||
|
||||
/**
|
||||
* Run a task later on the global tick thread.
|
||||
*
|
||||
* @param runnable the task to run
|
||||
* @param delay in ticks
|
||||
*/
|
||||
public abstract void laterGlobal(@Nonnull final Runnable runnable, final int delay);
|
||||
|
||||
/**
|
||||
* Run a task later asynchronously.
|
||||
*
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren