mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 04:48:34 +00:00
More deprecation removal
This commit is contained in:
@ -85,7 +85,7 @@ public class ChangeSetExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
private List<? extends Entity> wrapEntities(List<? extends Entity> entities) {
|
||||
List<Entity> newList = new ArrayList<Entity>(entities.size());
|
||||
List<Entity> newList = new ArrayList<>(entities.size());
|
||||
for (Entity entity : entities) {
|
||||
newList.add(new TrackedEntity(entity));
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -51,7 +50,7 @@ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pat
|
||||
|
||||
private static final BaseBlock AIR = new BaseBlock(BlockTypes.AIR);
|
||||
|
||||
private final Map<BlockVector, BaseBlock> buffer = new LinkedHashMap<BlockVector, BaseBlock>();
|
||||
private final Map<BlockVector, BaseBlock> buffer = new LinkedHashMap<>();
|
||||
private final Mask mask;
|
||||
private Vector min = null;
|
||||
private Vector max = null;
|
||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
@ -48,7 +47,7 @@ public class BlockArrayClipboard implements Clipboard {
|
||||
private final Region region;
|
||||
private Vector origin = new Vector();
|
||||
private final BaseBlock[][][] blocks;
|
||||
private final List<ClipboardEntity> entities = new ArrayList<ClipboardEntity>();
|
||||
private final List<ClipboardEntity> entities = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -98,7 +97,7 @@ public class BlockArrayClipboard implements Clipboard {
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
List<Entity> filtered = new ArrayList<Entity>();
|
||||
List<Entity> filtered = new ArrayList<>();
|
||||
for (Entity entity : entities) {
|
||||
if (region.contains(entity.getLocation().toVector())) {
|
||||
filtered.add(entity);
|
||||
|
@ -65,9 +65,7 @@ public enum ClipboardFormat {
|
||||
|
||||
@Override
|
||||
public boolean isFormat(File file) {
|
||||
DataInputStream str = null;
|
||||
try {
|
||||
str = new DataInputStream(new GZIPInputStream(new FileInputStream(file)));
|
||||
try (DataInputStream str = new DataInputStream(new GZIPInputStream(new FileInputStream(file)))) {
|
||||
if ((str.readByte() & 0xFF) != NBTConstants.TYPE_COMPOUND) {
|
||||
return false;
|
||||
}
|
||||
@ -77,18 +75,11 @@ public enum ClipboardFormat {
|
||||
return name.equals("Schematic");
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
} finally {
|
||||
if (str != null) {
|
||||
try {
|
||||
str.close();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static final Map<String, ClipboardFormat> aliasMap = new HashMap<String, ClipboardFormat>();
|
||||
private static final Map<String, ClipboardFormat> aliasMap = new HashMap<>();
|
||||
|
||||
private final String[] aliases;
|
||||
|
||||
@ -107,7 +98,7 @@ public enum ClipboardFormat {
|
||||
* @return a set of aliases
|
||||
*/
|
||||
public Set<String> getAliases() {
|
||||
return Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(aliases)));
|
||||
return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(aliases)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +160,7 @@ public class SchematicReader implements ClipboardReader {
|
||||
|
||||
// Need to pull out tile entities
|
||||
List<Tag> tileEntities = requireTag(schematic, "TileEntities", ListTag.class).getValue();
|
||||
Map<BlockVector, Map<String, Tag>> tileEntitiesMap = new HashMap<BlockVector, Map<String, Tag>>();
|
||||
Map<BlockVector, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
||||
|
||||
for (Tag tag : tileEntities) {
|
||||
if (!(tag instanceof CompoundTag)) continue;
|
||||
@ -170,21 +170,25 @@ public class SchematicReader implements ClipboardReader {
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
|
||||
Map<String, Tag> values = new HashMap<String, Tag>();
|
||||
Map<String, Tag> values = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Tag> entry : t.getValue().entrySet()) {
|
||||
if (entry.getKey().equals("x")) {
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
x = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
} else if (entry.getKey().equals("y")) {
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
y = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
} else if (entry.getKey().equals("z")) {
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
z = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
switch (entry.getKey()) {
|
||||
case "x":
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
x = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
break;
|
||||
case "y":
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
y = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
break;
|
||||
case "z":
|
||||
if (entry.getValue() instanceof IntTag) {
|
||||
z = ((IntTag) entry.getValue()).getValue();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
values.put(entry.getKey(), entry.getValue());
|
||||
|
@ -89,7 +89,7 @@ public class SchematicWriter implements ClipboardWriter {
|
||||
// Metadata
|
||||
// ====================================================================
|
||||
|
||||
HashMap<String, Tag> schematic = new HashMap<String, Tag>();
|
||||
HashMap<String, Tag> schematic = new HashMap<>();
|
||||
schematic.put("Width", new ShortTag((short) width));
|
||||
schematic.put("Length", new ShortTag((short) length));
|
||||
schematic.put("Height", new ShortTag((short) height));
|
||||
@ -108,7 +108,7 @@ public class SchematicWriter implements ClipboardWriter {
|
||||
byte[] blocks = new byte[width * height * length];
|
||||
byte[] addBlocks = null;
|
||||
byte[] blockData = new byte[width * height * length];
|
||||
List<Tag> tileEntities = new ArrayList<Tag>();
|
||||
List<Tag> tileEntities = new ArrayList<>();
|
||||
|
||||
for (Vector point : region) {
|
||||
Vector relative = point.subtract(min);
|
||||
@ -136,7 +136,7 @@ public class SchematicWriter implements ClipboardWriter {
|
||||
// Store TileEntity data
|
||||
CompoundTag rawTag = block.getNbtData();
|
||||
if (rawTag != null) {
|
||||
Map<String, Tag> values = new HashMap<String, Tag>();
|
||||
Map<String, Tag> values = new HashMap<>();
|
||||
for (Entry<String, Tag> entry : rawTag.getValue().entrySet()) {
|
||||
values.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
@ -163,12 +163,12 @@ public class SchematicWriter implements ClipboardWriter {
|
||||
// Entities
|
||||
// ====================================================================
|
||||
|
||||
List<Tag> entities = new ArrayList<Tag>();
|
||||
List<Tag> entities = new ArrayList<>();
|
||||
for (Entity entity : clipboard.getEntities()) {
|
||||
BaseEntity state = entity.getState();
|
||||
|
||||
if (state != null) {
|
||||
Map<String, Tag> values = new HashMap<String, Tag>();
|
||||
Map<String, Tag> values = new HashMap<>();
|
||||
|
||||
// Put NBT provided data
|
||||
CompoundTag rawTag = state.getNbtData();
|
||||
@ -197,7 +197,7 @@ public class SchematicWriter implements ClipboardWriter {
|
||||
}
|
||||
|
||||
private Tag writeVector(Vector vector, String name) {
|
||||
List<DoubleTag> list = new ArrayList<DoubleTag>();
|
||||
List<DoubleTag> list = new ArrayList<>();
|
||||
list.add(new DoubleTag(vector.getX()));
|
||||
list.add(new DoubleTag(vector.getY()));
|
||||
list.add(new DoubleTag(vector.getZ()));
|
||||
@ -205,7 +205,7 @@ public class SchematicWriter implements ClipboardWriter {
|
||||
}
|
||||
|
||||
private Tag writeRotation(Location location, String name) {
|
||||
List<FloatTag> list = new ArrayList<FloatTag>();
|
||||
List<FloatTag> list = new ArrayList<>();
|
||||
list.add(new FloatTag(location.getYaw()));
|
||||
list.add(new FloatTag(location.getPitch()));
|
||||
return new ListTag(FloatTag.class, list);
|
||||
|
@ -27,7 +27,6 @@ import com.google.gson.JsonSyntaxException;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -34,7 +34,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class BlockBagExtent extends AbstractDelegateExtent {
|
||||
|
||||
private Map<Integer, Integer> missingBlocks = new HashMap<Integer, Integer>();
|
||||
private Map<Integer, Integer> missingBlocks = new HashMap<>();
|
||||
private BlockBag blockBag;
|
||||
|
||||
/**
|
||||
@ -74,7 +74,7 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
||||
*/
|
||||
public Map<Integer, Integer> popMissing() {
|
||||
Map<Integer, Integer> missingBlocks = this.missingBlocks;
|
||||
this.missingBlocks = new HashMap<Integer, Integer>();
|
||||
this.missingBlocks = new HashMap<>();
|
||||
return missingBlocks;
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,9 @@ import java.util.*;
|
||||
*/
|
||||
public class MultiStageReorder extends AbstractDelegateExtent implements ReorderingExtent {
|
||||
|
||||
private TupleArrayList<BlockVector, BaseBlock> stage1 = new TupleArrayList<BlockVector, BaseBlock>();
|
||||
private TupleArrayList<BlockVector, BaseBlock> stage2 = new TupleArrayList<BlockVector, BaseBlock>();
|
||||
private TupleArrayList<BlockVector, BaseBlock> stage3 = new TupleArrayList<BlockVector, BaseBlock>();
|
||||
private TupleArrayList<BlockVector, BaseBlock> stage1 = new TupleArrayList<>();
|
||||
private TupleArrayList<BlockVector, BaseBlock> stage2 = new TupleArrayList<>();
|
||||
private TupleArrayList<BlockVector, BaseBlock> stage3 = new TupleArrayList<>();
|
||||
private boolean enabled;
|
||||
|
||||
/**
|
||||
@ -127,8 +127,8 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
|
||||
public Operation resume(RunContext run) throws WorldEditException {
|
||||
Extent extent = getExtent();
|
||||
|
||||
final Set<BlockVector> blocks = new HashSet<BlockVector>();
|
||||
final Map<BlockVector, BaseBlock> blockTypes = new HashMap<BlockVector, BaseBlock>();
|
||||
final Set<BlockVector> blocks = new HashSet<>();
|
||||
final Map<BlockVector, BaseBlock> blockTypes = new HashMap<>();
|
||||
for (Map.Entry<BlockVector, BaseBlock> entry : stage3) {
|
||||
final BlockVector pt = entry.getKey();
|
||||
blocks.add(pt);
|
||||
@ -141,7 +141,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder
|
||||
continue;
|
||||
}
|
||||
|
||||
final Deque<BlockVector> walked = new LinkedList<BlockVector>();
|
||||
final Deque<BlockVector> walked = new LinkedList<>();
|
||||
|
||||
while (true) {
|
||||
walked.addFirst(current);
|
||||
|
@ -40,7 +40,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class FastModeExtent extends AbstractDelegateExtent {
|
||||
|
||||
private final World world;
|
||||
private final Set<BlockVector2D> dirtyChunks = new HashSet<BlockVector2D>();
|
||||
private final Set<BlockVector2D> dirtyChunks = new HashSet<>();
|
||||
private boolean enabled = true;
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,6 @@ package com.sk89q.worldedit.extent.world;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
Reference in New Issue
Block a user