Code cleaning

Most notable change: Remove redundant type parameters and replaced with <>. This is a small step to bring us closer to upstream parity.
This commit is contained in:
matt
2019-02-15 21:46:10 -05:00
parent 3236bdd78e
commit 85bfd16d7c
82 changed files with 1417 additions and 1406 deletions

View File

@ -79,7 +79,7 @@ public class Brushes
*/
public Set<String> getSniperBrushHandles(Class<? extends IBrush> clazz)
{
return new HashSet<String>(brushes.get(clazz));
return new HashSet<>(brushes.get(clazz));
}
/**

View File

@ -26,7 +26,7 @@ public class VoxelSniperListener implements Listener
private static final String SNIPER_PERMISSION = "voxelsniper.sniper";
private final VoxelSniper plugin;
private Map<String, VoxelCommand> commands = new HashMap<String, VoxelCommand>();
private Map<String, VoxelCommand> commands = new HashMap<>();
/**
* @param plugin

View File

@ -13,7 +13,7 @@ import org.bukkit.block.Block;
*/
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
{

View File

@ -54,7 +54,7 @@ public class DomeBrush extends Brush
final int absoluteHeight = Math.abs(v.getVoxelHeight());
final boolean negative = v.getVoxelHeight() < 0;
final Set<Vector> changeablePositions = new HashSet<Vector>();
final Set<Vector> changeablePositions = new HashSet<>();
final Undo undo = new Undo();

View File

@ -16,7 +16,7 @@ import java.util.regex.PatternSyntaxException;
*/
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
{
// 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;
while (currentClass != null && !currentClass.equals(Object.class))

View File

@ -133,7 +133,7 @@ public class ErodeBrush extends Brush
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)
{
@ -363,8 +363,8 @@ public class ErodeBrush extends Brush
public BlockChangeTracker(final AsyncWorld world)
{
this.blockChanges = new HashMap<Integer, Map<Vector, BlockWrapper>>();
this.flatChanges = new HashMap<Vector, BlockWrapper>();
this.blockChanges = new HashMap<>();
this.flatChanges = new HashMap<>();
this.world = world;
}
@ -400,7 +400,7 @@ public class ErodeBrush extends Brush
{
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);

View File

@ -24,7 +24,7 @@ public class GenerateTreeBrush extends Brush
{
// Tree Variables.
private Random randGenerator = new Random();
private ArrayList<Block> branchBlocks = new ArrayList<Block>();
private ArrayList<Block> branchBlocks = new ArrayList<>();
private Undo undo;
// If these default values are edited. Remember to change default values in the default preset.
private Material leafType = Material.OAK_LEAVES;

View File

@ -44,7 +44,7 @@ public class HeatRayBrush extends Brush
private static final double REQUIRED_FIRE_DENSITY = -0.25;
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 double frequency = 1;

View File

@ -58,7 +58,7 @@ public class MoveBrush extends Brush
final AsyncWorld world = selection.getBlockStates().get(0).getWorld();
final Undo undo = new Undo();
final HashSet<Block> undoSet = new HashSet<Block>();
final HashSet<Block> undoSet = new HashSet<>();
final Selection newSelection = new Selection();
final Location movedLocation1 = selection.getLocation1();
@ -214,7 +214,7 @@ public class MoveBrush extends Brush
/**
* Calculated BlockStates of the selection.
*/
private final ArrayList<AsyncBlockState> blockStates = new ArrayList<AsyncBlockState>();
private final ArrayList<AsyncBlockState> blockStates = new ArrayList<>();
/**
*
*/

View File

@ -14,7 +14,7 @@ import java.util.HashSet;
*/
public class PullBrush extends Brush
{
private final HashSet<BlockWrapper> surface = new HashSet<BlockWrapper>();
private final HashSet<BlockWrapper> surface = new HashSet<>();
private int vh;
private double c1 = 1;
private double c2 = 0;

View File

@ -57,7 +57,8 @@ public class ShellSetBrush extends Brush
}
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 x = lowX; x <= highX; x++)

View File

@ -16,9 +16,9 @@ import java.util.ArrayList;
*/
public class SplineBrush extends PerformBrush
{
private final ArrayList<Block> endPts = new ArrayList<Block>();
private final ArrayList<Block> ctrlPts = new ArrayList<Block>();
protected ArrayList<Point> spline = new ArrayList<Point>();
private final ArrayList<Block> endPts = new ArrayList<>();
private final ArrayList<Block> ctrlPts = new ArrayList<>();
protected ArrayList<Point> spline = new ArrayList<>();
protected boolean set;
protected boolean ctrl;
protected String[] sparams = {"ss", "sc", "clear"};

View File

@ -52,10 +52,10 @@ public class StampBrush extends Brush
NO_AIR, FILL, DEFAULT
}
protected HashSet<BlockWrapper> clone = new HashSet<BlockWrapper>();
protected HashSet<BlockWrapper> fall = new HashSet<BlockWrapper>();
protected HashSet<BlockWrapper> drop = new HashSet<BlockWrapper>();
protected HashSet<BlockWrapper> solid = new HashSet<BlockWrapper>();
protected HashSet<BlockWrapper> clone = new HashSet<>();
protected HashSet<BlockWrapper> fall = new HashSet<>();
protected HashSet<BlockWrapper> drop = new HashSet<>();
protected HashSet<BlockWrapper> solid = new HashSet<>();
protected Undo undo;
protected boolean sorted = false;

View File

@ -26,7 +26,7 @@ public class StencilListBrush extends Brush
private short zRef;
private short yRef;
private byte pasteParam = 0;
private HashMap<Integer, String> stencilList = new HashMap<Integer, String>();
private HashMap<Integer, String> stencilList = new HashMap<>();
/**
*

View File

@ -163,8 +163,8 @@ public enum PerformerE
static
{
performers = new TreeMap<String, vPerformer>();
long_names = new TreeMap<String, String>();
performers = new TreeMap<>();
long_names = new TreeMap<>();
for (PerformerE pe : values())
{

View File

@ -165,7 +165,7 @@ public class HelpJSAP extends JSAP
{
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.
if (!jsapResult.getBoolean("help"))
{