Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 01:50:06 +01:00
Update from sk89q/master
Dieser Commit ist enthalten in:
Commit
cfbf7dbec0
@ -38,6 +38,7 @@
|
||||
|
||||
<subpackage name="bukkit">
|
||||
<allow pkg="org.bukkit"/>
|
||||
<allow pkg="org.bstats.bukkit"/>
|
||||
<allow pkg="net.minecraft.server"/>
|
||||
</subpackage>
|
||||
|
||||
@ -58,6 +59,7 @@
|
||||
<allow pkg="com.flowpowered.math" />
|
||||
<allow pkg="org.spongepowered.api" />
|
||||
<allow pkg="org.slf4j" />
|
||||
<allow pkg="org.bstats.sponge"/>
|
||||
<allow pkg="ninja.leaping.configurate" />
|
||||
</subpackage>
|
||||
</subpackage>
|
||||
|
@ -89,4 +89,4 @@ shadowJar {
|
||||
|
||||
build.dependsOn(shadowJar)
|
||||
build.finalizedBy(copyFiles)
|
||||
copyFiles.dependsOn(createPom)
|
||||
copyFiles.dependsOn(createPom)
|
||||
|
@ -60,9 +60,9 @@ public class MutableFullBlockChange implements Change {
|
||||
}
|
||||
|
||||
public void perform(FaweQueue queue) {
|
||||
BlockTypes idFrom = BlockTypes.get(from);
|
||||
BlockTypes idFrom = BlockTypes.getFromStateId(from);
|
||||
if (blockBag != null) {
|
||||
BlockTypes idTo = BlockTypes.get(to);
|
||||
BlockTypes idTo = BlockTypes.getFromStateId(to);
|
||||
if (idFrom != idTo) {
|
||||
if (allowFetch && from != 0) {
|
||||
try {
|
||||
|
@ -81,6 +81,7 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
||||
@Override
|
||||
public void add(int x, int y, int z, BlockStateHolder from, BlockStateHolder to) {
|
||||
check(from.getBlockType(), to.getBlockType());
|
||||
super.add(x, y, z, from, to);
|
||||
}
|
||||
|
||||
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) {
|
||||
if (wrapped) return false;
|
||||
if (history != null) return false;
|
||||
FaweRegionExtent regionExtent = getRegionExtent();
|
||||
if (!(region instanceof CuboidRegion)) return false;
|
||||
if (regionExtent != null) {
|
||||
|
@ -63,7 +63,7 @@ public class BlockMask extends AbstractExtentMask {
|
||||
if (set == ALL) {
|
||||
strings.add(type.getId());
|
||||
} else {
|
||||
for (BlockState state : type.getStates()) {
|
||||
for (BlockState state : type.getAllStates()) {
|
||||
if (test(state)) {
|
||||
strings.add(state.getAsString());
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.world.block;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BlockMaterial;
|
||||
@ -155,6 +156,13 @@ public interface BlockType extends FawePattern, Comparable<BlockTypes> {
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -820,7 +820,7 @@ public enum BlockTypes implements BlockType {
|
||||
* @return collection of states
|
||||
*/
|
||||
@Deprecated
|
||||
public Collection<BlockState> getStates() {
|
||||
public List<BlockState> getAllStates() {
|
||||
if (settings.stateOrdinals == null) return Collections.singletonList(getDefaultState());
|
||||
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.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
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.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class AnvilChunk implements Chunk {
|
||||
|
||||
private CompoundTag rootTag;
|
||||
@ -53,8 +53,6 @@ public class AnvilChunk implements Chunk {
|
||||
private int rootZ;
|
||||
|
||||
private Map<BlockVector, Map<String,Tag>> tileEntities;
|
||||
@SuppressWarnings("unused")
|
||||
private World world; // TODO: remove if stays unused.
|
||||
|
||||
/**
|
||||
* Construct the chunk with a compound tag.
|
||||
@ -65,7 +63,6 @@ public class AnvilChunk implements Chunk {
|
||||
*/
|
||||
public AnvilChunk(World world, CompoundTag tag) throws DataException {
|
||||
rootTag = tag;
|
||||
this.world = world;
|
||||
|
||||
rootX = NBTUtils.getChildTag(rootTag.getValue(), "xPos", IntTag.class).getValue();
|
||||
rootZ = NBTUtils.getChildTag(rootTag.getValue(), "zPos", IntTag.class).getValue();
|
||||
@ -257,14 +254,22 @@ public class AnvilChunk implements Chunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getBlock(Vector position) throws DataException {
|
||||
public BlockStateHolder getBlock(Vector position) throws DataException {
|
||||
int id = getBlockID(position);
|
||||
int data = getBlockData(position);
|
||||
|
||||
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||
|
||||
return new BaseBlock(state, tileEntity);
|
||||
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);
|
||||
if (tileEntity != null) {
|
||||
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.world.DataException;
|
||||
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.BlockTypes;
|
||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||
@ -230,7 +231,7 @@ public class AnvilChunk13 implements Chunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(Vector position) throws DataException {
|
||||
public BlockStateHolder getBlock(Vector position) throws DataException {
|
||||
int x = position.getBlockX() - rootX * 16;
|
||||
int y = position.getBlockY();
|
||||
int z = position.getBlockZ() - rootZ * 16;
|
||||
|
@ -20,9 +20,8 @@
|
||||
package com.sk89q.worldedit.world.chunk;
|
||||
|
||||
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.block.BlockStateHolder;
|
||||
|
||||
/**
|
||||
* A 16 by 16 block chunk.
|
||||
@ -36,6 +35,5 @@ public interface Chunk {
|
||||
* @return block the block
|
||||
* @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.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
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.BlockStateHolder;
|
||||
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.storage.InvalidFormatException;
|
||||
|
||||
@ -155,7 +155,7 @@ public class OldChunk implements Chunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(Vector position) throws DataException {
|
||||
public BlockStateHolder getBlock(Vector position) throws DataException {
|
||||
if(position.getBlockY() >= 128) return BlockTypes.VOID_AIR.getDefaultState();
|
||||
int id, dataVal;
|
||||
|
||||
@ -183,6 +183,10 @@ public class OldChunk implements Chunk {
|
||||
}
|
||||
|
||||
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()) {
|
||||
CompoundTag tileEntity = getBlockTileEntity(position);
|
||||
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.Region;
|
||||
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.storage.ChunkStore;
|
||||
import com.sk89q.worldedit.world.storage.MissingChunkException;
|
||||
@ -149,8 +150,7 @@ public class SnapshotRestore {
|
||||
// Now just copy blocks!
|
||||
for (Vector pos : entry.getValue()) {
|
||||
try {
|
||||
BlockState block = chunk.getBlock(pos);
|
||||
editSession.setBlock(pos, block);
|
||||
editSession.setBlock(pos, chunk.getBlock(pos));
|
||||
} catch (DataException e) {
|
||||
// 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.SubjectReference;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SpongePermissionsProvider {
|
||||
|
||||
public boolean hasPermission(Player player, String permission) {
|
||||
@ -44,6 +42,6 @@ public class SpongePermissionsProvider {
|
||||
public String[] getGroups(Player player) {
|
||||
return player.getParents().stream()
|
||||
.map(SubjectReference::getSubjectIdentifier)
|
||||
.collect(Collectors.toList()).toArray(new String[0]);
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren