mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 20:56:41 +00:00
More deprecation removal
This commit is contained in:
@ -31,7 +31,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class CombinedRegionFunction implements RegionFunction {
|
||||
|
||||
private final List<RegionFunction> functions = new ArrayList<RegionFunction>();
|
||||
private final List<RegionFunction> functions = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Create a combined region function.
|
||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockType;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
|
@ -24,7 +24,6 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
@ -98,7 +97,7 @@ public class GardenPatchGenerator implements RegionFunction {
|
||||
}
|
||||
}
|
||||
|
||||
editSession.setBlockIfAir(pos, new BaseBlock(BlockTypes.OAK_LEAVES));
|
||||
setBlockIfAir(editSession, pos, new BaseBlock(BlockTypes.OAK_LEAVES));
|
||||
affected++;
|
||||
|
||||
int t = random.nextInt(4);
|
||||
@ -113,10 +112,10 @@ public class GardenPatchGenerator implements RegionFunction {
|
||||
placeVine(basePos, pos.add(1, 0, 0));
|
||||
}
|
||||
if (random.nextBoolean()) {
|
||||
editSession.setBlockIfAir(pos.add(1, h, -1), log);
|
||||
setBlockIfAir(editSession, pos.add(1, h, -1), log);
|
||||
affected++;
|
||||
}
|
||||
editSession.setBlockIfAir(p = pos.add(0, 0, -1), plant.apply(p));
|
||||
setBlockIfAir(editSession, p = pos.add(0, 0, -1), plant.apply(p));
|
||||
affected++;
|
||||
break;
|
||||
|
||||
@ -125,10 +124,10 @@ public class GardenPatchGenerator implements RegionFunction {
|
||||
placeVine(basePos, pos.add(0, 0, 1));
|
||||
}
|
||||
if (random.nextBoolean()) {
|
||||
editSession.setBlockIfAir(pos.add(1, h, 0), log);
|
||||
setBlockIfAir(editSession, pos.add(1, h, 0), log);
|
||||
affected++;
|
||||
}
|
||||
editSession.setBlockIfAir(p = pos.add(1, 0, 1), plant.apply(p));
|
||||
setBlockIfAir(editSession, p = pos.add(1, 0, 1), plant.apply(p));
|
||||
affected++;
|
||||
break;
|
||||
|
||||
@ -137,10 +136,10 @@ public class GardenPatchGenerator implements RegionFunction {
|
||||
placeVine(basePos, pos.add(0, 0, -1));
|
||||
}
|
||||
if (random.nextBoolean()) {
|
||||
editSession.setBlockIfAir(pos.add(-1, h, 0), log);
|
||||
setBlockIfAir(editSession, pos.add(-1, h, 0), log);
|
||||
affected++;
|
||||
}
|
||||
editSession.setBlockIfAir(p = pos.add(-1, 0, 1), plant.apply(p));
|
||||
setBlockIfAir(editSession, p = pos.add(-1, 0, 1), plant.apply(p));
|
||||
affected++;
|
||||
break;
|
||||
|
||||
@ -149,10 +148,10 @@ public class GardenPatchGenerator implements RegionFunction {
|
||||
placeVine(basePos, pos.add(-1, 0, 0));
|
||||
}
|
||||
if (random.nextBoolean()) {
|
||||
editSession.setBlockIfAir(pos.add(-1, h, -1), log);
|
||||
setBlockIfAir(editSession, pos.add(-1, h, -1), log);
|
||||
affected++;
|
||||
}
|
||||
editSession.setBlockIfAir(p = pos.add(-1, 0, -1), plant.apply(p));
|
||||
setBlockIfAir(editSession, p = pos.add(-1, 0, -1), plant.apply(p));
|
||||
affected++;
|
||||
break;
|
||||
}
|
||||
@ -195,6 +194,18 @@ public class GardenPatchGenerator implements RegionFunction {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a block only if there's no block already there.
|
||||
*
|
||||
* @param position the position
|
||||
* @param block the block to set
|
||||
* @return if block was changed
|
||||
* @throws MaxChangedBlocksException thrown if too many blocks are changed
|
||||
*/
|
||||
private static boolean setBlockIfAir(EditSession session, Vector position, BaseBlock block) throws MaxChangedBlocksException {
|
||||
return session.getBlock(position).isAir() && session.setBlock(position, block);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pattern that creates melons.
|
||||
*
|
||||
|
@ -36,7 +36,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class BiomeMask2D extends AbstractMask2D {
|
||||
|
||||
private final Extent extent;
|
||||
private final Set<BaseBiome> biomes = new HashSet<BaseBiome>();
|
||||
private final Set<BaseBiome> biomes = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Create a new biome mask.
|
||||
|
@ -40,7 +40,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class BlockMask extends AbstractExtentMask {
|
||||
|
||||
private final Set<BaseBlock> blocks = new HashSet<BaseBlock>();
|
||||
private final Set<BaseBlock> blocks = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Create a new block mask.
|
||||
|
@ -21,7 +21,6 @@ package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -38,7 +38,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class MaskIntersection extends AbstractMask {
|
||||
|
||||
private final Set<Mask> masks = new HashSet<Mask>();
|
||||
private final Set<Mask> masks = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Create a new intersection.
|
||||
@ -105,7 +105,7 @@ public class MaskIntersection extends AbstractMask {
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
List<Mask2D> mask2dList = new ArrayList<Mask2D>();
|
||||
List<Mask2D> mask2dList = new ArrayList<>();
|
||||
for (Mask mask : masks) {
|
||||
Mask2D mask2d = mask.toMask2D();
|
||||
if (mask2d != null) {
|
||||
|
@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class MaskIntersection2D implements Mask2D {
|
||||
|
||||
private final Set<Mask2D> masks = new HashSet<Mask2D>();
|
||||
private final Set<Mask2D> masks = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Create a new intersection.
|
||||
|
@ -67,7 +67,7 @@ public class MaskUnion extends MaskIntersection {
|
||||
@Nullable
|
||||
@Override
|
||||
public Mask2D toMask2D() {
|
||||
List<Mask2D> mask2dList = new ArrayList<Mask2D>();
|
||||
List<Mask2D> mask2dList = new ArrayList<>();
|
||||
for (Mask mask : getMasks()) {
|
||||
Mask2D mask2d = mask.toMask2D();
|
||||
if (mask2d != null) {
|
||||
|
@ -20,7 +20,6 @@
|
||||
package com.sk89q.worldedit.function.mask;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -35,7 +35,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class OperationQueue implements Operation {
|
||||
|
||||
private final List<Operation> operations = Lists.newArrayList();
|
||||
private final Deque<Operation> queue = new ArrayDeque<Operation>();
|
||||
private final Deque<Operation> queue = new ArrayDeque<>();
|
||||
private Operation current;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class RandomPattern extends AbstractPattern {
|
||||
|
||||
private final Random random = new Random();
|
||||
private List<Chance> patterns = new ArrayList<Chance>();
|
||||
private List<Chance> patterns = new ArrayList<>();
|
||||
private double max = 0;
|
||||
|
||||
/**
|
||||
|
@ -44,9 +44,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public abstract class BreadthFirstSearch implements Operation {
|
||||
|
||||
private final RegionFunction function;
|
||||
private final Queue<BlockVector> queue = new ArrayDeque<BlockVector>();
|
||||
private final Set<BlockVector> visited = new HashSet<BlockVector>();
|
||||
private final List<Vector> directions = new ArrayList<Vector>();
|
||||
private final Queue<BlockVector> queue = new ArrayDeque<>();
|
||||
private final Set<BlockVector> visited = new HashSet<>();
|
||||
private final List<Vector> directions = new ArrayList<>();
|
||||
private int affected = 0;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user