mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-08-03 13:05:29 +02:00
simplify config / multiple expiry tasks / block cache fix
This commit is contained in:
@@ -14,7 +14,7 @@ import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.intellectualcrafters.plot.util.CommentManager;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.PlotGameMode;
|
||||
|
@@ -2,9 +2,7 @@ package com.plotsquared.listener;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
@@ -16,7 +14,6 @@ import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -87,7 +84,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
return false;
|
||||
}
|
||||
this.BScount++;
|
||||
if (this.BScount > Settings.CHUNK_PROCESSOR_MAX_BLOCKSTATES) {
|
||||
if (this.BScount > Settings.CHUNK_PROCESSOR.MAX_TILES) {
|
||||
this.BSblocked = true;
|
||||
PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ());
|
||||
}
|
||||
@@ -209,16 +206,18 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
case 190:
|
||||
case 191:
|
||||
case 192:
|
||||
if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) {
|
||||
SetQueue.IMP.setBlock(this.world, x, y, z, id);
|
||||
} else {
|
||||
// if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) {
|
||||
// SetQueue.IMP.setBlock(this.world, x, y, z, id);
|
||||
// } else
|
||||
{
|
||||
super.setBlock(location, block);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) {
|
||||
SetQueue.IMP.setBlock(this.world, x, y, z, PlotBlock.get((short) id, (byte) block.getData()));
|
||||
} else {
|
||||
// if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) {
|
||||
// SetQueue.IMP.setBlock(this.world, x, y, z, PlotBlock.get((short) id, (byte) block.getData()));
|
||||
// } else
|
||||
{
|
||||
super.setBlock(location, block);
|
||||
}
|
||||
break;
|
||||
@@ -236,7 +235,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
return null;
|
||||
}
|
||||
this.Ecount++;
|
||||
if (this.Ecount > Settings.CHUNK_PROCESSOR_MAX_ENTITIES) {
|
||||
if (this.Ecount > Settings.CHUNK_PROCESSOR.MAX_ENTITIES) {
|
||||
this.Eblocked = true;
|
||||
PS.debug("&cPlotSquared detected unsafe WorldEdit: " + location.getBlockX() + "," + location.getBlockZ());
|
||||
}
|
||||
|
@@ -46,11 +46,11 @@ public class WEManager {
|
||||
return regions;
|
||||
}
|
||||
for (Plot plot : area.getPlots()) {
|
||||
if (!plot.isBasePlot() || (Settings.DONE_RESTRICTS_BUILDING && (plot.getFlag(Flags.DONE).isPresent()))) {
|
||||
if (!plot.isBasePlot() || (Settings.DONE.RESTRICT_BUILDING && (plot.getFlag(Flags.DONE).isPresent()))) {
|
||||
continue;
|
||||
}
|
||||
if (Settings.WE_ALLOW_HELPER && plot.isAdded(uuid) || !Settings.WE_ALLOW_HELPER && (plot.isOwner(uuid) || plot.getTrusted()
|
||||
.contains(uuid))) {
|
||||
boolean allowMember = player.hasPermission("plots.worldedit.member");
|
||||
if (allowMember && plot.isAdded(uuid) || !allowMember && (plot.isOwner(uuid) || plot.getTrusted().contains(uuid))) {
|
||||
regions.addAll(plot.getRegions());
|
||||
}
|
||||
}
|
||||
|
@@ -8,25 +8,15 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||
import com.sk89q.worldedit.command.tool.Tool;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.ChangeSetExtent;
|
||||
import com.sk89q.worldedit.extent.MaskingExtent;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.extent.reorder.MultiStageReorder;
|
||||
import com.sk89q.worldedit.extent.world.FastModeExtent;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
|
||||
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class WESubscriber {
|
||||
@@ -71,69 +61,7 @@ public class WESubscriber {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Settings.CHUNK_PROCESSOR) {
|
||||
if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) {
|
||||
try {
|
||||
LocalSession session = worldedit.getSessionManager().findByName(name);
|
||||
boolean hasMask = session.getMask() != null;
|
||||
Player objPlayer = (Player) actor;
|
||||
int item = objPlayer.getItemInHand();
|
||||
if (!hasMask) {
|
||||
try {
|
||||
Tool tool = session.getTool(item);
|
||||
if (tool instanceof BrushTool) {
|
||||
hasMask = ((BrushTool) tool).getMask() != null;
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
AbstractDelegateExtent extent = (AbstractDelegateExtent) event.getExtent();
|
||||
ChangeSetExtent history = null;
|
||||
MultiStageReorder reorder = null;
|
||||
MaskingExtent maskextent = null;
|
||||
boolean fast = session.hasFastMode();
|
||||
while (extent.getExtent() != null && extent.getExtent() instanceof AbstractDelegateExtent) {
|
||||
AbstractDelegateExtent tmp = (AbstractDelegateExtent) extent.getExtent();
|
||||
if (tmp.getExtent() != null && tmp.getExtent() instanceof AbstractDelegateExtent) {
|
||||
if (tmp instanceof ChangeSetExtent) {
|
||||
history = (ChangeSetExtent) tmp;
|
||||
}
|
||||
if (tmp instanceof MultiStageReorder) {
|
||||
reorder = (MultiStageReorder) tmp;
|
||||
}
|
||||
if (hasMask && tmp instanceof MaskingExtent) {
|
||||
maskextent = (MaskingExtent) tmp;
|
||||
}
|
||||
extent = tmp;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
int max = event.getMaxBlocks();
|
||||
Field field = AbstractDelegateExtent.class.getDeclaredField("extent");
|
||||
field.setAccessible(true);
|
||||
if (history == null) {
|
||||
ExtentWrapper wrapper = new ExtentWrapper(event.getExtent());
|
||||
event.setExtent(wrapper);
|
||||
field.set(extent, new ProcessedWEExtent(world, mask, max, new FastModeExtent(worldObj, true), wrapper));
|
||||
} else if (fast) {
|
||||
event.setExtent(new ExtentWrapper(extent));
|
||||
} else {
|
||||
ExtentWrapper wrapper;
|
||||
if (maskextent != null) {
|
||||
wrapper = new ExtentWrapper(maskextent);
|
||||
field.set(maskextent, history);
|
||||
} else {
|
||||
wrapper = new ExtentWrapper(history);
|
||||
}
|
||||
event.setExtent(wrapper);
|
||||
field.set(history, reorder);
|
||||
field.set(reorder, new ProcessedWEExtent(world, mask, max, new FastModeExtent(worldObj, true), wrapper));
|
||||
}
|
||||
return;
|
||||
} catch (IllegalAccessException | SecurityException | NoSuchFieldException | IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (Settings.ENABLED_COMPONENTS.CHUNK_PROCESSOR) {
|
||||
if (PS.get().hasPlotArea(world)) {
|
||||
event.setExtent(new ProcessedWEExtent(world, mask, event.getMaxBlocks(), event.getExtent(), event.getExtent()));
|
||||
}
|
||||
|
Reference in New Issue
Block a user