3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-17 00:20:09 +01:00

mark folia todos

Dieser Commit ist enthalten in:
SirYwell 2024-01-27 16:34:31 +01:00
Ursprung ac83bb500e
Commit 4608c8e485
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
18 geänderte Dateien mit 25 neuen und 35 gelöschten Zeilen

Datei anzeigen

@ -242,13 +242,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
int y = location.getBlockY(); int y = location.getBlockY();
int z = location.getBlockZ(); int z = location.getBlockZ();
final ServerLevel handle = getServerLevel(location.getWorld()); final ServerLevel handle = getServerLevel(location.getWorld());
LevelChunk chunk; LevelChunk chunk = handle.getChunk(x >> 4, z >> 4);
if (Fawe.isTickThread()) {
// TODO check if is owned by this thread, else synchronize
chunk = handle.getChunk(x >> 4, z >> 4);
} else {
chunk = TaskManager.taskManager().syncAt(() -> handle.getChunk(x >> 4, z >> 4), BukkitAdapter.adapt(location));
}
final BlockPos blockPos = new BlockPos(x, y, z); final BlockPos blockPos = new BlockPos(x, y, z);
final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos);
BlockState state = adapt(blockData); BlockState state = adapt(blockData);

Datei anzeigen

@ -57,7 +57,6 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
this.level = level; this.level = level;
// Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging. // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging.
// - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway. // - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway.
// TODO
this.lastTick = new AtomicInteger(); this.lastTick = new AtomicInteger();
if (!FoliaSupport.isFolia()) { if (!FoliaSupport.isFolia()) {
this.lastTick.set(Bukkit.getCurrentTick()); this.lastTick.set(Bukkit.getCurrentTick());
@ -66,7 +65,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
cachedChange -> new IntPair(cachedChange.blockPos.getX() >> 4, cachedChange.blockPos.getZ() >> 4), cachedChange -> new IntPair(cachedChange.blockPos.getX() >> 4, cachedChange.blockPos.getZ() >> 4),
HashSet::new, HashSet::new,
(chunk, changes) -> { (chunk, changes) -> {
// TODO only send chunks based on ticks? Need to make sure everything actually flushed in the end // TODO (folia) only send chunks based on ticks? Need to make sure everything actually flushed in the end
/*boolean nextTick = true; /*boolean nextTick = true;
if (!FoliaSupport.isFolia()) { if (!FoliaSupport.isFolia()) {
int currentTick = MinecraftServer.currentTick; int currentTick = MinecraftServer.currentTick;

Datei anzeigen

@ -65,7 +65,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
cachedChange -> new IntPair(cachedChange.blockPos.getX() >> 4, cachedChange.blockPos.getZ() >> 4), cachedChange -> new IntPair(cachedChange.blockPos.getX() >> 4, cachedChange.blockPos.getZ() >> 4),
HashSet::new, HashSet::new,
(chunk, changes) -> { (chunk, changes) -> {
// TODO only send chunks based on ticks? Need to make sure everything actually flushed in the end // TODO (folia) only send chunks based on ticks? Need to make sure everything actually flushed in the end
/*boolean nextTick = true; /*boolean nextTick = true;
if (!FoliaSupport.isFolia()) { if (!FoliaSupport.isFolia()) {
int currentTick = MinecraftServer.currentTick; int currentTick = MinecraftServer.currentTick;

Datei anzeigen

@ -65,7 +65,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess<Level
cachedChange -> new IntPair(cachedChange.blockPos.getX() >> 4, cachedChange.blockPos.getZ() >> 4), cachedChange -> new IntPair(cachedChange.blockPos.getX() >> 4, cachedChange.blockPos.getZ() >> 4),
HashSet::new, HashSet::new,
(chunk, changes) -> { (chunk, changes) -> {
// TODO only send chunks based on ticks? Need to make sure everything actually flushed in the end // TODO (folia) only send chunks based on ticks? Need to make sure everything actually flushed in the end
/*boolean nextTick = true; /*boolean nextTick = true;
if (!FoliaSupport.isFolia()) { if (!FoliaSupport.isFolia()) {
int currentTick = MinecraftServer.currentTick; int currentTick = MinecraftServer.currentTick;

Datei anzeigen

@ -93,7 +93,7 @@ public class FaweBukkit implements IFawe, Listener {
//PlotSquared support is limited to Spigot/Paper as of 02/20/2020 //PlotSquared support is limited to Spigot/Paper as of 02/20/2020
TaskManager.taskManager().taskGlobal(this::setupPlotSquared); TaskManager.taskManager().taskGlobal(this::setupPlotSquared);
// TODO moved out of task below?? // TODO (folia) moved out of task below??
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin); Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
// Registered delayed Event Listeners // Registered delayed Event Listeners
/*TaskManager.taskManager().task(() -> { /*TaskManager.taskManager().task(() -> {

Datei anzeigen

@ -76,7 +76,7 @@ public class FaweDelegateRegionManager {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (whenDone != null) { if (whenDone != null) {
// TODO // TODO (folia)
// TaskManager.taskManager().task(whenDone, new com.sk89q.worldedit.util.Location(world, )); // TaskManager.taskManager().task(whenDone, new com.sk89q.worldedit.util.Location(world, ));
} }
} }
@ -204,7 +204,7 @@ public class FaweDelegateRegionManager {
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE) RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE)
); );
if (whenDone != null) { if (whenDone != null) {
// TODO // TODO (folia)
// TaskManager.taskManager().task(whenDone); // TaskManager.taskManager().task(whenDone);
} }
} }
@ -274,7 +274,7 @@ public class FaweDelegateRegionManager {
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE) RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE)
); );
if (whenDone != null) { if (whenDone != null) {
// TODO // TODO (folia)
// TaskManager.taskManager().task(whenDone); // TaskManager.taskManager().task(whenDone);
} }
} }
@ -304,7 +304,7 @@ public class FaweDelegateRegionManager {
e.printStackTrace(); e.printStackTrace();
} }
if (whenDone != null) { if (whenDone != null) {
// TODO // TODO (folia)
// TaskManager.taskManager().task(whenDone); // TaskManager.taskManager().task(whenDone);
} }
} }
@ -358,7 +358,7 @@ public class FaweDelegateRegionManager {
} }
} }
if (whenDone != null) { if (whenDone != null) {
// TODO // TODO (folia)
// TaskManager.taskManager().task(whenDone); // TaskManager.taskManager().task(whenDone);
} }
}); });
@ -383,7 +383,7 @@ public class FaweDelegateRegionManager {
editSession.flushQueue(); editSession.flushQueue();
} }
if (whenDone != null) { if (whenDone != null) {
// TODO // TODO (folia)
// TaskManager.taskManager().task(whenDone); // TaskManager.taskManager().task(whenDone);
} }
} }

Datei anzeigen

@ -68,8 +68,6 @@ public class BukkitTaskManager extends TaskManager {
} }
} }
// TODO
@Override @Override
public <T> T syncAt(final Supplier<T> supplier, final World world, final int chunkX, final int chunkZ) { public <T> T syncAt(final Supplier<T> supplier, final World world, final int chunkX, final int chunkZ) {
return sync(supplier); return sync(supplier);
@ -90,7 +88,7 @@ public class BukkitTaskManager extends TaskManager {
return supplier.get(); return supplier.get();
} }
try { try {
// TODO // TODO (folia)
return Fawe.instance().getQueueHandler().sync(supplier).get(); return Fawe.instance().getQueueHandler().sync(supplier).get();
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e); throw new RuntimeException(e);

Datei anzeigen

@ -37,7 +37,7 @@ public class FoliaTaskManager extends TaskManager {
@Override @Override
public int repeatAsync(@NotNull final Runnable runnable, final int interval) { public int repeatAsync(@NotNull final Runnable runnable, final int interval) {
// TODO return some kind of own ScheduledTask instead of int // TODO (folia) return some kind of own ScheduledTask instead of int
Bukkit.getAsyncScheduler().runAtFixedRate( Bukkit.getAsyncScheduler().runAtFixedRate(
WorldEditPlugin.getInstance(), WorldEditPlugin.getInstance(),
asConsumer(runnable), asConsumer(runnable),
@ -147,7 +147,6 @@ public class FoliaTaskManager extends TaskManager {
@Override @Override
public <T> T syncGlobal(final Supplier<T> supplier) { public <T> T syncGlobal(final Supplier<T> supplier) {
// TODO avoid deadlocks (Bukkit.isGlobalTickThread not available at time of writing)
if (isGlobalTickThread()) { if (isGlobalTickThread()) {
return supplier.get(); return supplier.get();
} }

Datei anzeigen

@ -254,7 +254,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
player.sendMessage("Teleportation failed"); player.sendMessage("Teleportation failed");
} }
}); });
return true; // TODO this might not be correct return true; // TODO (folia) this might not be correct
} }
return TaskManager.taskManager().syncWith(() -> teleport.get().join(), this); return TaskManager.taskManager().syncWith(() -> teleport.get().join(), this);
//FAWE end //FAWE end

Datei anzeigen

@ -147,7 +147,7 @@ public class BukkitWorld extends AbstractWorld {
public List<com.sk89q.worldedit.entity.Entity> getEntities(Region region) { public List<com.sk89q.worldedit.entity.Entity> getEntities(Region region) {
World world = getWorld(); World world = getWorld();
List<Entity> ents = List.of(); // TODO TaskManager.taskManager().sync(world::getEntities); List<Entity> ents = List.of(); // TODO (folia) TaskManager.taskManager().sync(world::getEntities);
List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>(); List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>();
for (Entity ent : ents) { for (Entity ent : ents) {
if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) { if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) {

Datei anzeigen

@ -138,7 +138,7 @@ public class Fawe {
}, 1); }, 1);
if (!FoliaSupport.isFolia()) { if (!FoliaSupport.isFolia()) {
// TODO TaskManager.taskManager().repeat(timer, 1); // TODO (folia) TaskManager.taskManager().repeat(timer, 1);
} }
clipboardExecutor = new KeyQueuedExecutorService<>(new ThreadPoolExecutor( clipboardExecutor = new KeyQueuedExecutorService<>(new ThreadPoolExecutor(

Datei anzeigen

@ -26,7 +26,7 @@ public class LazyBaseEntity extends BaseEntity {
if (Fawe.isMainThread()) { if (Fawe.isMainThread()) {
setNbt(tmp.get()); setNbt(tmp.get());
} else { } else {
// TODO folia // TODO (folia)
// setNbt(TaskManager.taskManager().sync(tmp)); // setNbt(TaskManager.taskManager().sync(tmp));
} }
} }

Datei anzeigen

@ -91,7 +91,7 @@ public abstract class QueueHandler implements Trimable, Runnable {
private long allocate = 50; private long allocate = 50;
protected QueueHandler() { protected QueueHandler() {
// TODO make main thread independent // TODO (folia) make main thread independent
// TaskManager.taskManager().repeat(this, 1); // TaskManager.taskManager().repeat(this, 1);
} }

Datei anzeigen

@ -92,7 +92,7 @@ public class DefaultProgressTracker implements BiConsumer<DefaultProgressTracker
} }
private void done() { private void done() {
// TODO // TODO (folia)
// TaskManager.taskManager().task(this::doneTask); // TaskManager.taskManager().task(this::doneTask);
} }
@ -100,7 +100,7 @@ public class DefaultProgressTracker implements BiConsumer<DefaultProgressTracker
private void send() { private void send() {
// Run on main thread // Run on main thread
// TODO // TODO (folia)
// TaskManager.taskManager().task(this::sendTask); // TaskManager.taskManager().task(this::sendTask);
} }

Datei anzeigen

@ -701,7 +701,7 @@ public class UtilityCommands {
//FAWE start - run this sync //FAWE start - run this sync
int finalRadius = radius; int finalRadius = radius;
int killed; int killed;
// TODO location context might be somewhere else actually // TODO (folia) location context might be somewhere else actually
if (actor instanceof Player player) { if (actor instanceof Player player) {
killed = TaskManager.taskManager().syncWith( killed = TaskManager.taskManager().syncWith(
() -> killMatchingEntities(finalRadius, actor, flags::createFunction), () -> killMatchingEntities(finalRadius, actor, flags::createFunction),
@ -742,7 +742,7 @@ public class UtilityCommands {
//FAWE start - run this sync //FAWE start - run this sync
int removed = 0; int removed = 0;
// TODO location context might be somewhere else actually // TODO (folia) location context might be somewhere else actually
// removed = TaskManager.taskManager().sync(() -> killMatchingEntities(radius, actor, remover::createFunction)); // removed = TaskManager.taskManager().sync(() -> killMatchingEntities(radius, actor, remover::createFunction));
//FAWE end //FAWE end
actor.print(Caption.of("worldedit.remove.removed", TextComponent.of(removed))); actor.print(Caption.of("worldedit.remove.removed", TextComponent.of(removed)));

Datei anzeigen

@ -108,7 +108,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
if (async) { if (async) {
asyncNotifyQueue.run(wrapped); asyncNotifyQueue.run(wrapped);
} else { } else {
// TODO folia // TODO (folia)
// TaskManager.taskManager().taskNow(wrapped, false); // TaskManager.taskManager().taskNow(wrapped, false);
} }
return true; return true;

Datei anzeigen

@ -676,7 +676,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
if (async) { if (async) {
asyncNotifyQueue.run(wrapped); asyncNotifyQueue.run(wrapped);
} else { } else {
// TODO folia // TODO (folia)
// TaskManager.taskManager().taskNow(wrapped, false); // TaskManager.taskManager().taskNow(wrapped, false);
} }
return true; return true;

Datei anzeigen

@ -690,7 +690,7 @@ public final class PlatformCommandManager {
if (actor instanceof Player player) { if (actor instanceof Player player) {
TaskManager.taskManager().task(() -> handleCommandOnCurrentThread(event), player.getLocation()); TaskManager.taskManager().task(() -> handleCommandOnCurrentThread(event), player.getLocation());
} else { } else {
// TODO folia // TODO (folia)
} }
return; return;
} else { } else {