Permalink
Browse files

Remove all raw usages of BSH, improve API generics

  • Loading branch information...
kenzierocks committed Dec 27, 2018
1 parent a88f6b8 commit 3fefcbf97183cc2cf8fff36baf8d76908c5891f3
Showing with 241 additions and 258 deletions.
  1. +1 −1 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java
  2. +1 −1 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java
  3. +1 −1 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java
  4. +2 −2 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
  5. +2 −2 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java
  6. +17 −17 worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java
  7. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/blocks/Blocks.java
  8. +0 −1 worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java
  9. +0 −1 worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java
  10. +8 −7 worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java
  11. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java
  12. +4 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java
  13. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java
  14. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java
  15. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java
  16. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java
  17. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java
  18. +4 −5 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java
  19. +11 −9 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java
  20. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/BlocksMaskParser.java
  21. +2 −2 ...-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/RandomPatternParser.java
  22. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java
  23. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java
  24. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java
  25. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java
  26. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java
  27. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java
  28. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java
  29. +7 −6 worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java
  30. +7 −7 worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java
  31. +2 −2 ...e/src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/NBTCompatibilityHandler.java
  32. +3 −2 .../src/main/java/com/sk89q/worldedit/extent/clipboard/io/legacycompat/SignCompatibilityHandler.java
  33. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java
  34. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java
  35. +4 −3 worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java
  36. +14 −24 worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java
  37. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java
  38. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java
  39. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java
  40. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java
  41. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java
  42. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java
  43. +10 −11 worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java
  44. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java
  45. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java
  46. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java
  47. +10 −9 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java
  48. +6 −6 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java
  49. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java
  50. +2 −1 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java
  51. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java
  52. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java
  53. +8 −7 worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java
  54. +1 −14 worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java
  55. +0 −1 worldedit-core/src/main/java/com/sk89q/worldedit/internal/registry/AbstractFactory.java
  56. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java
  57. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java
  58. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java
  59. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java
  60. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/registry/state/AbstractProperty.java
  61. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/scripting/CraftScriptContext.java
  62. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java
  63. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java
  64. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java
  65. +2 −1 worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java
  66. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java
  67. +1 −3 worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java
  68. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java
  69. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java
  70. +9 −9 worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java
  71. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java
  72. +6 −5 worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java
  73. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java
  74. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java
  75. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java
  76. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java
  77. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java
  78. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java
  79. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java
  80. +1 −1 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java
  81. +1 −2 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java
  82. +2 −1 worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java
  83. +1 −1 worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java
@@ -381,7 +381,7 @@ public BlockState apply(@Nullable String input) {
* @param block The WorldEdit BlockStateHolder
* @return The Bukkit BlockData
*/
public static BlockData adapt(BlockStateHolder block) {
public static <B extends BlockStateHolder<B>> BlockData adapt(B block) {
checkNotNull(block);
return blockDataCache.computeIfAbsent(block.getAsString(), new Function<String, BlockData>() {
@Nullable
@@ -47,7 +47,7 @@ public BlockMaterial getMaterial(BlockType blockType) {

@Nullable
@Override
public Map<String, ? extends Property> getProperties(BlockType blockType) {
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) {
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) {
return WorldEditPlugin.getInstance().getBukkitImplAdapter().getProperties(blockType);
}
@@ -255,7 +255,7 @@ public boolean isPersistent() {
}

@Override
public void sendFakeBlock(BlockVector3 pos, BlockStateHolder block) {
public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) {
Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ());
if (block == null) {
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
@@ -166,7 +166,7 @@ public int getBlockLightLevel(BlockVector3 pt) {

@Override
public boolean regenerate(Region region, EditSession editSession) {
BlockStateHolder[] history = new BlockStateHolder[16 * 16 * (getMaxY() + 1)];
BaseBlock[] history = new BaseBlock[16 * 16 * (getMaxY() + 1)];

for (BlockVector2 chunk : region.getChunks()) {
BlockVector3 min = BlockVector3.at(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
@@ -421,7 +421,7 @@ public void simulateBlockMine(BlockVector3 pt) {
}

@Override
public boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
try {
@@ -77,7 +77,7 @@
* @param notifyAndLight notify and light if set
* @return true if a block was likely changed
*/
boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight);
boolean setBlock(Location location, BlockStateHolder<?> state, boolean notifyAndLight);

/**
* Notifies the simulation that the block at the given location has
@@ -113,7 +113,7 @@
* @param blockType The block type
* @return The properties map
*/
Map<String, ? extends Property> getProperties(BlockType blockType);
Map<String, ? extends Property<?>> getProperties(BlockType blockType);

/**
* Send the given NBT data to the player.
@@ -609,7 +609,7 @@ public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
* @return whether the block changed
* @throws WorldEditException thrown on a set error
*/
public boolean setBlock(BlockVector3 position, BlockStateHolder block, Stage stage) throws WorldEditException {
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, Stage stage) throws WorldEditException {
switch (stage) {
case BEFORE_HISTORY:
return bypassNone.setBlock(position, block);
@@ -629,7 +629,7 @@ public boolean setBlock(BlockVector3 position, BlockStateHolder block, Stage sta
* @param block the block
* @return whether the block changed
*/
public boolean rawSetBlock(BlockVector3 position, BlockStateHolder block) {
public <B extends BlockStateHolder<B>> boolean rawSetBlock(BlockVector3 position, B block) {
try {
return setBlock(position, block, Stage.BEFORE_CHANGE);
} catch (WorldEditException e) {
@@ -644,7 +644,7 @@ public boolean rawSetBlock(BlockVector3 position, BlockStateHolder block) {
* @param block the block
* @return whether the block changed
*/
public boolean smartSetBlock(BlockVector3 position, BlockStateHolder block) {
public <B extends BlockStateHolder<B>> boolean smartSetBlock(BlockVector3 position, B block) {
try {
return setBlock(position, block, Stage.BEFORE_REORDER);
} catch (WorldEditException e) {
@@ -653,7 +653,7 @@ public boolean smartSetBlock(BlockVector3 position, BlockStateHolder block) {
}

@Override
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws MaxChangedBlocksException {
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException {
try {
return setBlock(position, block, Stage.BEFORE_HISTORY);
} catch (MaxChangedBlocksException e) {
@@ -779,7 +779,7 @@ public void flushSession() {
* @param searchBlocks the list of blocks to search
* @return the number of blocks that matched the pattern
*/
public int countBlocks(Region region, Set<BlockStateHolder> searchBlocks) {
public int countBlocks(Region region, Set<BaseBlock> searchBlocks) {
BlockMask mask = new BlockMask(this, searchBlocks);
Counter count = new Counter();
RegionMaskingFilter filter = new RegionMaskingFilter(mask, count);
@@ -799,7 +799,7 @@ public int countBlocks(Region region, Set<BlockStateHolder> searchBlocks) {
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int fillXZ(BlockVector3 origin, BlockStateHolder block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException {
public <B extends BlockStateHolder<B>> int fillXZ(BlockVector3 origin, B block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException {
return fillXZ(origin, new BlockPattern(block), radius, depth, recursive);
}

@@ -922,7 +922,7 @@ public int removeNear(BlockVector3 position, BlockType blockType, int apothem) t
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int setBlocks(Region region, BlockStateHolder block) throws MaxChangedBlocksException {
public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException {
return setBlocks(region, new BlockPattern(block));
}

@@ -954,7 +954,7 @@ public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksExce
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int replaceBlocks(Region region, Set<BlockStateHolder> filter, BlockStateHolder replacement) throws MaxChangedBlocksException {
public <B extends BlockStateHolder<B>> int replaceBlocks(Region region, Set<BaseBlock> filter, B replacement) throws MaxChangedBlocksException {
return replaceBlocks(region, filter, new BlockPattern(replacement));
}

@@ -968,7 +968,7 @@ public int replaceBlocks(Region region, Set<BlockStateHolder> filter, BlockState
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int replaceBlocks(Region region, Set<BlockStateHolder> filter, Pattern pattern) throws MaxChangedBlocksException {
public int replaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) throws MaxChangedBlocksException {
Mask mask = filter == null ? new ExistingBlockMask(this) : new BlockMask(this, filter);
return replaceBlocks(region, mask, pattern);
}
@@ -1026,7 +1026,7 @@ public int center(Region region, Pattern pattern) throws MaxChangedBlocksExcepti
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int makeCuboidFaces(Region region, BlockStateHolder block) throws MaxChangedBlocksException {
public <B extends BlockStateHolder<B>> int makeCuboidFaces(Region region, B block) throws MaxChangedBlocksException {
return makeCuboidFaces(region, new BlockPattern(block));
}

@@ -1078,7 +1078,7 @@ public int makeFaces(final Region region, Pattern pattern) throws MaxChangedBloc
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int makeCuboidWalls(Region region, BlockStateHolder block) throws MaxChangedBlocksException {
public <B extends BlockStateHolder<B>> int makeCuboidWalls(Region region, B block) throws MaxChangedBlocksException {
return makeCuboidWalls(region, new BlockPattern(block));
}

@@ -1121,7 +1121,7 @@ public int makeWalls(final Region region, Pattern pattern) throws MaxChangedBloc
final int maxY = region.getMaximumPoint().getBlockY();
final ArbitraryShape shape = new RegionShape(region) {
@Override
protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) {
protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) {
if (y > maxY || y < minY) {
// Put holes into the floor and ceiling by telling ArbitraryShape that the shape goes on outside the region
return defaultMaterial;
@@ -1143,7 +1143,7 @@ protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder def
* @return number of blocks affected
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int overlayCuboidBlocks(Region region, BlockStateHolder block) throws MaxChangedBlocksException {
public <B extends BlockStateHolder<B>> int overlayCuboidBlocks(Region region, B block) throws MaxChangedBlocksException {
checkNotNull(block);

return overlayCuboidBlocks(region, new BlockPattern(block));
@@ -1831,8 +1831,8 @@ public int makeForest(BlockVector3 basePosition, int size, double density, TreeG
* @param region a region
* @return the results
*/
public List<Countable<BlockStateHolder>> getBlockDistribution(Region region, boolean fuzzy) {
BlockDistributionCounter count = new BlockDistributionCounter(this, fuzzy);
public List<Countable<BlockState>> getBlockDistribution(Region region, boolean separateStates) {
BlockDistributionCounter count = new BlockDistributionCounter(this, separateStates);
RegionVisitor visitor = new RegionVisitor(region, count);
Operations.completeBlindly(visitor);
return count.getDistribution();
@@ -1850,7 +1850,7 @@ public int makeShape(final Region region, final Vector3 zero, final Vector3 unit

final ArbitraryShape shape = new ArbitraryShape(region) {
@Override
protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder defaultMaterial) {
protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial) {
final Vector3 current = Vector3.at(x, y, z);
environment.setCurrentBlock(current);
final Vector3 scaled = current.subtract(zero).divide(unit);
@@ -1861,7 +1861,7 @@ protected BlockStateHolder getMaterial(int x, int y, int z, BlockStateHolder def
return null;
}

return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue());
return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue()).toBaseBlock();
} catch (Exception e) {
log.log(Level.WARNING, "Failed to create shape", e);
return null;
@@ -38,9 +38,9 @@ private Blocks() {
* @param o the block
* @return true if the collection contains the given block
*/
public static boolean containsFuzzy(Collection<? extends BlockStateHolder> collection, BlockStateHolder o) {
public static <B extends BlockStateHolder<B>> boolean containsFuzzy(Collection<? extends BlockStateHolder<?>> collection, B o) {
// Allow masked data in the searchBlocks to match various types
for (BlockStateHolder b : collection) {
for (BlockStateHolder<?> b : collection) {
if (b.equalsFuzzy(o)) {
return true;
}
@@ -40,7 +40,6 @@
*/
public class NavigationCommands {

@SuppressWarnings("unused")
private final WorldEdit worldEdit;

/**
@@ -62,7 +62,6 @@
import com.sk89q.worldedit.util.command.binding.Switch;
import com.sk89q.worldedit.util.command.binding.Text;
import com.sk89q.worldedit.util.command.parametric.Optional;
import com.sk89q.worldedit.world.block.BlockStateHolder;

import java.util.ArrayList;
import java.util.List;
@@ -57,7 +57,8 @@
import com.sk89q.worldedit.util.formatting.StyledFragment;
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.storage.ChunkStore;

@@ -638,7 +639,7 @@ public void count(Player player, LocalSession session, EditSession editSession,
context.setSession(session);
context.setRestricted(false);

Set<BlockStateHolder> searchBlocks = we.getBlockFactory().parseFromListInput(args.getString(0), context);
Set<BaseBlock> searchBlocks = we.getBlockFactory().parseFromListInput(args.getString(0), context);
int count = editSession.countBlocks(session.getSelection(player.getWorld()), searchBlocks);
player.print("Counted: " + count);
}
@@ -659,14 +660,14 @@ public void count(Player player, LocalSession session, EditSession editSession,
public void distr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException, CommandException {

int size;
boolean useData = args.hasFlag('d');
List<Countable<BlockStateHolder>> distribution;
boolean separateStates = args.hasFlag('d');
List<Countable<BlockState>> distribution;

if (args.hasFlag('c')) {
// TODO: Update for new clipboard
throw new CommandException("Needs to be re-written again");
} else {
distribution = editSession.getBlockDistribution(session.getSelection(player.getWorld()), !useData);
distribution = editSession.getBlockDistribution(session.getSelection(player.getWorld()), separateStates);
size = session.getSelection(player.getWorld()).getArea();
}

@@ -677,10 +678,10 @@ public void distr(Player player, LocalSession session, EditSession editSession,

player.print("# total blocks: " + size);

for (Countable<BlockStateHolder> c : distribution) {
for (Countable<BlockState> c : distribution) {
String name = c.getID().getBlockType().getName();
String str;
if (useData) {
if (separateStates) {
str = String.format("%-7s (%.3f%%) %s #%s",
String.valueOf(c.getAmount()),
c.getAmount() / (double) size * 100,
@@ -64,7 +64,7 @@
import com.sk89q.worldedit.util.formatting.component.CommandListBox;
import com.sk89q.worldedit.util.formatting.component.CommandUsageBox;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;

import java.util.ArrayList;
@@ -250,7 +250,7 @@ public void removeNear(Player player, LocalSession session, EditSession editSess
context.setRestricted(false);
context.setPreferringWildcard(false);

BlockStateHolder block = we.getBlockFactory().parseFromInput(args.getString(0), context);
BaseBlock block = we.getBlockFactory().parseFromInput(args.getString(0), context);
int size = Math.max(1, args.getInteger(1, 50));
we.checkMaxRadius(size);

@@ -272,7 +272,7 @@ public void replaceNear(Player player, LocalSession session, EditSession editSes

int size = Math.max(1, args.getInteger(0));
int affected;
Set<BlockStateHolder> from;
Set<BaseBlock> from;
Pattern to;

ParserContext context = new ParserContext();
@@ -68,7 +68,7 @@ private boolean handleCycle(Platform server, LocalConfiguration config,
if (block.getStates().keySet().isEmpty()) {
player.printError("That block's data cannot be cycled!");
} else {
Property currentProperty = selectedProperties.get(player.getUniqueId());
Property<?> currentProperty = selectedProperties.get(player.getUniqueId());

if (currentProperty == null || (forward && block.getState(currentProperty) == null)) {
currentProperty = block.getStates().keySet().stream().findFirst().get();
@@ -79,7 +79,9 @@ private boolean handleCycle(Platform server, LocalConfiguration config,
block.getState(currentProperty);
int index = currentProperty.getValues().indexOf(block.getState(currentProperty));
index = (index + 1) % currentProperty.getValues().size();
BlockState newBlock = block.with(currentProperty, currentProperty.getValues().get(index));
@SuppressWarnings("unchecked")
Property<Object> objProp = (Property<Object>) currentProperty;
BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index));

try (EditSession editSession = session.createEditSession(player)) {
editSession.disableBuffering();
@@ -30,7 +30,7 @@
import com.sk89q.worldedit.function.pattern.BlockPattern;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockState;

/**
* A mode that replaces one block.
@@ -73,7 +73,7 @@ public boolean actPrimary(Platform server, LocalConfiguration config, Player pla

@Override
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
BlockStateHolder targetBlock = player.getWorld().getBlock(clicked.toVector().toBlockPoint());
BlockState targetBlock = player.getWorld().getBlock(clicked.toVector().toBlockPoint());

if (targetBlock != null) {
pattern = new BlockPattern(targetBlock);
Oops, something went wrong.

0 comments on commit 3fefcbf

Please sign in to comment.