geforkt von Mirrors/FastAsyncWorldEdit
Merge branch 'main' of https://github.com/aurorasmiles/FastAsyncWorldEdit into main
Dieser Commit ist enthalten in:
Commit
13b89900ab
@ -60,6 +60,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.HashMap;
|
||||
@ -73,16 +74,19 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
|
||||
private Player player;
|
||||
private WorldEditPlugin plugin;
|
||||
private PermissionAttachment permAttachment;
|
||||
|
||||
public BukkitPlayer(Player player) {
|
||||
super(getExistingMap(WorldEditPlugin.getInstance(), player));
|
||||
this.plugin = WorldEditPlugin.getInstance();
|
||||
this.player = player;
|
||||
this.permAttachment = player.addAttachment(plugin);
|
||||
}
|
||||
|
||||
public BukkitPlayer(WorldEditPlugin plugin, Player player) {
|
||||
this.plugin = plugin;
|
||||
this.player = player;
|
||||
this.permAttachment = player.addAttachment(plugin);
|
||||
if (Settings.IMP.CLIPBOARD.USE_DISK) {
|
||||
loadClipboardFromDisk();
|
||||
}
|
||||
@ -239,16 +243,20 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
* Permissions are used to managing WorldEdit region restrictions
|
||||
* - The `/wea` command will give/remove the required bypass permission
|
||||
*/
|
||||
boolean usesuperperms = VaultResolver.perms == null;
|
||||
if (VaultResolver.perms != null) {
|
||||
if (value) {
|
||||
if (!VaultResolver.perms.playerAdd(player, permission)) {
|
||||
player.addAttachment(plugin).setPermission(permission, value);
|
||||
}
|
||||
} else if (!VaultResolver.perms.playerRemove(player, permission)) {
|
||||
player.addAttachment(plugin).setPermission(permission, value);
|
||||
usesuperperms = true;
|
||||
}
|
||||
} else {
|
||||
player.addAttachment(plugin).setPermission(permission, value);
|
||||
if (!VaultResolver.perms.playerRemove(player, permission)) {
|
||||
usesuperperms = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (usesuperperms) {
|
||||
permAttachment.setPermission(permission, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.boydti.fawe.beta.implementation.filter;
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.DelegateFilter;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
@ -33,7 +34,12 @@ public class MaskFilter<T extends Filter> extends DelegateFilter<T> {
|
||||
|
||||
@Override
|
||||
public void applyBlock(FilterBlock block) {
|
||||
if (mask.test(block)) {
|
||||
if (mask instanceof AbstractExtentMask) {
|
||||
if (((AbstractExtentMask) mask).test(block, block)) {
|
||||
getParent().applyBlock(block);
|
||||
this.changes++;
|
||||
}
|
||||
} else if (mask.test(block)) {
|
||||
getParent().applyBlock(block);
|
||||
this.changes++;
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
@ -31,8 +33,11 @@ import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class NMSRelighter implements Relighter {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(NMSRelighter.class);
|
||||
private static final int DISPATCH_SIZE = 64;
|
||||
private static final DirectionalProperty stairDirection;
|
||||
private static final EnumProperty stairHalf;
|
||||
@ -950,15 +955,27 @@ public class NMSRelighter implements Relighter {
|
||||
if (heightMapList.get(HeightMapType.OCEAN_FLOOR)[j] == 0 && material.isSolid()) {
|
||||
heightMapList.get(HeightMapType.OCEAN_FLOOR)[j] = y + 1;
|
||||
}
|
||||
try {
|
||||
if (heightMapList.get(HeightMapType.MOTION_BLOCKING)[j] == 0 && (material.isSolid() || material.isLiquid() || (
|
||||
state.getStates().containsKey(waterLogged) && state.getState(waterLogged)))) {
|
||||
heightMapList.get(HeightMapType.MOTION_BLOCKING)[j] = y + 1;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
log.debug("Error calculating waterlogged state for BlockState: " + state.getBlockType().getId() + ". States:");
|
||||
log.debug(state.getStates().entrySet().stream().map(e -> e.getKey() + "=" + e.getValue())
|
||||
.collect(Collectors.joining(", ", "{", "}")));
|
||||
}
|
||||
try {
|
||||
if (heightMapList.get(HeightMapType.MOTION_BLOCKING_NO_LEAVES)[j] == 0 && (material.isSolid() || material.isLiquid() || (
|
||||
state.getStates().containsKey(waterLogged) && state.getState(waterLogged))) && !state.getBlockType().getId().toLowerCase()
|
||||
.contains("leaves")) {
|
||||
state.getStates().containsKey(waterLogged) && state.getState(waterLogged))) && !state.getBlockType().getId()
|
||||
.toLowerCase().contains("leaves")) {
|
||||
heightMapList.get(HeightMapType.MOTION_BLOCKING_NO_LEAVES)[j] = y + 1;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
log.debug("Error calculating waterlogged state for BlockState: " + state.getBlockType().getId() + ". States:");
|
||||
log.debug(state.getStates().entrySet().stream().map(e -> e.getKey() + "=" + e.getValue())
|
||||
.collect(Collectors.joining(", ", "{", "}")));
|
||||
}
|
||||
}
|
||||
|
||||
switch (value) {
|
||||
|
@ -216,7 +216,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized final IQueueChunk getOrCreateChunk(int x, int z) {
|
||||
public final IQueueChunk getOrCreateChunk(int x, int z) {
|
||||
final long pair = (long) x << 32 | z & 0xffffffffL;
|
||||
if (pair == lastPair) {
|
||||
return lastChunk;
|
||||
|
@ -87,6 +87,12 @@ public class ImageBrush implements Brush {
|
||||
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new AbstractExtentMask(editSession) {
|
||||
private final MutableVector3 mutable = new MutableVector3();
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (solid.test(vector)) {
|
||||
|
@ -6,6 +6,7 @@ import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -47,6 +48,11 @@ public class LayerBrush implements Brush {
|
||||
Operations.completeBlindly(visitor);
|
||||
BlockVectorSet visited = visitor.getVisited();
|
||||
visitor = new RecursiveVisitor(new AbstractExtentMask(editSession) {
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 pos) {
|
||||
int depth = visitor.getDepth() + 1;
|
||||
|
@ -4,6 +4,7 @@ import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
@ -36,6 +37,11 @@ public class SplatterBrush extends ScatterBrush {
|
||||
SurfaceMask surface = new SurfaceMask(editSession);
|
||||
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new AbstractExtentMask(editSession) {
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
double dist = vector.distanceSq(position);
|
||||
|
@ -4,6 +4,7 @@ import com.boydti.fawe.object.brush.heightmap.HeightMap;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
@ -55,6 +56,11 @@ public class StencilBrush extends HeightBrush {
|
||||
|
||||
double scale = (yscale / sizeDouble) * (maxY + 1);
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new AbstractExtentMask(editSession) {
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(vector);
|
||||
}
|
||||
|
||||
private final MutableVector3 mutable = new MutableVector3();
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
|
@ -22,6 +22,16 @@ public class DataMask extends AbstractExtentMask implements ResettableMask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
if (data != -1) {
|
||||
return extent.getBlock(vector).getInternalPropertiesId() == data;
|
||||
} else {
|
||||
data = extent.getBlock(vector).getInternalPropertiesId();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.data = -1;
|
||||
|
@ -12,7 +12,7 @@ public class IdDataMask extends AbstractExtentMask implements ResettableMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
if (combined != -1) {
|
||||
return getExtent().getBlock(vector).getInternalId() == combined;
|
||||
} else {
|
||||
@ -21,6 +21,11 @@ public class IdDataMask extends AbstractExtentMask implements ResettableMask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return test(getExtent(), vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.combined = -1;
|
||||
|
@ -13,15 +13,20 @@ public class IdMask extends AbstractExtentMask implements ResettableMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
if (id != -1) {
|
||||
return getExtent().getBlock(vector).getInternalBlockTypeId() == id;
|
||||
return extent.getBlock(vector).getInternalBlockTypeId() == id;
|
||||
} else {
|
||||
id = getExtent().getBlock(vector).getInternalBlockTypeId();
|
||||
id = extent.getBlock(vector).getInternalBlockTypeId();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return test(getExtent(), vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.id = -1;
|
||||
|
@ -174,11 +174,13 @@ public class PlayerProxy extends AbstractPlayerActor {
|
||||
return permActor.hasPermission(perm);
|
||||
}
|
||||
|
||||
@Override public boolean togglePermission(String permission) {
|
||||
return permActor.hasPermission(permission);
|
||||
@Override
|
||||
public boolean togglePermission(String permission) {
|
||||
return permActor.togglePermission(permission);
|
||||
}
|
||||
|
||||
@Override public void setPermission(String permission, boolean value) {
|
||||
@Override
|
||||
public void setPermission(String permission, boolean value) {
|
||||
permActor.setPermission(permission, value);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,10 @@ public abstract class ABlockMask extends AbstractExtentMask {
|
||||
super(extent);
|
||||
}
|
||||
|
||||
@Override public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(extent.getBlock(vector));
|
||||
}
|
||||
|
||||
@Override public boolean test(BlockVector3 vector) {
|
||||
return test(getExtent().getBlock(vector));
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@ -59,4 +60,6 @@ public abstract class AbstractExtentMask extends AbstractMask {
|
||||
this.extent = extent;
|
||||
}
|
||||
|
||||
abstract public boolean test(Extent extent, BlockVector3 position);
|
||||
|
||||
}
|
||||
|
@ -46,6 +46,11 @@ public class BlockCategoryMask extends AbstractExtentMask {
|
||||
return category.contains(getExtent().getBlock(vector));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return category.contains(extent.getBlock(vector));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
|
@ -57,6 +57,11 @@ public class BlockStateMask extends AbstractExtentMask {
|
||||
return test(getExtent().getBlock(vector));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(extent.getBlock(vector));
|
||||
}
|
||||
|
||||
public boolean test(BlockState block) {
|
||||
final Map<Property<Object>, Object> checkProps = cache
|
||||
.computeIfAbsent(block.getBlockType(), (b -> Blocks.resolveProperties(states, b)));
|
||||
|
@ -114,6 +114,11 @@ public class BlockTypeMask extends AbstractExtentMask {
|
||||
return test(getExtent().getBlock(vector).getBlockType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(extent.getBlock(vector).getBlockType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replacesAir() {
|
||||
return hasAir;
|
||||
|
@ -1,11 +0,0 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.boydti.fawe.object.function.mask.AbstractDelegateMask;
|
||||
|
||||
public class DelegateExtentMask extends AbstractDelegateMask {
|
||||
|
||||
public DelegateExtentMask(Mask parent) {
|
||||
super(parent);
|
||||
}
|
||||
|
||||
}
|
@ -44,6 +44,11 @@ public class ExistingBlockMask extends AbstractExtentMask {
|
||||
return !getExtent().getBlock(vector).getBlockType().getMaterial().isAir();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return !extent.getBlock(vector).getBlockType().getMaterial().isAir();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren