Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-07 20:10:06 +01:00
Code cleaning
Most notable change: Remove redundant type parameters and replaced with <>. This is a small step to bring us closer to upstream parity.
Dieser Commit ist enthalten in:
Ursprung
3236bdd78e
Commit
85bfd16d7c
@ -79,7 +79,7 @@ public class Brushes
|
|||||||
*/
|
*/
|
||||||
public Set<String> getSniperBrushHandles(Class<? extends IBrush> clazz)
|
public Set<String> getSniperBrushHandles(Class<? extends IBrush> clazz)
|
||||||
{
|
{
|
||||||
return new HashSet<String>(brushes.get(clazz));
|
return new HashSet<>(brushes.get(clazz));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,7 +26,7 @@ public class VoxelSniperListener implements Listener
|
|||||||
|
|
||||||
private static final String SNIPER_PERMISSION = "voxelsniper.sniper";
|
private static final String SNIPER_PERMISSION = "voxelsniper.sniper";
|
||||||
private final VoxelSniper plugin;
|
private final VoxelSniper plugin;
|
||||||
private Map<String, VoxelCommand> commands = new HashMap<String, VoxelCommand>();
|
private Map<String, VoxelCommand> commands = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin
|
* @param plugin
|
||||||
|
@ -13,7 +13,7 @@ import org.bukkit.block.Block;
|
|||||||
*/
|
*/
|
||||||
public class BlockResetBrush extends Brush
|
public class BlockResetBrush extends Brush
|
||||||
{
|
{
|
||||||
private static final ArrayList<Material> DENIED_UPDATES = new ArrayList<Material>();
|
private static final ArrayList<Material> DENIED_UPDATES = new ArrayList<>();
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ public class DomeBrush extends Brush
|
|||||||
final int absoluteHeight = Math.abs(v.getVoxelHeight());
|
final int absoluteHeight = Math.abs(v.getVoxelHeight());
|
||||||
final boolean negative = v.getVoxelHeight() < 0;
|
final boolean negative = v.getVoxelHeight() < 0;
|
||||||
|
|
||||||
final Set<Vector> changeablePositions = new HashSet<Vector>();
|
final Set<Vector> changeablePositions = new HashSet<>();
|
||||||
|
|
||||||
final Undo undo = new Undo();
|
final Undo undo = new Undo();
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import java.util.regex.PatternSyntaxException;
|
|||||||
*/
|
*/
|
||||||
public class EntityRemovalBrush extends Brush
|
public class EntityRemovalBrush extends Brush
|
||||||
{
|
{
|
||||||
private final List<String> exemptions = new ArrayList<String>(3);
|
private final List<String> exemptions = new ArrayList<>(3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -82,7 +82,7 @@ public class EntityRemovalBrush extends Brush
|
|||||||
private boolean isClassInExemptionList(Class<? extends Entity> entityClass) throws PatternSyntaxException
|
private boolean isClassInExemptionList(Class<? extends Entity> entityClass) throws PatternSyntaxException
|
||||||
{
|
{
|
||||||
// Create a list of superclasses and interfaces implemented by the current entity type
|
// Create a list of superclasses and interfaces implemented by the current entity type
|
||||||
final List<String> entityClassHierarchy = new ArrayList<String>();
|
final List<String> entityClassHierarchy = new ArrayList<>();
|
||||||
|
|
||||||
Class<?> currentClass = entityClass;
|
Class<?> currentClass = entityClass;
|
||||||
while (currentClass != null && !currentClass.equals(Object.class))
|
while (currentClass != null && !currentClass.equals(Object.class))
|
||||||
|
@ -133,7 +133,7 @@ public class ErodeBrush extends Brush
|
|||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
final Map<BlockWrapper, Integer> blockCount = new HashMap<BlockWrapper, Integer>();
|
final Map<BlockWrapper, Integer> blockCount = new HashMap<>();
|
||||||
|
|
||||||
for (final Vector vector : ErodeBrush.FACES_TO_CHECK)
|
for (final Vector vector : ErodeBrush.FACES_TO_CHECK)
|
||||||
{
|
{
|
||||||
@ -363,8 +363,8 @@ public class ErodeBrush extends Brush
|
|||||||
|
|
||||||
public BlockChangeTracker(final AsyncWorld world)
|
public BlockChangeTracker(final AsyncWorld world)
|
||||||
{
|
{
|
||||||
this.blockChanges = new HashMap<Integer, Map<Vector, BlockWrapper>>();
|
this.blockChanges = new HashMap<>();
|
||||||
this.flatChanges = new HashMap<Vector, BlockWrapper>();
|
this.flatChanges = new HashMap<>();
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +400,7 @@ public class ErodeBrush extends Brush
|
|||||||
{
|
{
|
||||||
if (!this.blockChanges.containsKey(iteration))
|
if (!this.blockChanges.containsKey(iteration))
|
||||||
{
|
{
|
||||||
this.blockChanges.put(iteration, new HashMap<Vector, BlockWrapper>());
|
this.blockChanges.put(iteration, new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.blockChanges.get(iteration).put(position, changedBlock);
|
this.blockChanges.get(iteration).put(position, changedBlock);
|
||||||
|
@ -24,7 +24,7 @@ public class GenerateTreeBrush extends Brush
|
|||||||
{
|
{
|
||||||
// Tree Variables.
|
// Tree Variables.
|
||||||
private Random randGenerator = new Random();
|
private Random randGenerator = new Random();
|
||||||
private ArrayList<Block> branchBlocks = new ArrayList<Block>();
|
private ArrayList<Block> branchBlocks = new ArrayList<>();
|
||||||
private Undo undo;
|
private Undo undo;
|
||||||
// If these default values are edited. Remember to change default values in the default preset.
|
// If these default values are edited. Remember to change default values in the default preset.
|
||||||
private Material leafType = Material.OAK_LEAVES;
|
private Material leafType = Material.OAK_LEAVES;
|
||||||
|
@ -44,7 +44,7 @@ public class HeatRayBrush extends Brush
|
|||||||
private static final double REQUIRED_FIRE_DENSITY = -0.25;
|
private static final double REQUIRED_FIRE_DENSITY = -0.25;
|
||||||
private static final double REQUIRED_AIR_DENSITY = 0;
|
private static final double REQUIRED_AIR_DENSITY = 0;
|
||||||
|
|
||||||
private static final ArrayList<Material> FLAMABLE_BLOCKS = new ArrayList<Material>();
|
private static final ArrayList<Material> FLAMABLE_BLOCKS = new ArrayList<>();
|
||||||
|
|
||||||
private int octaves = 5;
|
private int octaves = 5;
|
||||||
private double frequency = 1;
|
private double frequency = 1;
|
||||||
|
@ -58,7 +58,7 @@ public class MoveBrush extends Brush
|
|||||||
final AsyncWorld world = selection.getBlockStates().get(0).getWorld();
|
final AsyncWorld world = selection.getBlockStates().get(0).getWorld();
|
||||||
|
|
||||||
final Undo undo = new Undo();
|
final Undo undo = new Undo();
|
||||||
final HashSet<Block> undoSet = new HashSet<Block>();
|
final HashSet<Block> undoSet = new HashSet<>();
|
||||||
|
|
||||||
final Selection newSelection = new Selection();
|
final Selection newSelection = new Selection();
|
||||||
final Location movedLocation1 = selection.getLocation1();
|
final Location movedLocation1 = selection.getLocation1();
|
||||||
@ -214,7 +214,7 @@ public class MoveBrush extends Brush
|
|||||||
/**
|
/**
|
||||||
* Calculated BlockStates of the selection.
|
* Calculated BlockStates of the selection.
|
||||||
*/
|
*/
|
||||||
private final ArrayList<AsyncBlockState> blockStates = new ArrayList<AsyncBlockState>();
|
private final ArrayList<AsyncBlockState> blockStates = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +14,7 @@ import java.util.HashSet;
|
|||||||
*/
|
*/
|
||||||
public class PullBrush extends Brush
|
public class PullBrush extends Brush
|
||||||
{
|
{
|
||||||
private final HashSet<BlockWrapper> surface = new HashSet<BlockWrapper>();
|
private final HashSet<BlockWrapper> surface = new HashSet<>();
|
||||||
private int vh;
|
private int vh;
|
||||||
private double c1 = 1;
|
private double c1 = 1;
|
||||||
private double c2 = 0;
|
private double c2 = 0;
|
||||||
|
@ -57,7 +57,8 @@ public class ShellSetBrush extends Brush
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final ArrayList<AsyncBlock> blocks = new ArrayList<AsyncBlock>(((Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY)) / 2));
|
final ArrayList<AsyncBlock> blocks = new ArrayList<>(
|
||||||
|
((Math.abs(highX - lowX) * Math.abs(highZ - lowZ) * Math.abs(highY - lowY)) / 2));
|
||||||
for (int y = lowY; y <= highY; y++)
|
for (int y = lowY; y <= highY; y++)
|
||||||
{
|
{
|
||||||
for (int x = lowX; x <= highX; x++)
|
for (int x = lowX; x <= highX; x++)
|
||||||
|
@ -16,9 +16,9 @@ import java.util.ArrayList;
|
|||||||
*/
|
*/
|
||||||
public class SplineBrush extends PerformBrush
|
public class SplineBrush extends PerformBrush
|
||||||
{
|
{
|
||||||
private final ArrayList<Block> endPts = new ArrayList<Block>();
|
private final ArrayList<Block> endPts = new ArrayList<>();
|
||||||
private final ArrayList<Block> ctrlPts = new ArrayList<Block>();
|
private final ArrayList<Block> ctrlPts = new ArrayList<>();
|
||||||
protected ArrayList<Point> spline = new ArrayList<Point>();
|
protected ArrayList<Point> spline = new ArrayList<>();
|
||||||
protected boolean set;
|
protected boolean set;
|
||||||
protected boolean ctrl;
|
protected boolean ctrl;
|
||||||
protected String[] sparams = {"ss", "sc", "clear"};
|
protected String[] sparams = {"ss", "sc", "clear"};
|
||||||
|
@ -52,10 +52,10 @@ public class StampBrush extends Brush
|
|||||||
NO_AIR, FILL, DEFAULT
|
NO_AIR, FILL, DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HashSet<BlockWrapper> clone = new HashSet<BlockWrapper>();
|
protected HashSet<BlockWrapper> clone = new HashSet<>();
|
||||||
protected HashSet<BlockWrapper> fall = new HashSet<BlockWrapper>();
|
protected HashSet<BlockWrapper> fall = new HashSet<>();
|
||||||
protected HashSet<BlockWrapper> drop = new HashSet<BlockWrapper>();
|
protected HashSet<BlockWrapper> drop = new HashSet<>();
|
||||||
protected HashSet<BlockWrapper> solid = new HashSet<BlockWrapper>();
|
protected HashSet<BlockWrapper> solid = new HashSet<>();
|
||||||
protected Undo undo;
|
protected Undo undo;
|
||||||
protected boolean sorted = false;
|
protected boolean sorted = false;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class StencilListBrush extends Brush
|
|||||||
private short zRef;
|
private short zRef;
|
||||||
private short yRef;
|
private short yRef;
|
||||||
private byte pasteParam = 0;
|
private byte pasteParam = 0;
|
||||||
private HashMap<Integer, String> stencilList = new HashMap<Integer, String>();
|
private HashMap<Integer, String> stencilList = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -163,8 +163,8 @@ public enum PerformerE
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
performers = new TreeMap<String, vPerformer>();
|
performers = new TreeMap<>();
|
||||||
long_names = new TreeMap<String, String>();
|
long_names = new TreeMap<>();
|
||||||
|
|
||||||
for (PerformerE pe : values())
|
for (PerformerE pe : values())
|
||||||
{
|
{
|
||||||
|
@ -165,7 +165,7 @@ public class HelpJSAP extends JSAP
|
|||||||
{
|
{
|
||||||
if (!(jsapResult.success()) || jsapResult.getBoolean("help"))
|
if (!(jsapResult.success()) || jsapResult.getBoolean("help"))
|
||||||
{
|
{
|
||||||
List<String> returnValue = new LinkedList<String>();
|
List<String> returnValue = new LinkedList<>();
|
||||||
// To avoid spurious missing argument errors we never print errors if help is required.
|
// To avoid spurious missing argument errors we never print errors if help is required.
|
||||||
if (!jsapResult.getBoolean("help"))
|
if (!jsapResult.getBoolean("help"))
|
||||||
{
|
{
|
||||||
|
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
|||||||
|
#Mon Mar 25 18:59:14 EDT 2019
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
|
||||||
|
@ -9,7 +9,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile project(':worldedit-core')
|
compile project(':worldedit-core')
|
||||||
compile 'net.milkbowl.vault:VaultAPI:1.7'
|
compile 'net.milkbowl.vault:VaultAPI:1.7'
|
||||||
compile 'com.sk89q:dummypermscompat:1.8'
|
compile 'com.sk89q:dummypermscompat:1.10'
|
||||||
compile 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT'
|
compile 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT'
|
||||||
compile 'org.spigotmc:spigot:1.13.2-R0.1-SNAPSHOT'
|
compile 'org.spigotmc:spigot:1.13.2-R0.1-SNAPSHOT'
|
||||||
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
|
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
|
||||||
|
@ -43,7 +43,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* All of the custom graphs to submit to metrics.
|
* All of the custom graphs to submit to metrics.
|
||||||
*/
|
*/
|
||||||
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>());
|
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<>());
|
||||||
/**
|
/**
|
||||||
* Unique server id.
|
* Unique server id.
|
||||||
*/
|
*/
|
||||||
|
@ -29,7 +29,7 @@ final class JsonString implements JsonRepresentedObject, ConfigurationSerializab
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> serialize() {
|
public Map<String, Object> serialize() {
|
||||||
HashMap<String, Object> theSingleValue = new HashMap<String, Object>();
|
HashMap<String, Object> theSingleValue = new HashMap<>();
|
||||||
theSingleValue.put("stringValue", _value);
|
theSingleValue.put("stringValue", _value);
|
||||||
return theSingleValue;
|
return theSingleValue;
|
||||||
}
|
}
|
||||||
|
@ -177,12 +177,12 @@ public final class Reflection {
|
|||||||
*/
|
*/
|
||||||
public synchronized static Method getMethod(Class<?> clazz, String name, Class<?>... args) {
|
public synchronized static Method getMethod(Class<?> clazz, String name, Class<?>... args) {
|
||||||
if (!_loadedMethods.containsKey(clazz)) {
|
if (!_loadedMethods.containsKey(clazz)) {
|
||||||
_loadedMethods.put(clazz, new HashMap<String, Map<ArrayWrapper<Class<?>>, Method>>());
|
_loadedMethods.put(clazz, new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Map<ArrayWrapper<Class<?>>, Method>> loadedMethodNames = _loadedMethods.get(clazz);
|
Map<String, Map<ArrayWrapper<Class<?>>, Method>> loadedMethodNames = _loadedMethods.get(clazz);
|
||||||
if (!loadedMethodNames.containsKey(name)) {
|
if (!loadedMethodNames.containsKey(name)) {
|
||||||
loadedMethodNames.put(name, new HashMap<ArrayWrapper<Class<?>>, Method>());
|
loadedMethodNames.put(name, new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<ArrayWrapper<Class<?>>, Method> loadedSignatures = loadedMethodNames.get(name);
|
Map<ArrayWrapper<Class<?>>, Method> loadedSignatures = loadedMethodNames.get(name);
|
||||||
|
@ -72,7 +72,7 @@ public class BukkitImageListener implements Listener {
|
|||||||
String name = player.getName().toLowerCase();
|
String name = player.getName().toLowerCase();
|
||||||
if (!event.getMessage().toLowerCase().contains(name)) {
|
if (!event.getMessage().toLowerCase().contains(name)) {
|
||||||
ArrayDeque<String> buffered = fp.getMeta("CFIBufferedMessages");
|
ArrayDeque<String> buffered = fp.getMeta("CFIBufferedMessages");
|
||||||
if (buffered == null) fp.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<String>());
|
if (buffered == null) fp.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<>());
|
||||||
String full = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
|
String full = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
|
||||||
buffered.add(full);
|
buffered.add(full);
|
||||||
iter.remove();
|
iter.remove();
|
||||||
|
@ -69,7 +69,7 @@ public class ItemUtil {
|
|||||||
if (nativeTag != null) return (CompoundTag) nativeTag;
|
if (nativeTag != null) return (CompoundTag) nativeTag;
|
||||||
}
|
}
|
||||||
Tag nativeTag = BukkitQueue_0.toNative(nmsTag);
|
Tag nativeTag = BukkitQueue_0.toNative(nmsTag);
|
||||||
map.put(nmsTag.hashCode(), new WeakReference<Tag>(nativeTag));
|
map.put(nmsTag.hashCode(), new WeakReference<>(nativeTag));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -154,7 +154,7 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
|
|||||||
Object nmsChunk = methodGetHandleChunk.invoke(chunk);
|
Object nmsChunk = methodGetHandleChunk.invoke(chunk);
|
||||||
boolean mustSave = saveChunks && (boolean) methodNeedsSaving.invoke(nmsChunk, false);
|
boolean mustSave = saveChunks && (boolean) methodNeedsSaving.invoke(nmsChunk, false);
|
||||||
chunk.unload(mustSave, false);
|
chunk.unload(mustSave, false);
|
||||||
if (unloaded == null) unloaded = new ArrayDeque<Chunk>();
|
if (unloaded == null) unloaded = new ArrayDeque<>();
|
||||||
unloaded.add(chunk);
|
unloaded.add(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public class MobSpawnerBlock extends BaseBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getNbtData() {
|
public CompoundTag getNbtData() {
|
||||||
Map<String, Tag> values = new HashMap<String, Tag>();
|
Map<String, Tag> values = new HashMap<>();
|
||||||
values.put("EntityId", new StringTag(mobType));
|
values.put("EntityId", new StringTag(mobType));
|
||||||
values.put("Delay", new ShortTag(delay));
|
values.put("Delay", new ShortTag(delay));
|
||||||
values.put("SpawnCount", new ShortTag(spawnCount));
|
values.put("SpawnCount", new ShortTag(spawnCount));
|
||||||
|
@ -92,7 +92,7 @@ public class SignBlock extends BaseBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getNbtData() {
|
public CompoundTag getNbtData() {
|
||||||
Map<String, Tag> values = new HashMap<String, Tag>();
|
Map<String, Tag> values = new HashMap<>();
|
||||||
values.put("Text1", new StringTag(text[0]));
|
values.put("Text1", new StringTag(text[0]));
|
||||||
values.put("Text2", new StringTag(text[1]));
|
values.put("Text2", new StringTag(text[1]));
|
||||||
values.put("Text3", new StringTag(text[2]));
|
values.put("Text3", new StringTag(text[2]));
|
||||||
|
@ -378,7 +378,7 @@ public class FaweAPI {
|
|||||||
});
|
});
|
||||||
RegionWrapper bounds = new RegionWrapper(origin.x - radius, origin.x + radius, origin.z - radius, origin.z + radius);
|
RegionWrapper bounds = new RegionWrapper(origin.x - radius, origin.x + radius, origin.z - radius, origin.z + radius);
|
||||||
RegionWrapper boundsPlus = new RegionWrapper(bounds.minX - 64, bounds.maxX + 512, bounds.minZ - 64, bounds.maxZ + 512);
|
RegionWrapper boundsPlus = new RegionWrapper(bounds.minX - 64, bounds.maxX + 512, bounds.minZ - 64, bounds.maxZ + 512);
|
||||||
HashSet<RegionWrapper> regionSet = new HashSet<RegionWrapper>(Arrays.asList(bounds));
|
HashSet<RegionWrapper> regionSet = new HashSet<>(Arrays.asList(bounds));
|
||||||
ArrayList<DiskStorageHistory> result = new ArrayList<>();
|
ArrayList<DiskStorageHistory> result = new ArrayList<>();
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
UUID uuid = UUID.fromString(file.getParentFile().getName());
|
UUID uuid = UUID.fromString(file.getParentFile().getName());
|
||||||
|
@ -76,7 +76,7 @@ public class FaweCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, Object> asMap(Object... pairs) {
|
public static Map<String, Object> asMap(Object... pairs) {
|
||||||
HashMap<String, Object> map = new HashMap<String, Object>(pairs.length >> 1);
|
HashMap<String, Object> map = new HashMap<>(pairs.length >> 1);
|
||||||
for (int i = 0; i < pairs.length; i += 2) {
|
for (int i = 0; i < pairs.length; i += 2) {
|
||||||
String key = (String) pairs[i];
|
String key = (String) pairs[i];
|
||||||
Object value = pairs[i + 1];
|
Object value = pairs[i + 1];
|
||||||
|
@ -33,9 +33,9 @@ public final class TypeDescription {
|
|||||||
public TypeDescription(Class<? extends Object> clazz, Tag tag) {
|
public TypeDescription(Class<? extends Object> clazz, Tag tag) {
|
||||||
this.type = clazz;
|
this.type = clazz;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
listProperties = new HashMap<String, Class<? extends Object>>();
|
listProperties = new HashMap<>();
|
||||||
keyProperties = new HashMap<String, Class<? extends Object>>();
|
keyProperties = new HashMap<>();
|
||||||
valueProperties = new HashMap<String, Class<? extends Object>>();
|
valueProperties = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeDescription(Class<? extends Object> clazz, String tag) {
|
public TypeDescription(Class<? extends Object> clazz, String tag) {
|
||||||
|
@ -175,7 +175,7 @@ public class Yaml {
|
|||||||
* @return YAML String
|
* @return YAML String
|
||||||
*/
|
*/
|
||||||
public String dump(Object data) {
|
public String dump(Object data) {
|
||||||
List<Object> list = new ArrayList<Object>(1);
|
List<Object> list = new ArrayList<>(1);
|
||||||
list.add(data);
|
list.add(data);
|
||||||
return dumpAll(list.iterator());
|
return dumpAll(list.iterator());
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ public class Yaml {
|
|||||||
* stream to write to
|
* stream to write to
|
||||||
*/
|
*/
|
||||||
public void dump(Object data, Writer output) {
|
public void dump(Object data, Writer output) {
|
||||||
List<Object> list = new ArrayList<Object>(1);
|
List<Object> list = new ArrayList<>(1);
|
||||||
list.add(data);
|
list.add(data);
|
||||||
dumpAll(list.iterator(), output, null);
|
dumpAll(list.iterator(), output, null);
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ public class Yaml {
|
|||||||
if (flowStyle != null) {
|
if (flowStyle != null) {
|
||||||
representer.setDefaultFlowStyle(flowStyle);
|
representer.setDefaultFlowStyle(flowStyle);
|
||||||
}
|
}
|
||||||
List<Object> list = new ArrayList<Object>(1);
|
List<Object> list = new ArrayList<>(1);
|
||||||
list.add(data);
|
list.add(data);
|
||||||
StringWriter buffer = new StringWriter();
|
StringWriter buffer = new StringWriter();
|
||||||
dumpAll(list.iterator(), buffer, rootTag);
|
dumpAll(list.iterator(), buffer, rootTag);
|
||||||
@ -345,7 +345,7 @@ public class Yaml {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class SilentEmitter implements Emitable {
|
private static class SilentEmitter implements Emitable {
|
||||||
private List<Event> events = new ArrayList<Event>(100);
|
private List<Event> events = new ArrayList<>(100);
|
||||||
|
|
||||||
public List<Event> getEvents() {
|
public List<Event> getEvents() {
|
||||||
return events;
|
return events;
|
||||||
|
@ -16,7 +16,7 @@ public class ConfigurationSerialization {
|
|||||||
|
|
||||||
public static final String SERIALIZED_TYPE_KEY = "==";
|
public static final String SERIALIZED_TYPE_KEY = "==";
|
||||||
private static final Map<String, Class<? extends ConfigurationSerializable>> aliases =
|
private static final Map<String, Class<? extends ConfigurationSerializable>> aliases =
|
||||||
new HashMap<String, Class<? extends ConfigurationSerializable>>();
|
new HashMap<>();
|
||||||
private final Class<? extends ConfigurationSerializable> clazz;
|
private final Class<? extends ConfigurationSerializable> clazz;
|
||||||
|
|
||||||
protected ConfigurationSerialization(Class<? extends ConfigurationSerializable> clazz) {
|
protected ConfigurationSerialization(Class<? extends ConfigurationSerializable> clazz) {
|
||||||
|
@ -163,7 +163,7 @@ public abstract class IntFaweChunk<T, V extends FaweQueue> extends FaweChunk<T>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Short, CompoundTag> getTiles() {
|
public Map<Short, CompoundTag> getTiles() {
|
||||||
return tiles == null ? new HashMap<Short, CompoundTag>() : tiles;
|
return tiles == null ? new HashMap<>() : tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -189,7 +189,7 @@ public abstract class IntFaweChunk<T, V extends FaweQueue> extends FaweChunk<T>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashSet<UUID> getEntityRemoves() {
|
public HashSet<UUID> getEntityRemoves() {
|
||||||
return entityRemoves == null ? new HashSet<UUID>() : entityRemoves;
|
return entityRemoves == null ? new HashSet<>() : entityRemoves;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -123,7 +123,7 @@ public class WeakFaweQueueMap implements IFaweQueueMap {
|
|||||||
@Override
|
@Override
|
||||||
public void add(FaweChunk chunk) {
|
public void add(FaweChunk chunk) {
|
||||||
long pair = MathMan.pairInt(chunk.getX(), chunk.getZ());
|
long pair = MathMan.pairInt(chunk.getX(), chunk.getZ());
|
||||||
Reference<FaweChunk> previous = this.blocks.put(pair, new SoftReference<FaweChunk>(chunk));
|
Reference<FaweChunk> previous = this.blocks.put(pair, new SoftReference<>(chunk));
|
||||||
if (previous != null) {
|
if (previous != null) {
|
||||||
FaweChunk previousChunk = previous.get();
|
FaweChunk previousChunk = previous.get();
|
||||||
if (previousChunk != null) {
|
if (previousChunk != null) {
|
||||||
|
@ -406,7 +406,7 @@ public class JSON2NBT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Tag parse() throws NBTException {
|
public Tag parse() throws NBTException {
|
||||||
HashMap<String, Tag> map = new HashMap<String, Tag>();
|
HashMap<String, Tag> map = new HashMap<>();
|
||||||
Iterator var2 = this.tagList.iterator();
|
Iterator var2 = this.tagList.iterator();
|
||||||
|
|
||||||
while (var2.hasNext()) {
|
while (var2.hasNext()) {
|
||||||
|
@ -102,12 +102,13 @@ public class MCAChunk extends FaweChunk<Void> {
|
|||||||
if (entities.isEmpty()) {
|
if (entities.isEmpty()) {
|
||||||
out.writeNamedEmptyList("Entities");
|
out.writeNamedEmptyList("Entities");
|
||||||
} else {
|
} else {
|
||||||
out.writeNamedTag("Entities", new ListTag(CompoundTag.class, new ArrayList<CompoundTag>(entities.values())));
|
out.writeNamedTag("Entities", new ListTag(CompoundTag.class, new ArrayList<>(entities.values())));
|
||||||
}
|
}
|
||||||
if (tiles.isEmpty()) {
|
if (tiles.isEmpty()) {
|
||||||
out.writeNamedEmptyList("TileEntities");
|
out.writeNamedEmptyList("TileEntities");
|
||||||
} else {
|
} else {
|
||||||
out.writeNamedTag("TileEntities", new ListTag(CompoundTag.class, new ArrayList<CompoundTag>(tiles.values())));
|
out.writeNamedTag("TileEntities", new ListTag(CompoundTag.class,
|
||||||
|
new ArrayList<>(tiles.values())));
|
||||||
}
|
}
|
||||||
out.writeNamedTag("InhabitedTime", inhabitedTime);
|
out.writeNamedTag("InhabitedTime", inhabitedTime);
|
||||||
out.writeNamedTag("LastUpdate", lastUpdate);
|
out.writeNamedTag("LastUpdate", lastUpdate);
|
||||||
@ -422,9 +423,9 @@ public class MCAChunk extends FaweChunk<Void> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// e.g. by precalculating the length
|
// e.g. by precalculating the length
|
||||||
HashMap<String, Object> level = new HashMap<String, Object>();
|
HashMap<String, Object> level = new HashMap<>();
|
||||||
level.put("Entities", new ListTag(CompoundTag.class, new ArrayList<CompoundTag>(entities.values())));
|
level.put("Entities", new ListTag(CompoundTag.class, new ArrayList<>(entities.values())));
|
||||||
level.put("TileEntities", new ListTag(CompoundTag.class, new ArrayList<CompoundTag>(tiles.values())));
|
level.put("TileEntities", new ListTag(CompoundTag.class, new ArrayList<>(tiles.values())));
|
||||||
level.put("InhabitedTime", inhabitedTime);
|
level.put("InhabitedTime", inhabitedTime);
|
||||||
level.put("LastUpdate", lastUpdate);
|
level.put("LastUpdate", lastUpdate);
|
||||||
level.put("LightPopulated", (byte) 0);
|
level.put("LightPopulated", (byte) 0);
|
||||||
@ -442,7 +443,7 @@ public class MCAChunk extends FaweChunk<Void> {
|
|||||||
if (idLayer == null) {
|
if (idLayer == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("Y", (byte) layer);
|
map.put("Y", (byte) layer);
|
||||||
map.put("BlockLight", blockLight[layer]);
|
map.put("BlockLight", blockLight[layer]);
|
||||||
map.put("SkyLight", skyLight[layer]);
|
map.put("SkyLight", skyLight[layer]);
|
||||||
@ -499,7 +500,7 @@ public class MCAChunk extends FaweChunk<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public void accept(Integer index, CompoundTag entityTag) {
|
public void accept(Integer index, CompoundTag entityTag) {
|
||||||
if (entities == null) {
|
if (entities == null) {
|
||||||
entities = new HashMap<UUID, CompoundTag>();
|
entities = new HashMap<>();
|
||||||
}
|
}
|
||||||
long least = entityTag.getLong("UUIDLeast");
|
long least = entityTag.getLong("UUIDLeast");
|
||||||
long most = entityTag.getLong("UUIDMost");
|
long most = entityTag.getLong("UUIDMost");
|
||||||
@ -635,7 +636,7 @@ public class MCAChunk extends FaweChunk<Void> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Short, CompoundTag> getTiles() {
|
public Map<Short, CompoundTag> getTiles() {
|
||||||
return tiles == null ? new HashMap<Short, CompoundTag>() : tiles;
|
return tiles == null ? new HashMap<>() : tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,7 +21,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
|||||||
private int x, z;
|
private int x, z;
|
||||||
public static int HEIGHT = 256;
|
public static int HEIGHT = 256;
|
||||||
|
|
||||||
private final ArrayDeque<Runnable> tasks = new ArrayDeque<Runnable>(0);
|
private final ArrayDeque<Runnable> tasks = new ArrayDeque<>(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A FaweSections object represents a chunk and the blocks that you wish to change in it.
|
* A FaweSections object represents a chunk and the blocks that you wish to change in it.
|
||||||
|
@ -97,7 +97,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<? extends Entity> wrapEntities(final List<? extends Entity> entities) {
|
private List<? extends Entity> wrapEntities(final List<? extends Entity> entities) {
|
||||||
final List<Entity> newList = new ArrayList<Entity>(entities.size());
|
final List<Entity> newList = new ArrayList<>(entities.size());
|
||||||
for (final Entity entity : entities) {
|
for (final Entity entity : entities) {
|
||||||
newList.add(new TrackedEntity(entity));
|
newList.add(new TrackedEntity(entity));
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ public class SplineBrush implements Brush, ResettableTool {
|
|||||||
double continuity = 0;
|
double continuity = 0;
|
||||||
double quality = 10;
|
double quality = 10;
|
||||||
|
|
||||||
final List<Node> nodes = new ArrayList<Node>(centroids.size());
|
final List<Node> nodes = new ArrayList<>(centroids.size());
|
||||||
|
|
||||||
for (final Vector3 nodevector : centroids) {
|
for (final Vector3 nodevector : centroids) {
|
||||||
final Node n = new Node(nodevector);
|
final Node n = new Node(nodevector);
|
||||||
|
@ -491,7 +491,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
|||||||
public Map<Integer, Double> getPercents() {
|
public Map<Integer, Double> getPercents() {
|
||||||
Map<Integer, Integer> map = getBlocks();
|
Map<Integer, Integer> map = getBlocks();
|
||||||
int count = getSize();
|
int count = getSize();
|
||||||
Int2ObjectOpenHashMap<Double> newMap = new Int2ObjectOpenHashMap<Double>();
|
Int2ObjectOpenHashMap<Double> newMap = new Int2ObjectOpenHashMap<>();
|
||||||
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
|
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
|
||||||
int id = entry.getKey();
|
int id = entry.getKey();
|
||||||
int changes = entry.getValue();
|
int changes = entry.getValue();
|
||||||
|
@ -12,7 +12,7 @@ import java.util.concurrent.ConcurrentLinkedDeque;
|
|||||||
|
|
||||||
public abstract class IterableThreadLocal<T> extends ThreadLocal<T> implements Iterable<T> {
|
public abstract class IterableThreadLocal<T> extends ThreadLocal<T> implements Iterable<T> {
|
||||||
private ThreadLocal<T> flag;
|
private ThreadLocal<T> flag;
|
||||||
private ConcurrentLinkedDeque<T> allValues = new ConcurrentLinkedDeque<T>();
|
private ConcurrentLinkedDeque<T> allValues = new ConcurrentLinkedDeque<>();
|
||||||
|
|
||||||
public IterableThreadLocal() {
|
public IterableThreadLocal() {
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
public class SimpleRandomCollection<E> extends RandomCollection<E> {
|
public class SimpleRandomCollection<E> extends RandomCollection<E> {
|
||||||
|
|
||||||
private final NavigableMap<Double, E> map = new TreeMap<Double, E>();
|
private final NavigableMap<Double, E> map = new TreeMap<>();
|
||||||
private double total = 0;
|
private double total = 0;
|
||||||
|
|
||||||
public SimpleRandomCollection(Map<E, Double> weights, SimpleRandom random) {
|
public SimpleRandomCollection(Map<E, Double> weights, SimpleRandom random) {
|
||||||
|
@ -93,10 +93,10 @@ public class SoftHashMap<K, V> implements Map<K, V> {
|
|||||||
public SoftHashMap(int retentionSize) {
|
public SoftHashMap(int retentionSize) {
|
||||||
super();
|
super();
|
||||||
RETENTION_SIZE = Math.max(0, retentionSize);
|
RETENTION_SIZE = Math.max(0, retentionSize);
|
||||||
queue = new ReferenceQueue<V>();
|
queue = new ReferenceQueue<>();
|
||||||
strongReferencesLock = new ReentrantLock();
|
strongReferencesLock = new ReentrantLock();
|
||||||
map = new ConcurrentHashMap<K, SoftValue<V, K>>();
|
map = new ConcurrentHashMap<>();
|
||||||
strongReferences = new ConcurrentLinkedQueue<V>();
|
strongReferences = new ConcurrentLinkedQueue<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -223,7 +223,7 @@ public class SoftHashMap<K, V> implements Map<K, V> {
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return Collections.EMPTY_SET;
|
return Collections.EMPTY_SET;
|
||||||
}
|
}
|
||||||
Collection<V> values = new ArrayList<V>(keys.size());
|
Collection<V> values = new ArrayList<>(keys.size());
|
||||||
for (K key : keys) {
|
for (K key : keys) {
|
||||||
V v = get(key);
|
V v = get(key);
|
||||||
if (v != null) {
|
if (v != null) {
|
||||||
@ -238,7 +238,7 @@ public class SoftHashMap<K, V> implements Map<K, V> {
|
|||||||
*/
|
*/
|
||||||
public V put(K key, V value) {
|
public V put(K key, V value) {
|
||||||
processQueue(); // throw out garbage collected values first
|
processQueue(); // throw out garbage collected values first
|
||||||
SoftValue<V, K> sv = new SoftValue<V, K>(value, key, queue);
|
SoftValue<V, K> sv = new SoftValue<>(value, key, queue);
|
||||||
SoftValue<V, K> previous = map.put(key, sv);
|
SoftValue<V, K> previous = map.put(key, sv);
|
||||||
addToStrongReferences(value);
|
addToStrongReferences(value);
|
||||||
return previous != null ? previous.get() : null;
|
return previous != null ? previous.get() : null;
|
||||||
@ -274,7 +274,7 @@ public class SoftHashMap<K, V> implements Map<K, V> {
|
|||||||
return Collections.EMPTY_SET;
|
return Collections.EMPTY_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<K, V> kvPairs = new HashMap<K, V>(keys.size());
|
Map<K, V> kvPairs = new HashMap<>(keys.size());
|
||||||
for (K key : keys) {
|
for (K key : keys) {
|
||||||
V v = get(key);
|
V v = get(key);
|
||||||
if (v != null) {
|
if (v != null) {
|
||||||
|
@ -39,7 +39,7 @@ public class PGZIPOutputStream extends FilterOutputStream {
|
|||||||
|
|
||||||
// todo: remove after block guessing is implemented
|
// todo: remove after block guessing is implemented
|
||||||
// array list that contains the block sizes
|
// array list that contains the block sizes
|
||||||
ArrayList<Integer> blockSizes = new ArrayList<Integer>();
|
ArrayList<Integer> blockSizes = new ArrayList<>();
|
||||||
|
|
||||||
private int level = Deflater.DEFAULT_COMPRESSION;
|
private int level = Deflater.DEFAULT_COMPRESSION;
|
||||||
private int strategy = Deflater.DEFAULT_STRATEGY;
|
private int strategy = Deflater.DEFAULT_STRATEGY;
|
||||||
@ -80,7 +80,7 @@ public class PGZIPOutputStream extends FilterOutputStream {
|
|||||||
super(out);
|
super(out);
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
this.nthreads = nthreads;
|
this.nthreads = nthreads;
|
||||||
this.emitQueue = new ArrayBlockingQueue<Future<byte[]>>(nthreads);
|
this.emitQueue = new ArrayBlockingQueue<>(nthreads);
|
||||||
writeHeader();
|
writeHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,17 +38,17 @@ public class PolyhedralRegion extends AbstractRegion {
|
|||||||
/**
|
/**
|
||||||
* Vertices that are contained in the convex hull.
|
* Vertices that are contained in the convex hull.
|
||||||
*/
|
*/
|
||||||
private final Set<BlockVector3> vertices = new LinkedHashSet<BlockVector3>();
|
private final Set<BlockVector3> vertices = new LinkedHashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triangles that form the convex hull.
|
* Triangles that form the convex hull.
|
||||||
*/
|
*/
|
||||||
private final List<Triangle> triangles = new ArrayList<Triangle>();
|
private final List<Triangle> triangles = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vertices that are coplanar to the first 3 vertices.
|
* Vertices that are coplanar to the first 3 vertices.
|
||||||
*/
|
*/
|
||||||
private final Set<BlockVector3> vertexBacklog = new LinkedHashSet<BlockVector3>();
|
private final Set<BlockVector3> vertexBacklog = new LinkedHashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimum point of the axis-aligned bounding box.
|
* Minimum point of the axis-aligned bounding box.
|
||||||
@ -165,7 +165,7 @@ public class PolyhedralRegion extends AbstractRegion {
|
|||||||
triangles.add((new Triangle(v[0], v[size - 1], v[size - 2])));
|
triangles.add((new Triangle(v[0], v[size - 1], v[size - 2])));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Set<Edge> borderEdges = new LinkedHashSet<Edge>();
|
final Set<Edge> borderEdges = new LinkedHashSet<>();
|
||||||
for (Iterator<Triangle> it = triangles.iterator(); it.hasNext(); ) {
|
for (Iterator<Triangle> it = triangles.iterator(); it.hasNext(); ) {
|
||||||
final Triangle triangle = it.next();
|
final Triangle triangle = it.next();
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ public class PolyhedralRegion extends AbstractRegion {
|
|||||||
vertices.remove(vertex);
|
vertices.remove(vertex);
|
||||||
|
|
||||||
// Clone, clear and work through the backlog
|
// Clone, clear and work through the backlog
|
||||||
final List<BlockVector3> vertexBacklog2 = new ArrayList<BlockVector3>(vertexBacklog);
|
final List<BlockVector3> vertexBacklog2 = new ArrayList<>(vertexBacklog);
|
||||||
vertexBacklog.clear();
|
vertexBacklog.clear();
|
||||||
for (BlockVector3 vertex2 : vertexBacklog2) {
|
for (BlockVector3 vertex2 : vertexBacklog2) {
|
||||||
addVertex(vertex2);
|
addVertex(vertex2);
|
||||||
@ -261,7 +261,7 @@ public class PolyhedralRegion extends AbstractRegion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void shiftCollection(Collection<BlockVector3> collection, BlockVector3 change) {
|
private static void shiftCollection(Collection<BlockVector3> collection, BlockVector3 change) {
|
||||||
final List<BlockVector3> tmp = new ArrayList<BlockVector3>(collection);
|
final List<BlockVector3> tmp = new ArrayList<>(collection);
|
||||||
collection.clear();
|
collection.clear();
|
||||||
for (BlockVector3 vertex : tmp) {
|
for (BlockVector3 vertex : tmp) {
|
||||||
collection.add(change.add(vertex));
|
collection.add(change.add(vertex));
|
||||||
@ -308,7 +308,7 @@ public class PolyhedralRegion extends AbstractRegion {
|
|||||||
return vertices;
|
return vertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<BlockVector3> ret = new ArrayList<BlockVector3>(vertices);
|
final List<BlockVector3> ret = new ArrayList<>(vertices);
|
||||||
ret.addAll(vertexBacklog);
|
ret.addAll(vertexBacklog);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -152,7 +152,7 @@ public class FuzzyRegionSelector extends AbstractDelegateExtent implements Regio
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getInformationLines() {
|
public List<String> getInformationLines() {
|
||||||
final List<String> lines = new ArrayList<String>();
|
final List<String> lines = new ArrayList<>();
|
||||||
for (int i = 0; i < positions.size(); i++) {
|
for (int i = 0; i < positions.size(); i++) {
|
||||||
lines.add("Position " + i + ": " + positions.get(i));
|
lines.add("Position " + i + ": " + positions.get(i));
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getInformationLines() {
|
public List<String> getInformationLines() {
|
||||||
List<String> ret = new ArrayList<String>();
|
List<String> ret = new ArrayList<>();
|
||||||
|
|
||||||
ret.add("Vertices: " + region.getVertices().size());
|
ret.add("Vertices: " + region.getVertices().size());
|
||||||
ret.add("Triangles: " + region.getTriangles().size());
|
ret.add("Triangles: " + region.getTriangles().size());
|
||||||
@ -202,7 +202,7 @@ public class PolyhedralRegionSelector implements RegionSelector, CUIRegion {
|
|||||||
Collection<BlockVector3> vertices = region.getVertices();
|
Collection<BlockVector3> vertices = region.getVertices();
|
||||||
Collection<Triangle> triangles = region.getTriangles();
|
Collection<Triangle> triangles = region.getTriangles();
|
||||||
|
|
||||||
Map<BlockVector3, Integer> vertexIds = new HashMap<BlockVector3, Integer>(vertices.size());
|
Map<BlockVector3, Integer> vertexIds = new HashMap<>(vertices.size());
|
||||||
int lastVertexId = -1;
|
int lastVertexId = -1;
|
||||||
for (BlockVector3 vertex : vertices) {
|
for (BlockVector3 vertex : vertices) {
|
||||||
vertexIds.put(vertex, ++lastVertexId);
|
vertexIds.put(vertex, ++lastVertexId);
|
||||||
|
@ -228,7 +228,7 @@ public class SetQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Collection<FaweQueue> getAllQueues() {
|
public Collection<FaweQueue> getAllQueues() {
|
||||||
ArrayList<FaweQueue> list = new ArrayList<FaweQueue>(activeQueues.size() + inactiveQueues.size());
|
ArrayList<FaweQueue> list = new ArrayList<>(activeQueues.size() + inactiveQueues.size());
|
||||||
list.addAll(inactiveQueues);
|
list.addAll(inactiveQueues);
|
||||||
list.addAll(activeQueues);
|
list.addAll(activeQueues);
|
||||||
return list;
|
return list;
|
||||||
|
@ -167,7 +167,7 @@ public class ShapeInterpolator {
|
|||||||
bezierCoordinates[0] = curX = movX = coordinates[0];
|
bezierCoordinates[0] = curX = movX = coordinates[0];
|
||||||
bezierCoordinates[1] = curY = movY = coordinates[1];
|
bezierCoordinates[1] = curY = movY = coordinates[1];
|
||||||
float newX, newY;
|
float newX, newY;
|
||||||
final Vector<Point2D.Float> savedPathEndPoints = new Vector<Point2D.Float>();
|
final Vector<Point2D.Float> savedPathEndPoints = new Vector<>();
|
||||||
numCoordinates = 2;
|
numCoordinates = 2;
|
||||||
while (!pi.isDone()) {
|
while (!pi.isDone()) {
|
||||||
switch (pi.currentSegment(coordinates)) {
|
switch (pi.currentSegment(coordinates)) {
|
||||||
|
@ -148,7 +148,7 @@ public class StringMan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> split(String input, char delim) {
|
public static List<String> split(String input, char delim) {
|
||||||
List<String> result = new ArrayList<String>();
|
List<String> result = new ArrayList<>();
|
||||||
int start = 0;
|
int start = 0;
|
||||||
int bracket = 0;
|
int bracket = 0;
|
||||||
boolean inQuotes = false;
|
boolean inQuotes = false;
|
||||||
|
@ -583,7 +583,7 @@ public class TextureUtil implements TextureHolder{
|
|||||||
// Get all the groups in the current jar
|
// Get all the groups in the current jar
|
||||||
// The vanilla textures are in `assets/minecraft`
|
// The vanilla textures are in `assets/minecraft`
|
||||||
// A jar may contain textures for multiple mods
|
// A jar may contain textures for multiple mods
|
||||||
Set<String> mods = new HashSet<String>();
|
Set<String> mods = new HashSet<>();
|
||||||
{
|
{
|
||||||
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
|
@ -57,7 +57,7 @@ public class UsageMessage extends Message {
|
|||||||
text(BBC.HELP_HEADER_SUBCOMMANDS.f());
|
text(BBC.HELP_HEADER_SUBCOMMANDS.f());
|
||||||
String prefix = !commandString.isEmpty() ? commandString + " " : "";
|
String prefix = !commandString.isEmpty() ? commandString + " " : "";
|
||||||
|
|
||||||
List<CommandMapping> list = new ArrayList<CommandMapping>(dispatcher.getCommands());
|
List<CommandMapping> list = new ArrayList<>(dispatcher.getCommands());
|
||||||
Collections.sort(list, new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN));
|
Collections.sort(list, new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN));
|
||||||
|
|
||||||
for (CommandMapping mapping : list) {
|
for (CommandMapping mapping : list) {
|
||||||
|
@ -308,7 +308,7 @@ public class TaskBuilder extends Metadatable {
|
|||||||
continue;
|
continue;
|
||||||
case SYNC_PARALLEL:
|
case SYNC_PARALLEL:
|
||||||
case ASYNC_PARALLEL:
|
case ASYNC_PARALLEL:
|
||||||
final ArrayList<RunnableTask> parallel = new ArrayList<RunnableTask>();
|
final ArrayList<RunnableTask> parallel = new ArrayList<>();
|
||||||
parallel.add(task);
|
parallel.add(task);
|
||||||
RunnableTask next = tasks.peek();
|
RunnableTask next = tasks.peek();
|
||||||
while (next != null && next.type == task.type) {
|
while (next != null && next.type == task.type) {
|
||||||
|
@ -81,7 +81,7 @@ public final class CompoundTag extends Tag {
|
|||||||
* @return the builder
|
* @return the builder
|
||||||
*/
|
*/
|
||||||
public CompoundTagBuilder createBuilder() {
|
public CompoundTagBuilder createBuilder() {
|
||||||
return new CompoundTagBuilder(new HashMap<String, Tag>(value));
|
return new CompoundTagBuilder(new HashMap<>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@ public class CompoundTagBuilder {
|
|||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
*/
|
*/
|
||||||
public CompoundTagBuilder() {
|
public CompoundTagBuilder() {
|
||||||
this.entries = new HashMap<String, Tag>();
|
this.entries = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,7 +201,7 @@ public class CompoundTagBuilder {
|
|||||||
* @return the new compound tag
|
* @return the new compound tag
|
||||||
*/
|
*/
|
||||||
public CompoundTag build() {
|
public CompoundTag build() {
|
||||||
return new CompoundTag(new HashMap<String, Tag>(entries));
|
return new CompoundTag(new HashMap<>(entries));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -375,7 +375,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
childType = NBTConstants.TYPE_COMPOUND;
|
childType = NBTConstants.TYPE_COMPOUND;
|
||||||
}
|
}
|
||||||
length = is.readInt();
|
length = is.readInt();
|
||||||
List<Tag> tagList = new ArrayList<Tag>();
|
List<Tag> tagList = new ArrayList<>();
|
||||||
for (int i = 0; i < length; ++i) {
|
for (int i = 0; i < length; ++i) {
|
||||||
Tag tag = readTagPayload(childType, depth + 1);
|
Tag tag = readTagPayload(childType, depth + 1);
|
||||||
if (tag instanceof EndTag) {
|
if (tag instanceof EndTag) {
|
||||||
@ -385,7 +385,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
}
|
}
|
||||||
return (tagList);
|
return (tagList);
|
||||||
case NBTConstants.TYPE_COMPOUND:
|
case NBTConstants.TYPE_COMPOUND:
|
||||||
Map<String, Tag> tagMap = new HashMap<String, Tag>();
|
Map<String, Tag> tagMap = new HashMap<>();
|
||||||
while (true) {
|
while (true) {
|
||||||
NamedTag namedTag = readNamedTag(depth + 1);
|
NamedTag namedTag = readNamedTag(depth + 1);
|
||||||
Tag tag = namedTag.getTag();
|
Tag tag = namedTag.getTag();
|
||||||
@ -562,7 +562,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
childType = NBTConstants.TYPE_COMPOUND;
|
childType = NBTConstants.TYPE_COMPOUND;
|
||||||
}
|
}
|
||||||
length = is.readInt();
|
length = is.readInt();
|
||||||
List<Tag> tagList = new ArrayList<Tag>();
|
List<Tag> tagList = new ArrayList<>();
|
||||||
for (int i = 0; i < length; ++i) {
|
for (int i = 0; i < length; ++i) {
|
||||||
Tag tag = readTagPayload(childType, depth + 1);
|
Tag tag = readTagPayload(childType, depth + 1);
|
||||||
if (tag instanceof EndTag) {
|
if (tag instanceof EndTag) {
|
||||||
@ -573,7 +573,7 @@ public final class NBTInputStream implements Closeable {
|
|||||||
|
|
||||||
return new ListTag(NBTUtils.getTypeClass(childType), tagList);
|
return new ListTag(NBTUtils.getTypeClass(childType), tagList);
|
||||||
case NBTConstants.TYPE_COMPOUND:
|
case NBTConstants.TYPE_COMPOUND:
|
||||||
Map<String, Tag> tagMap = new HashMap<String, Tag>();
|
Map<String, Tag> tagMap = new HashMap<>();
|
||||||
while (true) {
|
while (true) {
|
||||||
NamedTag namedTag = readNamedTag(depth + 1);
|
NamedTag namedTag = readNamedTag(depth + 1);
|
||||||
Tag tag = namedTag.getTag();
|
Tag tag = namedTag.getTag();
|
||||||
|
@ -3172,7 +3172,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
*/
|
*/
|
||||||
public int drawSpline(final Pattern pattern, final List<BlockVector3> nodevectors, final double tension, final double bias, final double continuity, final double quality, final double radius, final boolean filled) throws WorldEditException {
|
public int drawSpline(final Pattern pattern, final List<BlockVector3> nodevectors, final double tension, final double bias, final double continuity, final double quality, final double radius, final boolean filled) throws WorldEditException {
|
||||||
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
LocalBlockVectorSet vset = new LocalBlockVectorSet();
|
||||||
final List<Node> nodes = new ArrayList<Node>(nodevectors.size());
|
final List<Node> nodes = new ArrayList<>(nodevectors.size());
|
||||||
|
|
||||||
final KochanekBartelsInterpolation interpol = new KochanekBartelsInterpolation();
|
final KochanekBartelsInterpolation interpol = new KochanekBartelsInterpolation();
|
||||||
for (BlockVector3 nodevector : nodevectors) {
|
for (BlockVector3 nodevector : nodevectors) {
|
||||||
@ -3278,7 +3278,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
|||||||
|
|
||||||
public void recurseHollow(final Region region, final BlockVector3 origin, final Set<BlockVector3> outside) {
|
public void recurseHollow(final Region region, final BlockVector3 origin, final Set<BlockVector3> outside) {
|
||||||
//TODO FIXME Optimize - avoid vector creation
|
//TODO FIXME Optimize - avoid vector creation
|
||||||
final ArrayDeque<BlockVector3> queue = new ArrayDeque<BlockVector3>();
|
final ArrayDeque<BlockVector3> queue = new ArrayDeque<>();
|
||||||
queue.addLast(origin);
|
queue.addLast(origin);
|
||||||
|
|
||||||
while (!queue.isEmpty()) {
|
while (!queue.isEmpty()) {
|
||||||
|
@ -19,12 +19,8 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit;
|
package com.sk89q.worldedit;
|
||||||
|
|
||||||
import static com.sk89q.worldedit.event.platform.Interaction.HIT;
|
|
||||||
import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
import com.sk89q.worldedit.blocks.BaseItem;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.event.platform.BlockInteractEvent;
|
import com.sk89q.worldedit.event.platform.BlockInteractEvent;
|
||||||
@ -39,10 +35,11 @@ import com.sk89q.worldedit.extension.platform.Capability;
|
|||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.internal.expression.Expression;
|
import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
import com.sk89q.worldedit.internal.expression.runtime.Constant;
|
import com.sk89q.worldedit.internal.expression.runtime.Constant;
|
||||||
import com.sk89q.worldedit.internal.expression.runtime.RValue;
|
import com.sk89q.worldedit.internal.expression.runtime.RValue;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.scripting.CraftScriptContext;
|
import com.sk89q.worldedit.scripting.CraftScriptContext;
|
||||||
import com.sk89q.worldedit.scripting.CraftScriptEngine;
|
import com.sk89q.worldedit.scripting.CraftScriptEngine;
|
||||||
@ -65,11 +62,16 @@ import com.sk89q.worldedit.world.registry.BundledBlockData;
|
|||||||
import com.sk89q.worldedit.world.registry.BundledItemData;
|
import com.sk89q.worldedit.world.registry.BundledItemData;
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.script.ScriptException;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -77,7 +79,8 @@ import java.util.Map;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.script.ScriptException;
|
import static com.sk89q.worldedit.event.platform.Interaction.HIT;
|
||||||
|
import static com.sk89q.worldedit.event.platform.Interaction.OPEN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry point and container for a working implementation of WorldEdit.
|
* The entry point and container for a working implementation of WorldEdit.
|
||||||
@ -92,7 +95,7 @@ import javax.script.ScriptException;
|
|||||||
* method {@link WorldEdit#getInstance()}, which is shared among all
|
* method {@link WorldEdit#getInstance()}, which is shared among all
|
||||||
* platforms within the same classloader hierarchy.</p>
|
* platforms within the same classloader hierarchy.</p>
|
||||||
*/
|
*/
|
||||||
public class WorldEdit {
|
public final class WorldEdit {
|
||||||
|
|
||||||
public static final Logger logger = Logger.getLogger(WorldEdit.class.getCanonicalName());
|
public static final Logger logger = Logger.getLogger(WorldEdit.class.getCanonicalName());
|
||||||
|
|
||||||
@ -162,7 +165,6 @@ public class WorldEdit {
|
|||||||
return supervisor;
|
return supervisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block factory from which new {@link BlockStateHolder}s can be
|
* Get the block factory from which new {@link BlockStateHolder}s can be
|
||||||
* constructed.
|
* constructed.
|
||||||
@ -184,7 +186,7 @@ public class WorldEdit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mask factory from which new {@link com.sk89q.worldedit.function.mask.Mask}s
|
* Get the mask factory from which new {@link Mask}s
|
||||||
* can be constructed.
|
* can be constructed.
|
||||||
*
|
*
|
||||||
* @return the mask factory
|
* @return the mask factory
|
||||||
@ -194,7 +196,7 @@ public class WorldEdit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the pattern factory from which new {@link com.sk89q.worldedit.function.pattern.Pattern}s
|
* Get the pattern factory from which new {@link Pattern}s
|
||||||
* can be constructed.
|
* can be constructed.
|
||||||
*
|
*
|
||||||
* @return the pattern factory
|
* @return the pattern factory
|
||||||
@ -260,12 +262,12 @@ public class WorldEdit {
|
|||||||
* @return a file
|
* @return a file
|
||||||
* @throws FilenameException thrown if the filename is invalid
|
* @throws FilenameException thrown if the filename is invalid
|
||||||
*/
|
*/
|
||||||
private File getSafeFile(Player player, File dir, String filename, String defaultExt, String[] extensions, boolean isSave) throws FilenameException {
|
private File getSafeFile(@Nullable Player player, File dir, String filename, String defaultExt, String[] extensions, boolean isSave) throws FilenameException {
|
||||||
if (extensions != null && (extensions.length == 1 && extensions[0] == null)) extensions = null;
|
if (extensions != null && (extensions.length == 1 && extensions[0] == null)) extensions = null;
|
||||||
|
|
||||||
File f;
|
File f;
|
||||||
|
|
||||||
if (filename.equals("#")) {
|
if (filename.equals("#") && player != null) {
|
||||||
if (isSave) {
|
if (isSave) {
|
||||||
f = player.openFileSaveDialog(extensions);
|
f = player.openFileSaveDialog(extensions);
|
||||||
} else {
|
} else {
|
||||||
@ -277,22 +279,27 @@ public class WorldEdit {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<String> exts = extensions == null ? ImmutableList.of(defaultExt) : Lists.asList(defaultExt, extensions);
|
List<String> exts = extensions == null ? ImmutableList.of(defaultExt) : Lists.asList(defaultExt, extensions);
|
||||||
return getSafeFileWithExtensions(dir, filename, exts, isSave);
|
f = getSafeFileWithExtensions(dir, filename, exts, isSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String filePath = f.getCanonicalPath();
|
Path filePath = Paths.get(f.toURI()).normalize();
|
||||||
String dirPath = dir.getCanonicalPath();
|
Path dirPath = Paths.get(dir.toURI()).normalize();
|
||||||
|
|
||||||
if (!filePath.substring(0, dirPath.length()).equals(dirPath) && !getConfiguration().allowSymlinks) {
|
boolean inDir = filePath.startsWith(dirPath);
|
||||||
throw new FilenameResolutionException(filename,
|
Path existingParent = filePath;
|
||||||
"Path is outside allowable root");
|
do {
|
||||||
|
existingParent = existingParent.getParent();
|
||||||
|
} while (existingParent != null && !existingParent.toFile().exists());
|
||||||
|
|
||||||
|
boolean isSym = existingParent != null && !existingParent.toRealPath().equals(existingParent);
|
||||||
|
if (!inDir || (!getConfiguration().allowSymlinks && isSym)) {
|
||||||
|
throw new FilenameResolutionException(filename, "Path is outside allowable root");
|
||||||
}
|
}
|
||||||
|
|
||||||
return f;
|
return filePath.toFile();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new FilenameResolutionException(filename,
|
throw new FilenameResolutionException(filename, "Failed to resolve path");
|
||||||
"Failed to resolve path");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +311,7 @@ public class WorldEdit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
File result = null;
|
File result = null;
|
||||||
for (Iterator<String> iter = exts.iterator(); iter.hasNext() && (result == null || !result.exists());) {
|
for (Iterator<String> iter = exts.iterator(); iter.hasNext() && (result == null || (!isSave && !result.exists()));) {
|
||||||
result = getSafeFileWithExtension(dir, filename, iter.next());
|
result = getSafeFileWithExtension(dir, filename, iter.next());
|
||||||
}
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
@ -314,9 +321,12 @@ public class WorldEdit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private File getSafeFileWithExtension(File dir, String filename, String extension) {
|
private File getSafeFileWithExtension(File dir, String filename, String extension) {
|
||||||
if (extension != null && filename.lastIndexOf('.') == -1) {
|
if (extension != null) {
|
||||||
|
int dot = filename.lastIndexOf('.');
|
||||||
|
if (dot < 0 || !filename.substring(dot).equalsIgnoreCase(extension)) {
|
||||||
filename += "." + extension;
|
filename += "." + extension;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!checkFilename(filename)) {
|
if (!checkFilename(filename)) {
|
||||||
return null;
|
return null;
|
||||||
@ -503,7 +513,6 @@ public class WorldEdit {
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush a block bag's changes to a player.
|
* Flush a block bag's changes to a player.
|
||||||
*
|
*
|
||||||
@ -600,8 +609,6 @@ public class WorldEdit {
|
|||||||
* @throws WorldEditException
|
* @throws WorldEditException
|
||||||
*/
|
*/
|
||||||
public void runScript(Player player, File f, String[] args) throws WorldEditException {
|
public void runScript(Player player, File f, String[] args) throws WorldEditException {
|
||||||
Request.reset();
|
|
||||||
|
|
||||||
String filename = f.getPath();
|
String filename = f.getPath();
|
||||||
int index = filename.lastIndexOf('.');
|
int index = filename.lastIndexOf('.');
|
||||||
String ext = filename.substring(index + 1);
|
String ext = filename.substring(index + 1);
|
||||||
@ -631,7 +638,7 @@ public class WorldEdit {
|
|||||||
byte[] data = new byte[in.available()];
|
byte[] data = new byte[in.available()];
|
||||||
in.readFully(data);
|
in.readFully(data);
|
||||||
in.close();
|
in.close();
|
||||||
script = new String(data, 0, data.length, "utf-8");
|
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
player.printError("Script read error: " + e.getMessage());
|
player.printError("Script read error: " + e.getMessage());
|
||||||
return;
|
return;
|
||||||
|
@ -185,7 +185,7 @@ public class BiomeCommands extends MethodCommands {
|
|||||||
for (int i = 0; i < biomes.length; i++) {
|
for (int i = 0; i < biomes.length; i++) {
|
||||||
int count = biomes[i];
|
int count = biomes[i];
|
||||||
if (count != 0) {
|
if (count != 0) {
|
||||||
distribution.add(new Countable<BaseBiome>(new BaseBiome(i), count));
|
distribution.add(new Countable<>(new BaseBiome(i), count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(distribution);
|
Collections.sort(distribution);
|
||||||
|
@ -51,14 +51,14 @@ public abstract class HelpBuilder implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isRootLevel = true;
|
boolean isRootLevel = true;
|
||||||
List<String> visited = new ArrayList<String>();
|
List<String> visited = new ArrayList<>();
|
||||||
|
|
||||||
// Create the message
|
// Create the message
|
||||||
if (callable instanceof Dispatcher) {
|
if (callable instanceof Dispatcher) {
|
||||||
Dispatcher dispatcher = (Dispatcher) callable;
|
Dispatcher dispatcher = (Dispatcher) callable;
|
||||||
|
|
||||||
// Get a list of aliases
|
// Get a list of aliases
|
||||||
List<CommandMapping> aliases = new ArrayList<CommandMapping>(dispatcher.getCommands());
|
List<CommandMapping> aliases = new ArrayList<>(dispatcher.getCommands());
|
||||||
List<String> prefixes = Collections.nCopies(aliases.size(), "");
|
List<String> prefixes = Collections.nCopies(aliases.size(), "");
|
||||||
// Group by callable
|
// Group by callable
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ public abstract class HelpBuilder implements Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dispatcher = (Dispatcher) callable;
|
dispatcher = (Dispatcher) callable;
|
||||||
aliases = new ArrayList<CommandMapping>(dispatcher.getCommands());
|
aliases = new ArrayList<>(dispatcher.getCommands());
|
||||||
prefixes = Collections.nCopies(aliases.size(), "");
|
prefixes = Collections.nCopies(aliases.size(), "");
|
||||||
} else {
|
} else {
|
||||||
aliases = new ArrayList<>();
|
aliases = new ArrayList<>();
|
||||||
|
@ -139,7 +139,7 @@ public class ScriptingCommands {
|
|||||||
|
|
||||||
engine.setTimeLimit(worldEdit.getConfiguration().scriptTimeout);
|
engine.setTimeLimit(worldEdit.getConfiguration().scriptTimeout);
|
||||||
|
|
||||||
Map<String, Object> vars = new HashMap<String, Object>();
|
Map<String, Object> vars = new HashMap<>();
|
||||||
vars.put("argv", args);
|
vars.put("argv", args);
|
||||||
vars.put("actor", actor);
|
vars.put("actor", actor);
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ public class UtilityCommands extends MethodCommands {
|
|||||||
CreatureButcher flags = new CreatureButcher(actor);
|
CreatureButcher flags = new CreatureButcher(actor);
|
||||||
flags.fromCommand(args);
|
flags.fromCommand(args);
|
||||||
|
|
||||||
List<EntityVisitor> visitors = new ArrayList<EntityVisitor>();
|
List<EntityVisitor> visitors = new ArrayList<>();
|
||||||
LocalSession session = null;
|
LocalSession session = null;
|
||||||
EditSession editSession = null;
|
EditSession editSession = null;
|
||||||
|
|
||||||
@ -616,7 +616,7 @@ public class UtilityCommands extends MethodCommands {
|
|||||||
EntityRemover remover = new EntityRemover();
|
EntityRemover remover = new EntityRemover();
|
||||||
remover.fromString(typeStr);
|
remover.fromString(typeStr);
|
||||||
|
|
||||||
List<EntityVisitor> visitors = new ArrayList<EntityVisitor>();
|
List<EntityVisitor> visitors = new ArrayList<>();
|
||||||
LocalSession session = null;
|
LocalSession session = null;
|
||||||
EditSession editSession = null;
|
EditSession editSession = null;
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ public class PlatformManager {
|
|||||||
|
|
||||||
private final WorldEdit worldEdit;
|
private final WorldEdit worldEdit;
|
||||||
private final CommandManager commandManager;
|
private final CommandManager commandManager;
|
||||||
private final List<Platform> platforms = new ArrayList<Platform>();
|
private final List<Platform> platforms = new ArrayList<>();
|
||||||
private final Map<Capability, Platform> preferences = new EnumMap<Capability, Platform>(Capability.class);
|
private final Map<Capability, Platform> preferences = new EnumMap<>(Capability.class);
|
||||||
private @Nullable String firstSeenVersion;
|
private @Nullable String firstSeenVersion;
|
||||||
private final AtomicBoolean initialized = new AtomicBoolean();
|
private final AtomicBoolean initialized = new AtomicBoolean();
|
||||||
private final AtomicBoolean configured = new AtomicBoolean();
|
private final AtomicBoolean configured = new AtomicBoolean();
|
||||||
@ -230,7 +230,7 @@ public class PlatformManager {
|
|||||||
* @return a list of platforms
|
* @return a list of platforms
|
||||||
*/
|
*/
|
||||||
public synchronized List<Platform> getPlatforms() {
|
public synchronized List<Platform> getPlatforms() {
|
||||||
return new ArrayList<Platform>(platforms);
|
return new ArrayList<>(platforms);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,7 +143,7 @@ public interface ClipboardFormat {
|
|||||||
default URL uploadPublic(final Clipboard clipboard, String category, String user) {
|
default URL uploadPublic(final Clipboard clipboard, String category, String user) {
|
||||||
// summary
|
// summary
|
||||||
// blocks
|
// blocks
|
||||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
BlockVector3 dimensions = clipboard.getDimensions();
|
BlockVector3 dimensions = clipboard.getDimensions();
|
||||||
map.put("width", dimensions.getX());
|
map.put("width", dimensions.getX());
|
||||||
map.put("height", dimensions.getY());
|
map.put("height", dimensions.getY());
|
||||||
|
@ -185,7 +185,7 @@ public class MaskIntersection extends AbstractMask {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Mask2D toMask2D() {
|
public Mask2D toMask2D() {
|
||||||
List<Mask2D> mask2dList = new ArrayList<Mask2D>();
|
List<Mask2D> mask2dList = new ArrayList<>();
|
||||||
for (Mask mask : masks) {
|
for (Mask mask : masks) {
|
||||||
Mask2D mask2d = mask.toMask2D();
|
Mask2D mask2d = mask.toMask2D();
|
||||||
if (mask2d != null) {
|
if (mask2d != null) {
|
||||||
|
@ -72,7 +72,7 @@ public class MaskUnion extends MaskIntersection {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Mask2D toMask2D() {
|
public Mask2D toMask2D() {
|
||||||
List<Mask2D> mask2dList = new ArrayList<Mask2D>();
|
List<Mask2D> mask2dList = new ArrayList<>();
|
||||||
for (Mask mask : getMasks()) {
|
for (Mask mask : getMasks()) {
|
||||||
Mask2D mask2d = mask.toMask2D();
|
Mask2D mask2d = mask.toMask2D();
|
||||||
if (mask2d != null) {
|
if (mask2d != null) {
|
||||||
|
@ -69,7 +69,7 @@ public class Expression {
|
|||||||
|
|
||||||
private static final ThreadLocal<ArrayDeque<Expression>> instance = ThreadLocal.withInitial(ArrayDeque::new);
|
private static final ThreadLocal<ArrayDeque<Expression>> instance = ThreadLocal.withInitial(ArrayDeque::new);
|
||||||
|
|
||||||
private final Map<String, RValue> variables = new HashMap<String, RValue>();
|
private final Map<String, RValue> variables = new HashMap<>();
|
||||||
private final String[] variableNames;
|
private final String[] variableNames;
|
||||||
private Variable[] variableArray;
|
private Variable[] variableArray;
|
||||||
private RValue root;
|
private RValue root;
|
||||||
|
@ -124,7 +124,7 @@ public final class Functions {
|
|||||||
throw new NoSuchMethodException(); // TODO: return null (check for side-effects first)
|
throw new NoSuchMethodException(); // TODO: return null (check for side-effects first)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<String, List<Overload>> functions = new HashMap<String, List<Overload>>();
|
private static final Map<String, List<Overload>> functions = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (Method method : Functions.class.getMethods()) {
|
for (Method method : Functions.class.getMethods()) {
|
||||||
@ -143,7 +143,7 @@ public final class Functions {
|
|||||||
|
|
||||||
List<Overload> overloads = functions.get(methodName);
|
List<Overload> overloads = functions.get(methodName);
|
||||||
if (overloads == null) {
|
if (overloads == null) {
|
||||||
functions.put(methodName, overloads = new ArrayList<Overload>());
|
functions.put(methodName, overloads = new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
overloads.add(overload);
|
overloads.add(overload);
|
||||||
@ -281,8 +281,8 @@ public final class Functions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final Map<Integer, double[]> gmegabuf = new HashMap<Integer, double[]>();
|
private static final Map<Integer, double[]> gmegabuf = new HashMap<>();
|
||||||
private final Map<Integer, double[]> megabuf = new HashMap<Integer, double[]>();
|
private final Map<Integer, double[]> megabuf = new HashMap<>();
|
||||||
|
|
||||||
public Map<Integer, double[]> getMegabuf() {
|
public Map<Integer, double[]> getMegabuf() {
|
||||||
return megabuf;
|
return megabuf;
|
||||||
|
@ -191,7 +191,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getInformationLines() {
|
public List<String> getInformationLines() {
|
||||||
List<String> ret = new ArrayList<String>();
|
List<String> ret = new ArrayList<>();
|
||||||
|
|
||||||
ret.add("Vertices: "+region.getVertices().size());
|
ret.add("Vertices: "+region.getVertices().size());
|
||||||
ret.add("Triangles: "+region.getTriangles().size());
|
ret.add("Triangles: "+region.getTriangles().size());
|
||||||
|
@ -260,7 +260,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getInformationLines() {
|
public List<String> getInformationLines() {
|
||||||
final List<String> lines = new ArrayList<String>();
|
final List<String> lines = new ArrayList<>();
|
||||||
|
|
||||||
if (position1 != null) {
|
if (position1 != null) {
|
||||||
lines.add("Position 1: " + position1);
|
lines.add("Position 1: " + position1);
|
||||||
|
@ -241,7 +241,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getInformationLines() {
|
public List<String> getInformationLines() {
|
||||||
final List<String> lines = new ArrayList<String>();
|
final List<String> lines = new ArrayList<>();
|
||||||
|
|
||||||
if (!region.getCenter().equals(Vector3.ZERO)) {
|
if (!region.getCenter().equals(Vector3.ZERO)) {
|
||||||
lines.add("Center: " + region.getCenter());
|
lines.add("Center: " + region.getCenter());
|
||||||
|
@ -199,7 +199,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getInformationLines() {
|
public List<String> getInformationLines() {
|
||||||
final List<String> lines = new ArrayList<String>();
|
final List<String> lines = new ArrayList<>();
|
||||||
|
|
||||||
final Vector3 center = region.getCenter();
|
final Vector3 center = region.getCenter();
|
||||||
if (center.lengthSq() > 0) {
|
if (center.lengthSq() > 0) {
|
||||||
|
@ -40,7 +40,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public class SimpleDispatcher implements Dispatcher {
|
public class SimpleDispatcher implements Dispatcher {
|
||||||
|
|
||||||
private final Map<String, CommandMapping> commands = new HashMap<String, CommandMapping>();
|
private final Map<String, CommandMapping> commands = new HashMap<>();
|
||||||
private final SimpleDescription description = new SimpleDescription();
|
private final SimpleDescription description = new SimpleDescription();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +82,7 @@ public class SimpleDispatcher implements Dispatcher {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<CommandMapping> getCommands() {
|
public Set<CommandMapping> getCommands() {
|
||||||
return Collections.unmodifiableSet(new HashSet<CommandMapping>(commands.values()));
|
return Collections.unmodifiableSet(new HashSet<>(commands.values()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,7 +92,7 @@ public class SimpleDispatcher implements Dispatcher {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getPrimaryAliases() {
|
public Set<String> getPrimaryAliases() {
|
||||||
Set<String> aliases = new HashSet<String>();
|
Set<String> aliases = new HashSet<>();
|
||||||
for (CommandMapping mapping : getCommands()) {
|
for (CommandMapping mapping : getCommands()) {
|
||||||
aliases.add(mapping.getPrimaryAlias());
|
aliases.add(mapping.getPrimaryAlias());
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ public class SimpleDispatcher implements Dispatcher {
|
|||||||
if (split.length <= 1) {
|
if (split.length <= 1) {
|
||||||
String prefix = split.length > 0 ? split[0] : "";
|
String prefix = split.length > 0 ? split[0] : "";
|
||||||
|
|
||||||
List<String> suggestions = new ArrayList<String>();
|
List<String> suggestions = new ArrayList<>();
|
||||||
|
|
||||||
for (CommandMapping mapping : getCommands()) {
|
for (CommandMapping mapping : getCommands()) {
|
||||||
if (mapping.getCallable().testPermission(locals)) {
|
if (mapping.getCallable().testPermission(locals)) {
|
||||||
|
@ -171,7 +171,7 @@ public abstract class AParametricCallable implements CommandCallable {
|
|||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
if (unusedFlags == null) {
|
if (unusedFlags == null) {
|
||||||
unusedFlags = new HashSet<Character>();
|
unusedFlags = new HashSet<>();
|
||||||
}
|
}
|
||||||
unusedFlags.add(flag);
|
unusedFlags.add(flag);
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@ public class FunctionParametricCallable extends AParametricCallable {
|
|||||||
|
|
||||||
private final ParametricBuilder builder;
|
private final ParametricBuilder builder;
|
||||||
private final ParameterData[] parameters;
|
private final ParameterData[] parameters;
|
||||||
private final Set<Character> valueFlags = new HashSet<Character>();
|
private final Set<Character> valueFlags = new HashSet<>();
|
||||||
private final boolean anyFlags;
|
private final boolean anyFlags;
|
||||||
private final Set<Character> legacyFlags = new HashSet<Character>();
|
private final Set<Character> legacyFlags = new HashSet<>();
|
||||||
private final SimpleDescription description = new SimpleDescription();
|
private final SimpleDescription description = new SimpleDescription();
|
||||||
private final String permission;
|
private final String permission;
|
||||||
private final Command command;
|
private final Command command;
|
||||||
@ -81,7 +81,7 @@ public class FunctionParametricCallable extends AParametricCallable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parameters = new ParameterData[paramParsables.size()];
|
parameters = new ParameterData[paramParsables.size()];
|
||||||
List<Parameter> userParameters = new ArrayList<Parameter>();
|
List<Parameter> userParameters = new ArrayList<>();
|
||||||
|
|
||||||
// This helps keep tracks of @Nullables that appear in the middle of a list
|
// This helps keep tracks of @Nullables that appear in the middle of a list
|
||||||
// of parameters
|
// of parameters
|
||||||
|
@ -65,10 +65,10 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class ParametricBuilder {
|
public class ParametricBuilder {
|
||||||
|
|
||||||
private final Map<Type, Binding> bindings = new HashMap<Type, Binding>();
|
private final Map<Type, Binding> bindings = new HashMap<>();
|
||||||
private final Paranamer paranamer = new FaweParanamer();
|
private final Paranamer paranamer = new FaweParanamer();
|
||||||
private final List<InvokeListener> invokeListeners = new ArrayList<InvokeListener>();
|
private final List<InvokeListener> invokeListeners = new ArrayList<>();
|
||||||
private final List<ExceptionConverter> exceptionConverters = new ArrayList<ExceptionConverter>();
|
private final List<ExceptionConverter> exceptionConverters = new ArrayList<>();
|
||||||
private Authorizer authorizer = new NullAuthorizer();
|
private Authorizer authorizer = new NullAuthorizer();
|
||||||
private CommandCompleter defaultCompleter = new NullCompleter();
|
private CommandCompleter defaultCompleter = new NullCompleter();
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ public class ParametricCallable extends AParametricCallable {
|
|||||||
private final Object object;
|
private final Object object;
|
||||||
private final Method method;
|
private final Method method;
|
||||||
private final ParameterData[] parameters;
|
private final ParameterData[] parameters;
|
||||||
private final Set<Character> valueFlags = new HashSet<Character>();
|
private final Set<Character> valueFlags = new HashSet<>();
|
||||||
private final boolean anyFlags;
|
private final boolean anyFlags;
|
||||||
private final Set<Character> legacyFlags = new HashSet<Character>();
|
private final Set<Character> legacyFlags = new HashSet<>();
|
||||||
private final SimpleDescription description = new SimpleDescription();
|
private final SimpleDescription description = new SimpleDescription();
|
||||||
private final CommandPermissions commandPermissions;
|
private final CommandPermissions commandPermissions;
|
||||||
private final Command definition;
|
private final Command definition;
|
||||||
@ -81,7 +81,7 @@ public class ParametricCallable extends AParametricCallable {
|
|||||||
Type[] types = method.getGenericParameterTypes();
|
Type[] types = method.getGenericParameterTypes();
|
||||||
|
|
||||||
parameters = new ParameterData[types.length];
|
parameters = new ParameterData[types.length];
|
||||||
List<Parameter> userParameters = new ArrayList<Parameter>();
|
List<Parameter> userParameters = new ArrayList<>();
|
||||||
|
|
||||||
// This helps keep tracks of @Nullables that appear in the middle of a list
|
// This helps keep tracks of @Nullables that appear in the middle of a list
|
||||||
// of parameters
|
// of parameters
|
||||||
@ -221,7 +221,7 @@ public class ParametricCallable extends AParametricCallable {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// preProcess handlers
|
// preProcess handlers
|
||||||
List<InvokeHandler> handlers = new ArrayList<InvokeHandler>();
|
List<InvokeHandler> handlers = new ArrayList<>();
|
||||||
for (InvokeListener listener : builder.getInvokeListeners()) {
|
for (InvokeListener listener : builder.getInvokeListeners()) {
|
||||||
InvokeHandler handler = listener.createInvokeHandler();
|
InvokeHandler handler = listener.createInvokeHandler();
|
||||||
handlers.add(handler);
|
handlers.add(handler);
|
||||||
|
@ -73,7 +73,7 @@ public class CommandUsageBox extends StyledFragment {
|
|||||||
CommandListBox box = new CommandListBox(BBC.HELP_HEADER_SUBCOMMANDS.f());
|
CommandListBox box = new CommandListBox(BBC.HELP_HEADER_SUBCOMMANDS.f());
|
||||||
String prefix = !commandString.isEmpty() ? commandString + " " : "";
|
String prefix = !commandString.isEmpty() ? commandString + " " : "";
|
||||||
|
|
||||||
List<CommandMapping> list = new ArrayList<CommandMapping>(dispatcher.getCommands());
|
List<CommandMapping> list = new ArrayList<>(dispatcher.getCommands());
|
||||||
Collections.sort(list, new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN));
|
Collections.sort(list, new PrimaryAliasComparator(CommandManager.COMMAND_CLEAN_PATTERN));
|
||||||
|
|
||||||
for (CommandMapping mapping : list) {
|
for (CommandMapping mapping : list) {
|
||||||
|
@ -83,7 +83,7 @@ public class ProgressIterator<V> implements Iterator<V>, ProgressObservable {
|
|||||||
* @return an instance
|
* @return an instance
|
||||||
*/
|
*/
|
||||||
public static <V> ProgressIterator<V> create(Iterator<V> iterator, int count) {
|
public static <V> ProgressIterator<V> create(Iterator<V> iterator, int count) {
|
||||||
return new ProgressIterator<V>(iterator, count);
|
return new ProgressIterator<>(iterator, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +81,8 @@ public class BlockType implements FawePattern {
|
|||||||
|
|
||||||
public ArrayList<BlockState> updateStates(){
|
public ArrayList<BlockState> updateStates(){
|
||||||
if(settings != null) {
|
if(settings != null) {
|
||||||
return settings.localStates = new ArrayList<BlockState>(settings.localStates.stream().map(state -> new BlockStateImpl(this, state.getInternalId(), state.getOrdinal())).collect(Collectors.toList()));
|
return settings.localStates = new ArrayList<>(settings.localStates.stream()
|
||||||
|
.map(state -> new BlockStateImpl(this, state.getInternalId(), state.getOrdinal())).collect(Collectors.toList()));
|
||||||
}else {
|
}else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -676,9 +676,9 @@ public class BlockTypes{
|
|||||||
|
|
||||||
public static BlockType register(BlockType type) {
|
public static BlockType register(BlockType type) {
|
||||||
if(sortedRegistry == null) {
|
if(sortedRegistry == null) {
|
||||||
sortedRegistry = new ArrayList<BlockType>();
|
sortedRegistry = new ArrayList<>();
|
||||||
stateList = new ArrayList<BlockState>();
|
stateList = new ArrayList<>();
|
||||||
$NAMESPACES = new LinkedHashSet<String>();
|
$NAMESPACES = new LinkedHashSet<>();
|
||||||
BIT_OFFSET = MathMan.log2nlz(WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().registerBlocks().size());
|
BIT_OFFSET = MathMan.log2nlz(WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().registerBlocks().size());
|
||||||
BIT_MASK = ((1 << BIT_OFFSET) - 1);
|
BIT_MASK = ((1 << BIT_OFFSET) - 1);
|
||||||
}
|
}
|
||||||
@ -775,7 +775,7 @@ public class BlockTypes{
|
|||||||
this.propertiesSet = Collections.emptySet();
|
this.propertiesSet = Collections.emptySet();
|
||||||
}
|
}
|
||||||
this.permutations = maxInternalStateId;
|
this.permutations = maxInternalStateId;
|
||||||
this.localStates = new ArrayList<BlockState>();
|
this.localStates = new ArrayList<>();
|
||||||
|
|
||||||
this.blockMaterial = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(type);
|
this.blockMaterial = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(type);
|
||||||
this.itemType = ItemTypes.get(type);
|
this.itemType = ItemTypes.get(type);
|
||||||
|
@ -838,7 +838,7 @@ public final class ItemTypes {
|
|||||||
|
|
||||||
public static ItemType register(final ItemType item) {
|
public static ItemType register(final ItemType item) {
|
||||||
if(sortedRegistry == null)
|
if(sortedRegistry == null)
|
||||||
sortedRegistry = new ArrayList<ItemType>();
|
sortedRegistry = new ArrayList<>();
|
||||||
if(!sortedRegistry.contains(item))sortedRegistry.add(item);
|
if(!sortedRegistry.contains(item))sortedRegistry.add(item);
|
||||||
// return ItemType.REGISTRY.register(item.getId(), item);
|
// return ItemType.REGISTRY.register(item.getId(), item);
|
||||||
return internalRegister(item);
|
return internalRegister(item);
|
||||||
|
@ -38,7 +38,7 @@ public class CommandContextTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUpTest() {
|
public void setUpTest() {
|
||||||
try {
|
try {
|
||||||
firstCommand = new CommandContext(firstCmdString, new HashSet<Character>(Arrays.asList('o', 'w')));
|
firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w')));
|
||||||
} catch (CommandException e) {
|
} catch (CommandException e) {
|
||||||
log.log(Level.WARNING, "Error", e);
|
log.log(Level.WARNING, "Error", e);
|
||||||
fail("Unexpected exception when creating CommandContext");
|
fail("Unexpected exception when creating CommandContext");
|
||||||
@ -48,7 +48,7 @@ public class CommandContextTest {
|
|||||||
@Test(expected = CommandException.class)
|
@Test(expected = CommandException.class)
|
||||||
public void testInvalidFlags() throws CommandException {
|
public void testInvalidFlags() throws CommandException {
|
||||||
final String failingCommand = "herpderp -opw testers";
|
final String failingCommand = "herpderp -opw testers";
|
||||||
new CommandContext(failingCommand, new HashSet<Character>(Arrays.asList('o', 'w')));
|
new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren