mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-26 12:16:30 +01:00
Build 29
# Fixed IAE when a material cannot be found when pasting a structure on Island creation. Block materials that cannot be found will be set to stone. # Fixed NPE when the island world height is less than 256 blocks. # Pasting a structure on Island creation should be a lot better now on performance.
This commit is contained in:
parent
21f5116d71
commit
123070e1c9
@ -1,6 +1,6 @@
|
||||
name: SkyBlock
|
||||
main: me.goodandevil.skyblock.SkyBlock
|
||||
version: 28
|
||||
version: 29
|
||||
api-version: 1.13
|
||||
description: A unique SkyBlock plugin
|
||||
author: GoodAndEvil
|
||||
|
@ -56,7 +56,7 @@ public class BiomeManager {
|
||||
|
||||
Location location = island.getLocation(me.goodandevil.skyblock.island.Location.World.Normal, me.goodandevil.skyblock.island.Location.Environment.Island);
|
||||
|
||||
for (Location locationList : LocationUtil.getLocations(new Location(location.getWorld(), location.getBlockX() - island.getRadius(), 0, location.getBlockZ() - island.getRadius()), new Location(location.getWorld(), location.getBlockX() + island.getRadius(), 256, location.getBlockZ() + island.getRadius()))) {
|
||||
for (Location locationList : LocationUtil.getLocations(new Location(location.getWorld(), location.getBlockX() - island.getRadius(), 0, location.getBlockZ() - island.getRadius()), new Location(location.getWorld(), location.getBlockX() + island.getRadius(), location.getWorld().getMaxHeight(), location.getBlockZ() + island.getRadius()))) {
|
||||
try {
|
||||
Block block = locationList.getBlock();
|
||||
|
||||
|
@ -3,7 +3,6 @@ package me.goodandevil.skyblock.command.commands;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -43,54 +42,49 @@ public class CreateCommand extends SubCommand {
|
||||
Config config = fileManager.getConfig(new File(skyblock.getDataFolder(), "language.yml"));
|
||||
FileConfiguration configLoad = config.getFileConfiguration();
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (islandManager.hasIsland(player)) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Create.Owner.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
if (islandManager.hasIsland(player)) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Create.Owner.Message"));
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
Config mainConfig = fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml"));
|
||||
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Creation.Menu.Enable")) {
|
||||
Creator.getInstance().open(player);
|
||||
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
|
||||
if (mainConfig.getFileConfiguration().getBoolean("Island.Creation.Menu.Enable")) {
|
||||
Creator.getInstance().open(player);
|
||||
soundManager.playSound(player, Sounds.CHEST_OPEN.bukkitSound(), 1.0F, 1.0F);
|
||||
} else {
|
||||
List<Structure> structures = skyblock.getStructureManager().getStructures();
|
||||
|
||||
if (structures.size() == 0) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.None.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else if (!fileManager.isFileExist(new File(new File(skyblock.getDataFolder().toString() + "/structures"), structures.get(0).getFile()))) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.File.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Creation.Cooldown.Creation.Enable") && creationManager.hasPlayer(player)) {
|
||||
Creation creation = creationManager.getPlayer(player);
|
||||
|
||||
if (creation.getTime() < 60) {
|
||||
messageManager.sendMessage(player, config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Message").replace("%time", creation.getTime() + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Second")));
|
||||
} else {
|
||||
List<Structure> structures = skyblock.getStructureManager().getStructures();
|
||||
|
||||
if (structures.size() == 0) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.None.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else if (!fileManager.isFileExist(new File(new File(skyblock.getDataFolder().toString() + "/structures"), structures.get(0).getFile()))) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.File.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Creation.Cooldown.Creation.Enable") && creationManager.hasPlayer(player)) {
|
||||
Creation creation = creationManager.getPlayer(player);
|
||||
|
||||
if (creation.getTime() < 60) {
|
||||
messageManager.sendMessage(player, config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Message").replace("%time", creation.getTime() + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Second")));
|
||||
} else {
|
||||
long[] durationTime = NumberUtil.getDuration(creation.getTime());
|
||||
messageManager.sendMessage(player, config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Message").replace("%time", durationTime[2] + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Minute") + " " + durationTime[3] + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Second")));
|
||||
}
|
||||
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
islandManager.createIsland(player, structures.get(0));
|
||||
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Created.Message"));
|
||||
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
|
||||
long[] durationTime = NumberUtil.getDuration(creation.getTime());
|
||||
messageManager.sendMessage(player, config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Message").replace("%time", durationTime[2] + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Minute") + " " + durationTime[3] + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Second")));
|
||||
}
|
||||
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
islandManager.createIsland(player, structures.get(0));
|
||||
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Created.Message"));
|
||||
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +49,7 @@ public class Chunk {
|
||||
Location islandLocation = island.getLocation(worldList, me.goodandevil.skyblock.island.Location.Environment.Island);
|
||||
|
||||
Location minLocation = new Location(islandLocation.getWorld(), islandLocation.getBlockX() - island.getRadius(), 0, islandLocation.getBlockZ() - island.getRadius());
|
||||
Location maxLocation = new Location(islandLocation.getWorld(), islandLocation.getBlockX() + island.getRadius(), 256, islandLocation.getBlockZ() + island.getRadius());
|
||||
Location maxLocation = new Location(islandLocation.getWorld(), islandLocation.getBlockX() + island.getRadius(), islandLocation.getWorld().getMaxHeight(), islandLocation.getBlockZ() + island.getRadius());
|
||||
|
||||
int MinX = Math.min(maxLocation.getBlockX(), minLocation.getBlockX());
|
||||
int MinZ = Math.min(maxLocation.getBlockZ(), minLocation.getBlockZ());
|
||||
|
@ -22,10 +22,12 @@ import me.goodandevil.skyblock.SkyBlock;
|
||||
import me.goodandevil.skyblock.config.FileManager.Config;
|
||||
import me.goodandevil.skyblock.island.Island;
|
||||
import me.goodandevil.skyblock.island.IslandManager;
|
||||
import me.goodandevil.skyblock.island.Location;
|
||||
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
|
||||
import me.goodandevil.skyblock.utils.version.Materials;
|
||||
import me.goodandevil.skyblock.utils.version.NMSUtil;
|
||||
import me.goodandevil.skyblock.utils.version.Sounds;
|
||||
import me.goodandevil.skyblock.world.WorldManager;
|
||||
|
||||
public class LevellingManager {
|
||||
|
||||
@ -69,6 +71,8 @@ public class LevellingManager {
|
||||
}
|
||||
|
||||
public void calculatePoints(Player player, Island island) {
|
||||
WorldManager worldManager = skyblock.getWorldManager();
|
||||
|
||||
Chunk chunk = new Chunk(skyblock, island);
|
||||
chunk.prepare();
|
||||
|
||||
@ -88,10 +92,20 @@ public class LevellingManager {
|
||||
Method getBlockTypeDataMethod = null;
|
||||
Method getMaterialMethod = null;
|
||||
|
||||
int worldMaxHeight = 0;
|
||||
|
||||
for (Location.World worldList : Location.World.values()) {
|
||||
org.bukkit.World world = worldManager.getWorld(worldList);
|
||||
|
||||
if (worldMaxHeight == 0 || worldMaxHeight > world.getMaxHeight()) {
|
||||
worldMaxHeight = world.getMaxHeight();
|
||||
}
|
||||
}
|
||||
|
||||
for (ChunkSnapshot chunkSnapshotList : chunk.getChunkSnapshots()) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
for (int y = 0; y < 256; y++) {
|
||||
for (int y = 0; y < worldMaxHeight; y++) {
|
||||
try {
|
||||
org.bukkit.Material blockMaterial = org.bukkit.Material.AIR;
|
||||
int blockData = 0;
|
||||
|
@ -4,6 +4,7 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -135,49 +136,59 @@ public class Creator implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Structure structureList : skyblock.getStructureManager().getStructures()) {
|
||||
if ((event.getCurrentItem().getType() == structureList.getMaterials().parseMaterial()) && (is.hasItemMeta()) && (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Creator.Selector.Item.Island.Displayname").replace("%displayname", structureList.getDisplayname()))))) {
|
||||
if (structureList.isPermission() && structureList.getPermission() != null && !structureList.getPermission().isEmpty()) {
|
||||
if (!player.hasPermission(structureList.getPermission()) && !player.hasPermission("skyblock.island.*") && !player.hasPermission("skyblock.*")) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(skyblock, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Structure structureList : skyblock.getStructureManager().getStructures()) {
|
||||
if ((event.getCurrentItem().getType() == structureList.getMaterials().parseMaterial()) && (is.hasItemMeta()) && (is.getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Menu.Creator.Selector.Item.Island.Displayname").replace("%displayname", structureList.getDisplayname()))))) {
|
||||
if (structureList.isPermission() && structureList.getPermission() != null && !structureList.getPermission().isEmpty()) {
|
||||
if (!player.hasPermission(structureList.getPermission()) && !player.hasPermission("skyblock.island.*") && !player.hasPermission("skyblock.*")) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Permission.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
open(player);
|
||||
Bukkit.getServer().getScheduler().runTask(skyblock, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
open(player);
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileManager.isFileExist(new File(new File(skyblock.getDataFolder().toString() + "/structures"), structureList.getFile()))) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.File.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Creation.Cooldown.Creation.Enable") && creationManager.hasPlayer(player)) {
|
||||
Creation creation = creationManager.getPlayer(player);
|
||||
|
||||
if (creation.getTime() < 60) {
|
||||
messageManager.sendMessage(player, config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Message").replace("%time", creation.getTime() + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Second")));
|
||||
} else {
|
||||
long[] durationTime = NumberUtil.getDuration(creation.getTime());
|
||||
messageManager.sendMessage(player, config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Message").replace("%time", durationTime[2] + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Minute") + " " + durationTime[3] + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Second")));
|
||||
}
|
||||
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
islandManager.createIsland(player, structureList);
|
||||
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Created.Message"));
|
||||
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
player.closeInventory();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileManager.isFileExist(new File(new File(skyblock.getDataFolder().toString() + "/structures"), structureList.getFile()))) {
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.File.Message"));
|
||||
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
} else if (fileManager.getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Creation.Cooldown.Creation.Enable") && creationManager.hasPlayer(player)) {
|
||||
Creation creation = creationManager.getPlayer(player);
|
||||
|
||||
if (creation.getTime() < 60) {
|
||||
messageManager.sendMessage(player, config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Message").replace("%time", creation.getTime() + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Second")));
|
||||
} else {
|
||||
long[] durationTime = NumberUtil.getDuration(creation.getTime());
|
||||
messageManager.sendMessage(player, config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Message").replace("%time", durationTime[2] + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Minute") + " " + durationTime[3] + " " + config.getFileConfiguration().getString("Island.Creator.Selector.Cooldown.Word.Second")));
|
||||
}
|
||||
|
||||
soundManager.playSound(player, Sounds.VILLAGER_NO.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
islandManager.createIsland(player, structureList);
|
||||
|
||||
messageManager.sendMessage(player, configLoad.getString("Island.Creator.Selector.Created.Message"));
|
||||
soundManager.playSound(player, Sounds.NOTE_PLING.bukkitSound(), 1.0F, 1.0F);
|
||||
|
||||
player.closeInventory();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import me.goodandevil.skyblock.utils.world.block.BlockUtil;
|
||||
import me.goodandevil.skyblock.utils.world.entity.EntityData;
|
||||
import me.goodandevil.skyblock.utils.world.entity.EntityUtil;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@ -121,25 +122,35 @@ public final class StructureUtil {
|
||||
List<BlockData> blockData = (List<BlockData>) new Gson().fromJson(storage.getBlocks(), new TypeToken<List<BlockData>>(){}.getType());
|
||||
|
||||
for (BlockData blockDataList : blockData) {
|
||||
try {
|
||||
org.bukkit.Location blockRotationLocation = LocationUtil.rotateLocation(new org.bukkit.Location(location.getWorld(), blockDataList.getX(), blockDataList.getY(), blockDataList.getZ()), type);
|
||||
org.bukkit.Location blockLocation = new org.bukkit.Location(location.getWorld(), location.getX() - Math.abs(Integer.valueOf(originLocationPositions[0])), location.getY() - Integer.valueOf(originLocationPositions[1]), location.getZ() + Math.abs(Integer.valueOf(originLocationPositions[2])));
|
||||
blockLocation.add(blockRotationLocation);
|
||||
BlockUtil.convertBlockDataToBlock(blockLocation.getBlock(), blockDataList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SkyBlock.getInstance(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
org.bukkit.Location blockRotationLocation = LocationUtil.rotateLocation(new org.bukkit.Location(location.getWorld(), blockDataList.getX(), blockDataList.getY(), blockDataList.getZ()), type);
|
||||
org.bukkit.Location blockLocation = new org.bukkit.Location(location.getWorld(), location.getX() - Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[0])), location.getY() - Integer.valueOf(storage.getOriginLocation().split(":")[1]), location.getZ() + Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[2])));
|
||||
blockLocation.add(blockRotationLocation);
|
||||
BlockUtil.convertBlockDataToBlock(blockLocation.getBlock(), blockDataList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (EntityData entityDataList : (List<EntityData>) new Gson().fromJson(storage.getEntities(), new TypeToken<List<EntityData>>(){}.getType())) {
|
||||
try {
|
||||
org.bukkit.Location blockRotationLocation = LocationUtil.rotateLocation(new org.bukkit.Location(location.getWorld(), entityDataList.getX(), entityDataList.getY(), entityDataList.getZ()), type);
|
||||
org.bukkit.Location blockLocation = new org.bukkit.Location(location.getWorld(), location.getX() - Math.abs(Integer.valueOf(originLocationPositions[0])), location.getY() - Integer.valueOf(originLocationPositions[1]), location.getZ() + Math.abs(Integer.valueOf(originLocationPositions[2])));
|
||||
blockLocation.add(blockRotationLocation);
|
||||
EntityUtil.convertEntityDataToEntity(entityDataList, blockLocation, type);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SkyBlock.getInstance(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
org.bukkit.Location blockRotationLocation = LocationUtil.rotateLocation(new org.bukkit.Location(location.getWorld(), entityDataList.getX(), entityDataList.getY(), entityDataList.getZ()), type);
|
||||
org.bukkit.Location blockLocation = new org.bukkit.Location(location.getWorld(), location.getX() - Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[0])), location.getY() - Integer.valueOf(storage.getOriginLocation().split(":")[1]), location.getZ() + Math.abs(Integer.valueOf(storage.getOriginLocation().split(":")[2])));
|
||||
blockLocation.add(blockRotationLocation);
|
||||
EntityUtil.convertEntityDataToEntity(entityDataList, blockLocation, type);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return new Float[] { yaw, pitch };
|
||||
|
@ -89,7 +89,7 @@ public final class LocationUtil {
|
||||
}
|
||||
|
||||
public static Location getHighestBlock(Location location) {
|
||||
for(int y = 256; y > 0; y--){
|
||||
for(int y = location.getWorld().getMaxHeight(); y > 0; y--){
|
||||
location.setY(y);
|
||||
|
||||
Block block = location.getBlock();
|
||||
@ -106,7 +106,7 @@ public final class LocationUtil {
|
||||
int maxY = 0;
|
||||
boolean followY = false;
|
||||
|
||||
for(int y = 0; y < 256; y++){
|
||||
for(int y = 0; y < location.getWorld().getMaxHeight(); y++){
|
||||
Location loc = new Location(location.getWorld(), location.getBlockX(), y, location.getBlockZ());
|
||||
Block block = loc.getBlock().getRelative(BlockFace.UP);
|
||||
|
||||
|
@ -211,10 +211,14 @@ public final class BlockUtil {
|
||||
material = Materials.requestMaterials(blockData.getMaterial(), block.getData()).getPostMaterial();
|
||||
}
|
||||
} else {
|
||||
if (blockData.getVersion() > 12) {
|
||||
material = Materials.fromString(blockData.getMaterial()).parseMaterial();
|
||||
} else {
|
||||
material = Material.valueOf(blockData.getMaterial());
|
||||
try {
|
||||
if (blockData.getVersion() > 12) {
|
||||
material = Materials.fromString(blockData.getMaterial()).parseMaterial();
|
||||
} else {
|
||||
material = Material.valueOf(blockData.getMaterial());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
material = Material.STONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user