Merge branch 'development'

This commit is contained in:
Brianna 2020-04-07 03:46:14 -04:00
commit d10647c347
6 changed files with 23 additions and 23 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId>
<artifactId>skyblock</artifactId>
<version>2.2.2</version>
<version>2.2.3</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>FabledSkyblock-${project.version}</finalName>

View File

@ -114,9 +114,12 @@ public final class BlockScanner extends BukkitRunnable {
for (int z = 0; z < 16; z++) {
for (int y = scanY; y < 256; y++) {
final CompatibleMaterial type = CompatibleMaterial.getMaterial(shot.getBlockType(x, y, z));
if (type == CompatibleMaterial.AIR || type == CompatibleMaterial.WATER) continue;
final CompatibleMaterial type = CompatibleMaterial.getBlockMaterial(VERSION > 12
? shot.getBlockType(x, y, z) : MaterialIDHelper.getLegacyMaterial(getBlockTypeID(shot, x, y, z)));
if (type == null || type == CompatibleMaterial.AIR || type == CompatibleMaterial.WATER) continue;
blocks.add(new BlockInfo(world, x + (cX), y, z + (cZ)));
}

View File

@ -1504,7 +1504,7 @@ public class IslandManager {
}
public Island getIslandAtLocation(org.bukkit.Location location) {
for (Island island : getIslands().values()) {
for (Island island : new ArrayList<>(getIslands().values())) {
if (isLocationAtIsland(island, location)) {
return island;
}

View File

@ -177,7 +177,7 @@ public final class StructureUtil {
BlockUtil.convertBlockDataToBlock(blockLocation.getBlock(), blockDataList);
} catch (Exception e) {
SkyBlock.getInstance().getLogger()
.warning("Unable to convert BlockData to Block for type {" + blockDataList.getCompatibleMaterial() + ":" + blockDataList.getData() + "} in structure {" + structure.getStructureFile() + "}");
.warning("Unable to convert BlockData to Block for type {" + blockDataList.getMaterial() + ":" + blockDataList.getData() + "} in structure {" + structure.getStructureFile() + "}");
}
});
}

View File

@ -17,7 +17,6 @@ import java.util.Map;
@SuppressWarnings("deprecation")
public class BlockData {
private CompatibleMaterial compatibleMaterial;
private String material;
private String biome;
private String stateType = BlockStateType.NORMAL.toString();
@ -55,8 +54,8 @@ public class BlockData {
private boolean exactTeleport = true;
public BlockData(CompatibleMaterial material, int x, int y, int z, String biome) {
this.compatibleMaterial = material;
public BlockData(String material, int x, int y, int z, String biome) {
this.material = material;
this.x = x;
this.y = y;
this.z = z;
@ -64,14 +63,12 @@ public class BlockData {
this.biome = biome;
}
public CompatibleMaterial getCompatibleMaterial() {
if (compatibleMaterial == null)
return CompatibleMaterial.getMaterial(material);
return compatibleMaterial;
public String getMaterial() {
return this.material;
}
public void setMaterial(CompatibleMaterial material) {
this.compatibleMaterial = material;
public void setMaterial(Material material) {
this.material = material.name();
}
public String getBiome() {

View File

@ -22,7 +22,7 @@ import java.util.List;
public final class BlockUtil extends BlockUtils {
public static BlockData convertBlockToBlockData(Block block, int x, int y, int z) {
BlockData blockData = new BlockData(CompatibleMaterial.getMaterial(block), x, y, z, block.getBiome().toString());
BlockData blockData = new BlockData(block.getType().name(), x, y, z, block.getBiome().toString());
int NMSVersion = NMSUtil.getVersionNumber();
blockData.setVersion(NMSVersion);
@ -246,10 +246,10 @@ public final class BlockUtil extends BlockUtils {
public static void convertBlockDataToBlock(Block block, BlockData blockData) {
int NMSVersion = NMSUtil.getVersionNumber();
CompatibleMaterial material = blockData.getCompatibleMaterial();
String material = blockData.getMaterial();
if (material == null) return;
setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData());
setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), Material.valueOf(material), blockData.getData());
// TODO Create a class to support biome changes
// block.setBiome(Biome.valueOf(blockData.getBiome().toUpperCase()));
@ -424,10 +424,10 @@ public final class BlockUtil extends BlockUtils {
String[] flower = blockData.getFlower().split(":");
int materialData = Integer.parseInt(flower[1]);
material = CompatibleMaterial.getMaterial(flower[0].toUpperCase());
material = flower[0].toUpperCase();
if (material != null) {
ItemStack is = new ItemStack(material.getMaterial(), 1, (byte) materialData);
ItemStack is = new ItemStack(Material.getMaterial(material), 1, (byte) materialData);
World world = block.getWorld();
@ -462,16 +462,16 @@ public final class BlockUtil extends BlockUtils {
if (blockData.getVersion() > 12) {
if (NMSVersion > 12) {
material = CompatibleMaterial.valueOf(flower[0].toUpperCase());
material = flower[0].toUpperCase();
}
} else {
if (NMSVersion < 13) {
material = CompatibleMaterial.valueOf(flower[0].toUpperCase());
material = flower[0].toUpperCase();
}
}
if (material != null) {
flowerPot.setContents(new MaterialData(material.getMaterial(), (byte) Integer.parseInt(flower[1])));
flowerPot.setContents(new MaterialData(Material.getMaterial(material), (byte) Integer.parseInt(flower[1])));
}
state.setData(flowerPot);
@ -479,7 +479,7 @@ public final class BlockUtil extends BlockUtils {
}
}
if (blockData.getCompatibleMaterial().equals("DOUBLE_PLANT")) {
if (material.equals("DOUBLE_PLANT")) {
Block topBlock = block.getLocation().add(0.0D, 1.0D, 0.0D).getBlock();
Block bottomBlock = block.getLocation().subtract(0.0D, 1.0D, 0.0D).getBlock();