Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-17 00:20:09 +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.chunk.SingleValuePalette;
|
||||||
import net.minecraft.world.level.entity.PersistentEntitySectionManager;
|
import net.minecraft.world.level.entity.PersistentEntitySectionManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_19_R3.CraftChunk;
|
import org.bukkit.craftbukkit.v1_19_R3.CraftChunk;
|
||||||
import sun.misc.Unsafe;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -283,7 +283,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
|||||||
} catch (TimeoutException e) {
|
} catch (TimeoutException e) {
|
||||||
String world = serverLevel.getWorld().getName();
|
String world = serverLevel.getWorld().getName();
|
||||||
// We've already taken 10 seconds we can afford to wait a little here.
|
// 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) {
|
if (loaded) {
|
||||||
LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world);
|
LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world);
|
||||||
// Retry chunk load
|
// 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.chunk.SingleValuePalette;
|
||||||
import net.minecraft.world.level.entity.PersistentEntitySectionManager;
|
import net.minecraft.world.level.entity.PersistentEntitySectionManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_20_R1.CraftChunk;
|
import org.bukkit.craftbukkit.v1_20_R1.CraftChunk;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -309,7 +310,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
|||||||
} catch (TimeoutException e) {
|
} catch (TimeoutException e) {
|
||||||
String world = serverLevel.getWorld().getName();
|
String world = serverLevel.getWorld().getName();
|
||||||
// We've already taken 10 seconds we can afford to wait a little here.
|
// 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) {
|
if (loaded) {
|
||||||
LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world);
|
LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world);
|
||||||
// Retry chunk load
|
// Retry chunk load
|
||||||
|
@ -48,6 +48,11 @@ public class BukkitTaskManager extends TaskManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void later(@NotNull final Runnable runnable, final Location location, final int delay) {
|
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);
|
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
|
@Override
|
||||||
public void laterAsync(@NotNull final Runnable runnable, final int delay) {
|
public void laterAsync(@NotNull final Runnable runnable, final int delay) {
|
||||||
Bukkit.getAsyncScheduler().runDelayed(
|
Bukkit.getAsyncScheduler().runDelayed(
|
||||||
|
@ -130,13 +130,12 @@ public class Fawe {
|
|||||||
this.timer = new FaweTimer();
|
this.timer = new FaweTimer();
|
||||||
|
|
||||||
// Delayed worldedit setup
|
// Delayed worldedit setup
|
||||||
// TODO support again
|
TaskManager.taskManager().laterGlobal(() -> {
|
||||||
/*TaskManager.taskManager().later(() -> {
|
|
||||||
try {
|
try {
|
||||||
WEManager.weManager().addManagers(Fawe.this.implementation.getMaskManagers());
|
WEManager.weManager().addManagers(Fawe.this.implementation.getMaskManagers());
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
}, 0);*/
|
}, 0);
|
||||||
|
|
||||||
if (!FoliaSupport.isFolia()) {
|
if (!FoliaSupport.isFolia()) {
|
||||||
// TODO TaskManager.taskManager().repeat(timer, 1);
|
// 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 runnable the task to run
|
||||||
* @param location the location context to run at
|
* @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);
|
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.
|
* Run a task later asynchronously.
|
||||||
*
|
*
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren