mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 04:46:40 +00:00
Update to PlotSquared-we branch
This commit is contained in:
@ -7,6 +7,7 @@ import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.generator.GenBase;
|
||||
import com.sk89q.worldedit.function.generator.Resource;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -699,7 +700,7 @@ public class DelegateFilterBlock extends FilterBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockArrayClipboard lazyCopy(Region region) {
|
||||
public Clipboard lazyCopy(Region region) {
|
||||
return parent.lazyCopy(region);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import com.boydti.fawe.beta.IBatchProcessor;
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
|
||||
public class BatchProcessorHolder implements IBatchProcessorHolder {
|
||||
private IBatchProcessor processor = EmptyBatchProcessor.INSTANCE;
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.boydti.fawe.beta.implementation.processors;
|
||||
|
||||
import com.boydti.fawe.beta.IBatchProcessor;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
|
||||
public abstract class ExtentBatchProcessorHolder extends BatchProcessorHolder implements Extent {
|
||||
@Override
|
||||
public Extent addProcessor(IBatchProcessor processor) {
|
||||
join(processor);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent enableHistory(FaweChangeSet changeSet) {
|
||||
return this.addProcessor(changeSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent disableHistory() {
|
||||
this.remove(FaweChangeSet.class);
|
||||
return this;
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.PassthroughExtent;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -187,11 +188,10 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BlockArrayClipboard lazyCopy(Region region) {
|
||||
WorldCopyClipboard faweClipboard = new WorldCopyClipboard(this, region);
|
||||
BlockArrayClipboard weClipboard = new BlockArrayClipboard(region, faweClipboard);
|
||||
weClipboard.setOrigin(region.getMinimumPoint());
|
||||
return weClipboard;
|
||||
public Clipboard lazyCopy(Region region) {
|
||||
WorldCopyClipboard clipboard = new WorldCopyClipboard(() -> this, region);
|
||||
clipboard.setOrigin(region.getMinimumPoint());
|
||||
return clipboard;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,6 +262,10 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
||||
return new SingleThreadQueueExtent();
|
||||
}
|
||||
|
||||
public void uncache() {
|
||||
queuePool.set(null);
|
||||
}
|
||||
|
||||
public abstract void startSet(boolean parallel);
|
||||
|
||||
public abstract void endSet(boolean parallel);
|
||||
|
@ -15,6 +15,7 @@ import com.boydti.fawe.beta.implementation.chunk.ChunkHolder;
|
||||
import com.boydti.fawe.beta.implementation.chunk.ReferenceChunk;
|
||||
import com.boydti.fawe.beta.implementation.processors.BatchProcessorHolder;
|
||||
import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor;
|
||||
import com.boydti.fawe.beta.implementation.processors.ExtentBatchProcessorHolder;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
@ -33,7 +34,7 @@ import java.util.concurrent.Future;
|
||||
* <p>
|
||||
* This queue is reusable {@link #init(IChunkCache)}
|
||||
*/
|
||||
public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQueueExtent {
|
||||
public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent {
|
||||
|
||||
// // Pool discarded chunks for reuse (can safely be cleared by another thread)
|
||||
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
|
||||
@ -88,7 +89,6 @@ public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQu
|
||||
*/
|
||||
protected synchronized void reset() {
|
||||
if (!this.initialized) return;
|
||||
checkThread();
|
||||
if (!this.chunks.isEmpty()) {
|
||||
for (IChunk chunk : this.chunks.values()) {
|
||||
chunk.recycle();
|
||||
@ -124,23 +124,6 @@ public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQu
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent addProcessor(IBatchProcessor processor) {
|
||||
join(processor);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent enableHistory(FaweChangeSet changeSet) {
|
||||
return this.addProcessor(changeSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent disableHistory() {
|
||||
this.remove(FaweChangeSet.class);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return chunks.size() + submissions.size();
|
||||
@ -241,8 +224,6 @@ public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQu
|
||||
if (chunk != null) {
|
||||
return chunk;
|
||||
}
|
||||
|
||||
checkThread();
|
||||
final int size = chunks.size();
|
||||
final boolean lowMem = MemUtil.isMemoryLimited();
|
||||
if (enabledQueue && (lowMem || size > Settings.IMP.QUEUE.TARGET_SIZE)) {
|
||||
@ -316,7 +297,6 @@ public class SingleThreadQueueExtent extends BatchProcessorHolder implements IQu
|
||||
|
||||
@Override
|
||||
public synchronized void flush() {
|
||||
checkThread();
|
||||
if (!chunks.isEmpty()) {
|
||||
if (MemUtil.isMemoryLimited()) {
|
||||
for (IChunk chunk : chunks.values()) {
|
||||
|
Reference in New Issue
Block a user