mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fix limits
This commit is contained in:
parent
07a5ef5ab4
commit
f5f5a55b4c
@ -1,47 +0,0 @@
|
|||||||
package com.boydti.fawe.beta.implementation.processors;
|
|
||||||
|
|
||||||
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.boydti.fawe.object.FaweLimit;
|
|
||||||
import com.boydti.fawe.object.exception.FaweException;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
|
||||||
|
|
||||||
public class LimitProcessor implements IBatchProcessor {
|
|
||||||
private final FaweLimit limit;
|
|
||||||
private final IBatchProcessor parent;
|
|
||||||
public LimitProcessor(FaweLimit limit, IBatchProcessor parent) {
|
|
||||||
this.limit = limit;
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set) {
|
|
||||||
try {
|
|
||||||
return parent.processSet(chunk, get, set);
|
|
||||||
} catch (FaweException e) {
|
|
||||||
if (!limit.MAX_CHANGES()) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean processGet(int chunkX, int chunkZ) {
|
|
||||||
try {
|
|
||||||
return parent.processGet(chunkX, chunkZ);
|
|
||||||
} catch (FaweException e) {
|
|
||||||
if (!limit.MAX_CHECKS()) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Extent construct(Extent child) {
|
|
||||||
return new LimitExtent(parent.construct(child), limit);
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,10 +2,9 @@ package com.boydti.fawe.util;
|
|||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.IBatchProcessor;
|
|
||||||
import com.boydti.fawe.beta.IQueueChunk;
|
import com.boydti.fawe.beta.IQueueChunk;
|
||||||
import com.boydti.fawe.beta.IQueueExtent;
|
import com.boydti.fawe.beta.IQueueExtent;
|
||||||
import com.boydti.fawe.beta.implementation.processors.LimitProcessor;
|
import com.boydti.fawe.beta.implementation.processors.LimitExtent;
|
||||||
import com.boydti.fawe.beta.implementation.queue.ParallelQueueExtent;
|
import com.boydti.fawe.beta.implementation.queue.ParallelQueueExtent;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
import com.boydti.fawe.logging.rollback.RollbackOptimizedHistory;
|
||||||
@ -383,14 +382,8 @@ public class EditSessionBuilder {
|
|||||||
} else {
|
} else {
|
||||||
// this.extent = new HeightBoundExtent(this.extent, this.limit, 0, world.getMaxY());
|
// this.extent = new HeightBoundExtent(this.extent, this.limit, 0, world.getMaxY());
|
||||||
}
|
}
|
||||||
IBatchProcessor limitProcessor = regionExtent;
|
if (limit != null && !limit.isUnlimited() && regionExtent != null) {
|
||||||
if (limit != null && !limit.isUnlimited()) {
|
this.extent = new LimitExtent(regionExtent, limit);
|
||||||
limitProcessor = new LimitProcessor(limit, limitProcessor);
|
|
||||||
}
|
|
||||||
if (regionExtent != null && queue != null && combineStages) {
|
|
||||||
queue.addProcessor(limitProcessor);
|
|
||||||
} else if (regionExtent != null) {
|
|
||||||
this.extent = limitProcessor.construct(regionExtent.getExtent());
|
|
||||||
}
|
}
|
||||||
if (this.limit.STRIP_NBT != null && !this.limit.STRIP_NBT.isEmpty()) {
|
if (this.limit.STRIP_NBT != null && !this.limit.STRIP_NBT.isEmpty()) {
|
||||||
System.out.println("TODO add batch processor for strip nbt");
|
System.out.println("TODO add batch processor for strip nbt");
|
||||||
|
@ -721,7 +721,11 @@ public final class PlatformCommandManager {
|
|||||||
}
|
}
|
||||||
actor.printError(e.getRichMessage());
|
actor.printError(e.getRichMessage());
|
||||||
} catch (CommandExecutionException e) {
|
} catch (CommandExecutionException e) {
|
||||||
|
if (e.getCause() instanceof FaweException) {
|
||||||
|
actor.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason", ((FaweException)e.getCause()).getComponent()));
|
||||||
|
} else {
|
||||||
handleUnknownException(actor, e.getCause());
|
handleUnknownException(actor, e.getCause());
|
||||||
|
}
|
||||||
} catch (CommandException e) {
|
} catch (CommandException e) {
|
||||||
Component msg = e.getRichMessage();
|
Component msg = e.getRichMessage();
|
||||||
if (msg != TextComponent.empty()) {
|
if (msg != TextComponent.empty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user