Remove all raw usages of BSH, improve API generics

This commit is contained in:
Kenzie Togami
2018-12-26 16:39:10 -08:00
parent a88f6b8430
commit 3fefcbf971
83 changed files with 242 additions and 259 deletions

View File

@ -381,7 +381,7 @@ public class BukkitAdapter {
* @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

View File

@ -47,7 +47,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
@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);
}

View File

@ -255,7 +255,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
}
@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());

View File

@ -166,7 +166,7 @@ public class BukkitWorld extends AbstractWorld {
@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 class BukkitWorld extends AbstractWorld {
}
@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 {

View File

@ -77,7 +77,7 @@ public interface BukkitImplAdapter {
* @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 @@ public interface BukkitImplAdapter {
* @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.