geforkt von Mirrors/FastAsyncWorldEdit
Update from sk89q/master
Dieser Commit ist enthalten in:
Commit
cfbf7dbec0
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
<subpackage name="bukkit">
|
<subpackage name="bukkit">
|
||||||
<allow pkg="org.bukkit"/>
|
<allow pkg="org.bukkit"/>
|
||||||
|
<allow pkg="org.bstats.bukkit"/>
|
||||||
<allow pkg="net.minecraft.server"/>
|
<allow pkg="net.minecraft.server"/>
|
||||||
</subpackage>
|
</subpackage>
|
||||||
|
|
||||||
@ -58,6 +59,7 @@
|
|||||||
<allow pkg="com.flowpowered.math" />
|
<allow pkg="com.flowpowered.math" />
|
||||||
<allow pkg="org.spongepowered.api" />
|
<allow pkg="org.spongepowered.api" />
|
||||||
<allow pkg="org.slf4j" />
|
<allow pkg="org.slf4j" />
|
||||||
|
<allow pkg="org.bstats.sponge"/>
|
||||||
<allow pkg="ninja.leaping.configurate" />
|
<allow pkg="ninja.leaping.configurate" />
|
||||||
</subpackage>
|
</subpackage>
|
||||||
</subpackage>
|
</subpackage>
|
||||||
|
@ -60,9 +60,9 @@ public class MutableFullBlockChange implements Change {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void perform(FaweQueue queue) {
|
public void perform(FaweQueue queue) {
|
||||||
BlockTypes idFrom = BlockTypes.get(from);
|
BlockTypes idFrom = BlockTypes.getFromStateId(from);
|
||||||
if (blockBag != null) {
|
if (blockBag != null) {
|
||||||
BlockTypes idTo = BlockTypes.get(to);
|
BlockTypes idTo = BlockTypes.getFromStateId(to);
|
||||||
if (idFrom != idTo) {
|
if (idFrom != idTo) {
|
||||||
if (allowFetch && from != 0) {
|
if (allowFetch && from != 0) {
|
||||||
try {
|
try {
|
||||||
|
@ -81,6 +81,7 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
|||||||
@Override
|
@Override
|
||||||
public void add(int x, int y, int z, BlockStateHolder from, BlockStateHolder to) {
|
public void add(int x, int y, int z, BlockStateHolder from, BlockStateHolder to) {
|
||||||
check(from.getBlockType(), to.getBlockType());
|
check(from.getBlockType(), to.getBlockType());
|
||||||
|
super.add(x, y, z, from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void check(BlockType typeFrom, BlockType typeTo) {
|
public void check(BlockType typeFrom, BlockType typeTo) {
|
||||||
|
@ -1522,6 +1522,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
|
|
||||||
public boolean canBypassAll(Region region, boolean get, boolean set) {
|
public boolean canBypassAll(Region region, boolean get, boolean set) {
|
||||||
if (wrapped) return false;
|
if (wrapped) return false;
|
||||||
|
if (history != null) return false;
|
||||||
FaweRegionExtent regionExtent = getRegionExtent();
|
FaweRegionExtent regionExtent = getRegionExtent();
|
||||||
if (!(region instanceof CuboidRegion)) return false;
|
if (!(region instanceof CuboidRegion)) return false;
|
||||||
if (regionExtent != null) {
|
if (regionExtent != null) {
|
||||||
|
@ -63,7 +63,7 @@ public class BlockMask extends AbstractExtentMask {
|
|||||||
if (set == ALL) {
|
if (set == ALL) {
|
||||||
strings.add(type.getId());
|
strings.add(type.getId());
|
||||||
} else {
|
} else {
|
||||||
for (BlockState state : type.getStates()) {
|
for (BlockState state : type.getAllStates()) {
|
||||||
if (test(state)) {
|
if (test(state)) {
|
||||||
strings.add(state.getAsString());
|
strings.add(state.getAsString());
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.world.block;
|
package com.sk89q.worldedit.world.block;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||||
@ -155,6 +156,13 @@ public interface BlockType extends FawePattern, Comparable<BlockTypes> {
|
|||||||
*/
|
*/
|
||||||
BlockState getDefaultState();
|
BlockState getDefaultState();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a list of all possible states for this BlockType.
|
||||||
|
*
|
||||||
|
* @return All possible states
|
||||||
|
*/
|
||||||
|
List<BlockState> getAllStates();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets whether this block type has an item representation.
|
* Gets whether this block type has an item representation.
|
||||||
*
|
*
|
||||||
|
@ -820,7 +820,7 @@ public enum BlockTypes implements BlockType {
|
|||||||
* @return collection of states
|
* @return collection of states
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Collection<BlockState> getStates() {
|
public List<BlockState> getAllStates() {
|
||||||
if (settings.stateOrdinals == null) return Collections.singletonList(getDefaultState());
|
if (settings.stateOrdinals == null) return Collections.singletonList(getDefaultState());
|
||||||
return IntStream.of(settings.stateOrdinals).filter(i -> i != -1).mapToObj(i -> states[i]).collect(Collectors.toList());
|
return IntStream.of(settings.stateOrdinals).filter(i -> i != -1).mapToObj(i -> states[i]).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
@ -28,21 +28,21 @@ import com.sk89q.jnbt.NBTUtils;
|
|||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class AnvilChunk implements Chunk {
|
public class AnvilChunk implements Chunk {
|
||||||
|
|
||||||
private CompoundTag rootTag;
|
private CompoundTag rootTag;
|
||||||
@ -53,8 +53,6 @@ public class AnvilChunk implements Chunk {
|
|||||||
private int rootZ;
|
private int rootZ;
|
||||||
|
|
||||||
private Map<BlockVector, Map<String,Tag>> tileEntities;
|
private Map<BlockVector, Map<String,Tag>> tileEntities;
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private World world; // TODO: remove if stays unused.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the chunk with a compound tag.
|
* Construct the chunk with a compound tag.
|
||||||
@ -65,7 +63,6 @@ public class AnvilChunk implements Chunk {
|
|||||||
*/
|
*/
|
||||||
public AnvilChunk(World world, CompoundTag tag) throws DataException {
|
public AnvilChunk(World world, CompoundTag tag) throws DataException {
|
||||||
rootTag = tag;
|
rootTag = tag;
|
||||||
this.world = world;
|
|
||||||
|
|
||||||
rootX = NBTUtils.getChildTag(rootTag.getValue(), "xPos", IntTag.class).getValue();
|
rootX = NBTUtils.getChildTag(rootTag.getValue(), "xPos", IntTag.class).getValue();
|
||||||
rootZ = NBTUtils.getChildTag(rootTag.getValue(), "zPos", IntTag.class).getValue();
|
rootZ = NBTUtils.getChildTag(rootTag.getValue(), "zPos", IntTag.class).getValue();
|
||||||
@ -257,14 +254,22 @@ public class AnvilChunk implements Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getBlock(Vector position) throws DataException {
|
public BlockStateHolder getBlock(Vector position) throws DataException {
|
||||||
int id = getBlockID(position);
|
int id = getBlockID(position);
|
||||||
int data = getBlockData(position);
|
int data = getBlockData(position);
|
||||||
|
|
||||||
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
||||||
|
if (state == null) {
|
||||||
|
WorldEdit.logger.warning("Unknown legacy block " + id + ":" + data + " found when loading legacy anvil chunk.");
|
||||||
|
return BlockTypes.AIR.getDefaultState();
|
||||||
|
}
|
||||||
|
if (state.getMaterial().hasContainer()) {
|
||||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||||
|
if (tileEntity != null) {
|
||||||
return new BaseBlock(state, tileEntity);
|
return new BaseBlock(state, tileEntity);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import com.sk89q.worldedit.blocks.BaseBlock;
|
|||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||||
@ -230,7 +231,7 @@ public class AnvilChunk13 implements Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(Vector position) throws DataException {
|
public BlockStateHolder getBlock(Vector position) throws DataException {
|
||||||
int x = position.getBlockX() - rootX * 16;
|
int x = position.getBlockX() - rootX * 16;
|
||||||
int y = position.getBlockY();
|
int y = position.getBlockY();
|
||||||
int z = position.getBlockZ() - rootZ * 16;
|
int z = position.getBlockZ() - rootZ * 16;
|
||||||
|
@ -20,9 +20,8 @@
|
|||||||
package com.sk89q.worldedit.world.chunk;
|
package com.sk89q.worldedit.world.chunk;
|
||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A 16 by 16 block chunk.
|
* A 16 by 16 block chunk.
|
||||||
@ -36,6 +35,5 @@ public interface Chunk {
|
|||||||
* @return block the block
|
* @return block the block
|
||||||
* @throws DataException thrown on data error
|
* @throws DataException thrown on data error
|
||||||
*/
|
*/
|
||||||
BlockState getBlock(Vector position) throws DataException;
|
BlockStateHolder getBlock(Vector position) throws DataException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,13 +27,13 @@ import com.sk89q.jnbt.NBTUtils;
|
|||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.DataException;
|
|
||||||
import com.sk89q.worldedit.world.World;
|
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ public class OldChunk implements Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlock(Vector position) throws DataException {
|
public BlockStateHolder getBlock(Vector position) throws DataException {
|
||||||
if(position.getBlockY() >= 128) return BlockTypes.VOID_AIR.getDefaultState();
|
if(position.getBlockY() >= 128) return BlockTypes.VOID_AIR.getDefaultState();
|
||||||
int id, dataVal;
|
int id, dataVal;
|
||||||
|
|
||||||
@ -183,6 +183,10 @@ public class OldChunk implements Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal);
|
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal);
|
||||||
|
if (state == null) {
|
||||||
|
WorldEdit.logger.warning("Unknown legacy block " + id + ":" + dataVal + " found when loading legacy anvil chunk.");
|
||||||
|
return BlockTypes.AIR.getDefaultState();
|
||||||
|
}
|
||||||
if (state.getBlockType().getMaterial().hasContainer()) {
|
if (state.getBlockType().getMaterial().hasContainer()) {
|
||||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||||
if (tileEntity != null) return new BaseBlock(state, tileEntity);
|
if (tileEntity != null) return new BaseBlock(state, tileEntity);
|
||||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.world.block.BlockState;
|
|||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.chunk.Chunk;
|
import com.sk89q.worldedit.world.chunk.Chunk;
|
||||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||||
import com.sk89q.worldedit.world.storage.MissingChunkException;
|
import com.sk89q.worldedit.world.storage.MissingChunkException;
|
||||||
@ -149,8 +150,7 @@ public class SnapshotRestore {
|
|||||||
// Now just copy blocks!
|
// Now just copy blocks!
|
||||||
for (Vector pos : entry.getValue()) {
|
for (Vector pos : entry.getValue()) {
|
||||||
try {
|
try {
|
||||||
BlockState block = chunk.getBlock(pos);
|
editSession.setBlock(pos, chunk.getBlock(pos));
|
||||||
editSession.setBlock(pos, block);
|
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
// this is a workaround: just ignore for now
|
// this is a workaround: just ignore for now
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,6 @@ import org.spongepowered.api.service.permission.PermissionDescription;
|
|||||||
import org.spongepowered.api.service.permission.PermissionService;
|
import org.spongepowered.api.service.permission.PermissionService;
|
||||||
import org.spongepowered.api.service.permission.SubjectReference;
|
import org.spongepowered.api.service.permission.SubjectReference;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class SpongePermissionsProvider {
|
public class SpongePermissionsProvider {
|
||||||
|
|
||||||
public boolean hasPermission(Player player, String permission) {
|
public boolean hasPermission(Player player, String permission) {
|
||||||
@ -44,6 +42,6 @@ public class SpongePermissionsProvider {
|
|||||||
public String[] getGroups(Player player) {
|
public String[] getGroups(Player player) {
|
||||||
return player.getParents().stream()
|
return player.getParents().stream()
|
||||||
.map(SubjectReference::getSubjectIdentifier)
|
.map(SubjectReference::getSubjectIdentifier)
|
||||||
.collect(Collectors.toList()).toArray(new String[0]);
|
.toArray(String[]::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren