# Fixed players dying from the void at an Island when void teleport is enabled in the configuration file.
# Fixed Flower Pots dropping when a structure is pasted on Island creation if a block below it is air.
# Fixed Flower Pot contents not being set when a structure is pasted on Island creation.
# Fixed 'Island Upgrade' menu showing 'Jump Boost' upgrade in two inventory slots for 1.13.
# Fixed 'Island Upgrade' menu not showing the correct potion items for 1.9-1.12.
# Fixed the command '/island admin delete' performing the command '/island delete' instead.
# Fixed NPE that can occur with some Java versions when the visit-data is being loaded.
# Fixed NPE when spawning entities when a structure is pasted on Island creation.
# Fixed 'Island Visit' menu occasionally returning NPE when opening.
This commit is contained in:
Unknown 2018-12-01 22:56:49 +00:00
parent 8ba12fee1e
commit 9034f7c8fe
13 changed files with 374 additions and 115 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>SkyBlock</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>34</version>
<version>35</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>

View File

@ -139,7 +139,7 @@ public class CommandManager implements CommandExecutor, TabCompleter {
subCommands.add(new me.goodandevil.skyblock.command.commands.admin.LevelCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Level.Info.Message"))));
subCommands.add(new me.goodandevil.skyblock.command.commands.admin.SettingsCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Settings.Info.Message"))));
subCommands.add(new StructureCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Structure.Info.Message"))));
subCommands.add(new DeleteCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Delete.Info.Message"))));
subCommands.add(new me.goodandevil.skyblock.command.commands.admin.DeleteCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Delete.Info.Message"))));
subCommands.add(new OwnerCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Owner.Info.Message"))));
subCommands.add(new ReloadCommand(skyblock).setInfo(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Command.Island.Admin.Reload.Info.Message"))));

View File

@ -692,13 +692,14 @@ public class IslandManager {
public List<UUID> getPlayersAtIsland(Island island) {
List<UUID> playersAtIsland = new ArrayList<>();
Map<UUID, PlayerData> playerData = skyblock.getPlayerDataManager().getPlayerData();
for (UUID playerDataList : playerData.keySet()) {
UUID islandOwnerUUID = playerData.get(playerDataList).getIsland();
if (islandOwnerUUID != null && island.getOwnerUUID().equals(islandOwnerUUID)) {
playersAtIsland.add(playerDataList);
if (island != null) {
for (Player all : Bukkit.getOnlinePlayers()) {
for (Location.World worldList : Location.World.values()) {
if (LocationUtil.isLocationAtLocationRadius(all.getLocation(), island.getLocation(worldList, Location.Environment.Island), island.getRadius())) {
playersAtIsland.add(all.getUniqueId());
}
}
}
}

View File

@ -4,11 +4,13 @@ import java.io.File;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.attribute.Attribute;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.potion.PotionEffect;
import me.goodandevil.skyblock.SkyBlock;
import me.goodandevil.skyblock.config.FileManager;
@ -20,6 +22,7 @@ import me.goodandevil.skyblock.message.MessageManager;
import me.goodandevil.skyblock.playerdata.PlayerData;
import me.goodandevil.skyblock.playerdata.PlayerDataManager;
import me.goodandevil.skyblock.sound.SoundManager;
import me.goodandevil.skyblock.utils.version.NMSUtil;
import me.goodandevil.skyblock.utils.version.Sounds;
import me.goodandevil.skyblock.utils.world.LocationUtil;
@ -31,6 +34,7 @@ public class Move implements Listener {
this.skyblock = skyblock;
}
@SuppressWarnings("deprecation")
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
@ -111,11 +115,27 @@ public class Move implements Listener {
if (configLoad.getBoolean("Island.Void.Teleport.Enable")) {
if (to.getY() <= configLoad.getInt("Island.Void.Teleport.Offset")) {
if (island.getSetting(Setting.Role.Owner, "KeepItemsOnDeath").getStatus()) {
player.setFallDistance(0.0F);
player.teleport(island.getLocation(world, me.goodandevil.skyblock.island.Location.Environment.Main));
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
if (!island.getSetting(Setting.Role.Owner, "KeepItemsOnDeath").getStatus()) {
player.getInventory().clear();
player.setLevel(0);
player.setExp(0.0F);
if (NMSUtil.getVersionNumber() > 8) {
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
} else {
player.setHealth(player.getMaxHealth());
}
player.setFoodLevel(20);
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
player.removePotionEffect(potionEffect.getType());
}
}
player.setFallDistance(0.0F);
player.teleport(island.getLocation(world, me.goodandevil.skyblock.island.Location.Environment.Main));
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, 1.0F);
}
}
} else {

View File

@ -512,10 +512,16 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
me.goodandevil.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (NMSVersion > 12) {
PotionMeta pm = (PotionMeta) potion.getItemMeta();
pm.setBasePotionData(new PotionData(PotionType.SPEED));
potion.setItemMeta(pm);
if (NMSVersion > 8) {
PotionMeta pm = (PotionMeta) potion.getItemMeta();
if (NMSVersion > 9) {
pm.setBasePotionData(new PotionData(PotionType.SPEED));
} else {
pm.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 1, 0), true);
}
potion.setItemMeta(pm);
} else {
potion = new ItemStack(Material.POTION, 1, (short) 8194);
}
@ -536,10 +542,17 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
me.goodandevil.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (NMSVersion > 12) {
PotionMeta pm = (PotionMeta) potion.getItemMeta();
pm.setBasePotionData(new PotionData(PotionType.JUMP));
potion.setItemMeta(pm);
if (NMSVersion > 8) {
potion = new ItemStack(Material.POTION);
PotionMeta pm = (PotionMeta) potion.getItemMeta();
if (NMSVersion > 9) {
pm.setBasePotionData(new PotionData(PotionType.JUMP));
} else {
pm.addCustomEffect(new PotionEffect(PotionEffectType.JUMP, 1, 0), true);
}
potion.setItemMeta(pm);
} else {
potion = new ItemStack(Material.POTION, 1, (short) 8203);
}

View File

@ -1,12 +1,18 @@
package me.goodandevil.skyblock.utils;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Date;
import java.util.Scanner;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.google.gson.Gson;
import me.goodandevil.skyblock.SkyBlock;
public class OfflinePlayer {
@ -43,7 +49,7 @@ public class OfflinePlayer {
org.bukkit.OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(uuid);
this.name = offlinePlayer.getName();
this.uuid = offlinePlayer.getUniqueId();
this.uuid = uuid;
FileConfiguration configLoad = YamlConfiguration.loadConfiguration(new File(new File(SkyBlock.getInstance().getDataFolder().toString() + "/player-data"), uuid.toString() + ".yml"));
texture = new String[] { configLoad.getString("Texture.Signature") , configLoad.getString("Texture.Value") };
@ -87,4 +93,34 @@ public class OfflinePlayer {
public int getPlaytime() {
return playtime;
}
public Names[] getNames() {
Names[] names = null;
try {
Scanner jsonScanner = new Scanner((new URL("https://api.mojang.com/user/profiles/" + uuid.toString().replaceAll("-", "") + "/names")).openConnection().getInputStream(), "UTF-8");
names = new Gson().fromJson(jsonScanner.next(), Names[].class);
jsonScanner.close();
} catch(IOException e) {
e.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}
return names;
}
public class Names {
public String name;
public long changedToAt;
public String getName() {
return name;
}
public Date getChangeDate() {
return new Date(changedToAt);
}
}
}

View File

@ -3,5 +3,6 @@ package me.goodandevil.skyblock.utils.world.block;
public enum BlockDataType {
NORMAL,
STAIRS;
STAIRS,
FLOWERPOT;
}

View File

@ -14,7 +14,6 @@ public enum BlockStateType {
SHULKERBOX,
CREATURESPAWNER,
ENDGATEWAY,
FLOWERPOT,
FURNACE,
JUKEBOX,
SIGN,

View File

@ -182,10 +182,6 @@ public final class BlockUtil {
Location location = endGateway.getExitLocation();
blockData.setExitLocation(location.getX() + ":" + location.getY() + ":" + location.getZ() + ":" + location.getWorld().getName());
blockData.setStateType(BlockStateType.ENDGATEWAY.toString());
} else if (blockState instanceof FlowerPot) {
FlowerPot flowerPot = (FlowerPot) blockState;
blockData.setFlower(flowerPot.getContents().getItemType().toString() + ":" + flowerPot.getContents().getData());
blockData.setStateType(BlockStateType.FLOWERPOT.toString());
}
if (NMSVersion > 10) {
@ -209,6 +205,32 @@ public final class BlockUtil {
if (materialData instanceof Stairs) {
blockData.setFacing(((Stairs) materialData).getFacing().toString());
blockData.setDataType(BlockDataType.STAIRS.toString());
} else if (materialData instanceof org.bukkit.material.FlowerPot) {
if (NMSVersion == 8 || NMSVersion == 9) {
try {
World world = block.getWorld();
Class<?> blockPositionClass = NMSUtil.getNMSClass("BlockPosition");
Object worldHandle = world.getClass().getMethod("getHandle").invoke(world);
Object blockPosition = blockPositionClass.getConstructor(int.class, int.class, int.class).newInstance(block.getX(), block.getY(), block.getZ());
Object tileEntity = worldHandle.getClass().getMethod("getTileEntity", blockPositionClass).invoke(worldHandle, blockPosition);
Object item = tileEntity.getClass().getMethod("b").invoke(tileEntity);
Object itemStackNMS = NMSUtil.getNMSClass("ItemStack").getConstructor(NMSUtil.getNMSClass("Item")).newInstance(item);
ItemStack itemStack = (ItemStack) NMSUtil.getCraftClass("inventory.CraftItemStack").getMethod("asBukkitCopy", itemStackNMS.getClass()).invoke(null, itemStackNMS);
int data = (int) tileEntity.getClass().getMethod("c").invoke(tileEntity);
blockData.setFlower(itemStack.getType().name() + ":" + data);
} catch (Exception e) {
e.printStackTrace();
}
} else {
org.bukkit.material.FlowerPot flowerPot = (org.bukkit.material.FlowerPot) materialData;
blockData.setFlower(flowerPot.getContents().getItemType().toString() + ":" + flowerPot.getContents().getData());
}
blockData.setDataType(BlockDataType.FLOWERPOT.toString());
}
return blockData;
@ -222,24 +244,7 @@ public final class BlockUtil {
if (NMSVersion > 12 && blockData.getVersion() > 12 && blockData.getBlockData() != null) {
block.setBlockData(Bukkit.getServer().createBlockData(blockData.getBlockData()));
} else {
if (NMSVersion > 12) {
if (blockData.getVersion() > 12) {
material = Material.valueOf(blockData.getMaterial());
} else {
material = Materials.requestMaterials(blockData.getMaterial(), block.getData()).getPostMaterial();
}
} else {
try {
if (blockData.getVersion() > 12) {
material = Materials.fromString(blockData.getMaterial()).parseMaterial();
} else {
material = Material.valueOf(blockData.getMaterial());
}
} catch (Exception e) {
material = Material.STONE;
}
}
material = getMaterial(NMSVersion, blockData.getVersion(), blockData.getMaterial(), block.getData());
setBlockFast(block.getWorld(), block.getX(), block.getY(), block.getZ(), material, blockData.getData());
}
@ -347,19 +352,17 @@ public final class BlockUtil {
double exitLocationZ = Double.parseDouble(exitLocation[2]);
endGateway.setExitLocation(new Location(exitLocationWorld, exitLocationX, exitLocationY, exitLocationZ));
} else if (blockTypeState == BlockStateType.FLOWERPOT) {
FlowerPot flowerPot = (FlowerPot) block.getState();
String[] flower = blockData.getFlower().split(":");
flowerPot.setContents(new MaterialData(Material.valueOf(flower[0].toUpperCase()), (byte) Integer.parseInt(flower[1])));
}
if (NMSVersion > 10) {
if(blockTypeState == BlockStateType.SHULKERBOX) {
ShulkerBox shulkerBox = (ShulkerBox) block.getState();
for (Integer slotList : blockData.getInventory().keySet()) {
ItemStack is = ItemStackUtil.deserializeItemStack(blockData.getInventory().get(slotList));
shulkerBox.getInventory().setItem(slotList, is);
if (NMSVersion > 9) {
if (NMSVersion > 10) {
if(blockTypeState == BlockStateType.SHULKERBOX) {
ShulkerBox shulkerBox = (ShulkerBox) block.getState();
for (Integer slotList : blockData.getInventory().keySet()) {
ItemStack is = ItemStackUtil.deserializeItemStack(blockData.getInventory().get(slotList));
shulkerBox.getInventory().setItem(slotList, is);
}
}
}
}
@ -372,6 +375,59 @@ public final class BlockUtil {
Stairs stairs = (Stairs) block.getState().getData();
stairs.setFacingDirection(BlockFace.valueOf(blockData.getFacing()));
block.getState().setData(stairs);
} else if (blockDataType == BlockDataType.FLOWERPOT) {
if (NMSVersion == 8 || NMSVersion == 9) {
if (block.getLocation().clone().subtract(0.0D, 1.0D, 0.0D).getBlock().getType() == Material.AIR) {
setBlockFast(block.getWorld(), block.getX(), block.getY() - 1, block.getZ(), Material.STONE, (byte) 0);
}
try {
String[] flower = blockData.getFlower().split(":");
int materialData = Integer.parseInt(flower[1]);
material = getMaterial(NMSVersion, blockData.getVersion(), flower[0].toUpperCase(), materialData);
if (material != null) {
ItemStack is = new ItemStack(material, 1, (byte) materialData);
World world = block.getWorld();
Class<?> blockPositionClass = NMSUtil.getNMSClass("BlockPosition");
Object worldHandle = world.getClass().getMethod("getHandle").invoke(world);
Object blockPosition = blockPositionClass.getConstructor(int.class, int.class, int.class).newInstance(block.getX(), block.getY(), block.getZ());
Object tileEntity = worldHandle.getClass().getMethod("getTileEntity", blockPositionClass).invoke(worldHandle, blockPosition);
Object itemStack = NMSUtil.getCraftClass("inventory.CraftItemStack").getMethod("asNMSCopy", is.getClass()).invoke(null, is);
Object item = itemStack.getClass().getMethod("getItem").invoke(itemStack);
Object data = itemStack.getClass().getMethod("getData").invoke(itemStack);
tileEntity.getClass().getMethod("a", NMSUtil.getNMSClass("Item"), int.class).invoke(tileEntity, item, data);
tileEntity.getClass().getMethod("update").invoke(tileEntity);
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
org.bukkit.material.FlowerPot flowerPot = (org.bukkit.material.FlowerPot) block.getState().getData();
String[] flower = blockData.getFlower().split(":");
material = null;
if (blockData.getVersion() > 12) {
if (NMSVersion > 12) {
material = Material.valueOf(flower[0].toUpperCase());
}
} else {
if (NMSVersion < 13) {
material = Material.valueOf(flower[0].toUpperCase());
}
}
if (material != null) {
flowerPot.setContents(new MaterialData(material, (byte) Integer.parseInt(flower[1])));
}
block.getState().setData(flowerPot);
}
}
if (NMSVersion < 13) {
@ -410,7 +466,7 @@ public final class BlockUtil {
return nearbyBlocks;
}
public static void setBlockFast(World world, int x, int y, int z, Material material, byte data) {
private static void setBlockFast(World world, int x, int y, int z, Material material, byte data) {
try {
Class<?> IBlockDataClass = NMSUtil.getNMSClass("IBlockData");
@ -437,4 +493,24 @@ public final class BlockUtil {
e.printStackTrace();
}
}
private static Material getMaterial(int NMSVersion, int blockVersion, String material, int data) {
if (NMSVersion > 12) {
if (blockVersion > 12) {
return Material.valueOf(material);
} else {
return Materials.requestMaterials(material, (byte) data).getPostMaterial();
}
} else {
try {
if (blockVersion > 12) {
return Materials.fromString(material).parseMaterial();
} else {
return Material.valueOf(material);
}
} catch (Exception e) {
return Material.STONE;
}
}
}
}

View File

@ -12,6 +12,7 @@ import org.bukkit.TreeSpecies;
import org.bukkit.entity.*;
import org.bukkit.entity.minecart.HopperMinecart;
import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Colorable;
@ -32,11 +33,27 @@ public final class EntityUtil {
if (entity instanceof ArmorStand) {
ArmorStand armorStand = (ArmorStand) entity;
entityData.setArms(armorStand.hasArms());
entityData.setHand(ItemStackUtil.serializeItemStack(armorStand.getItemInHand()));
entityData.setHelmet(ItemStackUtil.serializeItemStack(armorStand.getHelmet()));
entityData.setChestplate(ItemStackUtil.serializeItemStack(armorStand.getChestplate()));
entityData.setLeggings(ItemStackUtil.serializeItemStack(armorStand.getLeggings()));
entityData.setBoots(ItemStackUtil.serializeItemStack(armorStand.getBoots()));
if (armorStand.getItemInHand() != null) {
entityData.setHand(ItemStackUtil.serializeItemStack(armorStand.getItemInHand()));
}
if (armorStand.getHelmet() != null) {
entityData.setHelmet(ItemStackUtil.serializeItemStack(armorStand.getHelmet()));
}
if (armorStand.getChestplate() != null) {
entityData.setChestplate(ItemStackUtil.serializeItemStack(armorStand.getChestplate()));
}
if (armorStand.getLeggings() != null) {
entityData.setLeggings(ItemStackUtil.serializeItemStack(armorStand.getLeggings()));
}
if (armorStand.getBoots() != null) {
entityData.setBoots(ItemStackUtil.serializeItemStack(armorStand.getBoots()));
}
entityData.setBasePlate(armorStand.hasBasePlate());
entityData.setVisible(armorStand.isVisible());
entityData.setSmall(armorStand.isSmall());
@ -55,23 +72,51 @@ public final class EntityUtil {
if (entity instanceof LivingEntity) {
LivingEntity livingEntity = (LivingEntity) entity;
EntityEquipment entityEquipment = livingEntity.getEquipment();
if (NMSVersion > 8) {
entityData.setAI(livingEntity.hasAI());
entityData.setHand(ItemStackUtil.serializeItemStack(livingEntity.getEquipment().getItemInMainHand()));
entityData.setOffHand(ItemStackUtil.serializeItemStack(livingEntity.getEquipment().getItemInOffHand()));
entityData.setHelmet(ItemStackUtil.serializeItemStack(livingEntity.getEquipment().getHelmet()));
entityData.setChestplate(ItemStackUtil.serializeItemStack(livingEntity.getEquipment().getChestplate()));
entityData.setLeggings(ItemStackUtil.serializeItemStack(livingEntity.getEquipment().getLeggings()));
entityData.setBoots(ItemStackUtil.serializeItemStack(livingEntity.getEquipment().getBoots()));
entityData.setHandChance(livingEntity.getEquipment().getItemInMainHandDropChance());
entityData.setOffHandChange(livingEntity.getEquipment().getItemInOffHandDropChance());
entityData.setHelmetChance(livingEntity.getEquipment().getHelmetDropChance());
entityData.setChestplateChance(livingEntity.getEquipment().getChestplateDropChance());
entityData.setLeggingsChance(livingEntity.getEquipment().getLeggingsDropChance());
entityData.setBootsChance(livingEntity.getEquipment().getBootsDropChance());
if (entityEquipment.getItemInMainHand() != null) {
entityData.setHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInMainHand()));
}
entityData.setHandChance(entityEquipment.getItemInMainHandDropChance());
if (entityEquipment.getItemInOffHand() != null) {
entityData.setOffHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInOffHand()));
}
entityData.setOffHandChange(entityEquipment.getItemInOffHandDropChance());
} else {
if (entityEquipment.getItemInHand() != null) {
entityData.setHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInHand()));
}
entityData.setHandChance(entityEquipment.getItemInHandDropChance());
}
if (entityEquipment.getHelmet() != null) {
entityData.setHelmet(ItemStackUtil.serializeItemStack(entityEquipment.getHelmet()));
}
if (entityEquipment.getChestplate() != null) {
entityData.setChestplate(ItemStackUtil.serializeItemStack(entityEquipment.getChestplate()));
}
if (entityEquipment.getLeggings() != null) {
entityData.setLeggings(ItemStackUtil.serializeItemStack(entityEquipment.getLeggings()));
}
if (entityEquipment.getBoots() != null) {
entityData.setBoots(ItemStackUtil.serializeItemStack(entityEquipment.getBoots()));
}
entityData.setHelmetChance(entityEquipment.getHelmetDropChance());
entityData.setChestplateChance(entityEquipment.getChestplateDropChance());
entityData.setLeggingsChance(entityEquipment.getLeggingsDropChance());
entityData.setBootsChance(entityEquipment.getBootsDropChance());
if (entity instanceof Bat) {
entityData.setAwake(((Bat) entityData).isAwake());
} else if (entity instanceof Creeper) {
@ -216,11 +261,27 @@ public final class EntityUtil {
if (entity instanceof ArmorStand) {
ArmorStand armorStand = (ArmorStand) entity;
armorStand.setArms(entityData.hasArms());
armorStand.setItemInHand(ItemStackUtil.deserializeItemStack(entityData.getHand()));
armorStand.setHelmet(ItemStackUtil.deserializeItemStack(entityData.getHelmet()));
armorStand.setChestplate(ItemStackUtil.deserializeItemStack(entityData.getChestplate()));
armorStand.setLeggings(ItemStackUtil.deserializeItemStack(entityData.getLeggings()));
armorStand.setBoots(ItemStackUtil.deserializeItemStack(entityData.getBoots()));
if (entityData.getHand() != null && !entityData.getHand().isEmpty()) {
armorStand.setItemInHand(ItemStackUtil.deserializeItemStack(entityData.getHand()));
}
if (entityData.getHelmet() != null && !entityData.getHelmet().isEmpty()) {
armorStand.setHelmet(ItemStackUtil.deserializeItemStack(entityData.getHelmet()));
}
if (entityData.getChestplate() != null && !entityData.getChestplate().isEmpty()) {
armorStand.setChestplate(ItemStackUtil.deserializeItemStack(entityData.getChestplate()));
}
if (entityData.getLeggings() != null && !entityData.getLeggings().isEmpty()) {
armorStand.setLeggings(ItemStackUtil.deserializeItemStack(entityData.getLeggings()));
}
if (entityData.getBoots() != null && !entityData.getBoots().isEmpty()) {
armorStand.setBoots(ItemStackUtil.deserializeItemStack(entityData.getBoots()));
}
armorStand.setBasePlate(entityData.hasBasePlate());
armorStand.setVisible(entityData.isVisible());
armorStand.setSmall(entityData.isSmall());
@ -249,23 +310,50 @@ public final class EntityUtil {
if (entity instanceof LivingEntity) {
LivingEntity livingEntity = (LivingEntity) entity;
EntityEquipment entityEquipment = livingEntity.getEquipment();
if (NMSVersion > 8) {
livingEntity.setAI(entityData.hasAI());
livingEntity.getEquipment().setItemInMainHand(ItemStackUtil.deserializeItemStack(entityData.getHand()));
livingEntity.getEquipment().setItemInOffHand(ItemStackUtil.deserializeItemStack(entityData.getOffHand()));
livingEntity.getEquipment().setHelmet(ItemStackUtil.deserializeItemStack(entityData.getHelmet()));
livingEntity.getEquipment().setChestplate(ItemStackUtil.deserializeItemStack(entityData.getChestplate()));
livingEntity.getEquipment().setLeggings(ItemStackUtil.deserializeItemStack(entityData.getLeggings()));
livingEntity.getEquipment().setBoots(ItemStackUtil.deserializeItemStack(entityData.getBoots()));
livingEntity.getEquipment().setItemInMainHandDropChance(entityData.getHandChance());
livingEntity.getEquipment().setItemInOffHandDropChance(entityData.getOffHandChance());
livingEntity.getEquipment().setHelmetDropChance(entityData.getHelmetChance());
livingEntity.getEquipment().setChestplateDropChance(entityData.getChestplateChance());
livingEntity.getEquipment().setLeggingsDropChance(entityData.getLeggingsChance());
livingEntity.getEquipment().setBootsDropChance(entityData.getBootsChance());
if (entityData.getHand() != null && !entityData.getHand().isEmpty()) {
entityEquipment.setItemInMainHand(ItemStackUtil.deserializeItemStack(entityData.getHand()));
}
if (entityData.getOffHand() != null && !entityData.getOffHand().isEmpty()) {
entityEquipment.setItemInOffHand(ItemStackUtil.deserializeItemStack(entityData.getOffHand()));
}
entityEquipment.setItemInMainHandDropChance(entityData.getHandChance());
entityEquipment.setItemInOffHandDropChance(entityData.getOffHandChance());
} else {
if (entityData.getHand() != null && !entityData.getHand().isEmpty()) {
entityEquipment.setItemInHand(ItemStackUtil.deserializeItemStack(entityData.getHand()));
}
entityEquipment.setItemInHandDropChance(entityData.getHandChance());
}
if (entityData.getHelmet() != null && !entityData.getHelmet().isEmpty()) {
entityEquipment.setHelmet(ItemStackUtil.deserializeItemStack(entityData.getHelmet()));
}
if (entityData.getChestplate() != null && !entityData.getChestplate().isEmpty()) {
entityEquipment.setChestplate(ItemStackUtil.deserializeItemStack(entityData.getChestplate()));
}
if (entityData.getLeggings() != null && !entityData.getLeggings().isEmpty()) {
entityEquipment.setLeggings(ItemStackUtil.deserializeItemStack(entityData.getLeggings()));
}
if (entityData.getBoots() != null && !entityData.getBoots().isEmpty()) {
entityEquipment.setBoots(ItemStackUtil.deserializeItemStack(entityData.getBoots()));
}
entityEquipment.setHelmetDropChance(entityData.getHelmetChance());
entityEquipment.setChestplateDropChance(entityData.getChestplateChance());
entityEquipment.setLeggingsDropChance(entityData.getLeggingsChance());
entityEquipment.setBootsDropChance(entityData.getBootsChance());
if (entity instanceof Bat) {
((Bat) entity).setAwake(entityData.isAwake());
} else if (entity instanceof Creeper) {
@ -320,7 +408,6 @@ public final class EntityUtil {
}
villager.getInventory().setContents(items.toArray(new ItemStack[0]));
villager.setRiches(entityData.getRiches());
}

View File

@ -19,6 +19,8 @@ public class Visit {
private UUID islandOwnerUUID;
private String islandOwnerName;
private Location[] islandLocations;
private int islandSize;
@ -33,6 +35,7 @@ public class Visit {
protected Visit(SkyBlock skyblock, UUID islandOwnerUUID, Location[] islandLocations, int islandSize, int islandMembers, Level islandLevel, List<String> islandSignature, boolean open) {
this.skyblock = skyblock;
this.islandOwnerUUID = islandOwnerUUID;
//this.islandOwnerName = new OfflinePlayer(islandOwnerUUID).getNames()[0].getName();
this.islandLocations = islandLocations;
this.islandSize = islandSize;
this.islandMembers = islandMembers;
@ -49,6 +52,14 @@ public class Visit {
this.islandOwnerUUID = islandOwnerUUID;
}
public String getOwnerName() {
return islandOwnerName;
}
public void setOwnerName(String islandOwnerName) {
this.islandOwnerName = islandOwnerName;
}
public Location getLocation(me.goodandevil.skyblock.island.Location.World world) {
if (world == me.goodandevil.skyblock.island.Location.World.Normal) {
return islandLocations[0];

View File

@ -52,29 +52,44 @@ public class VisitManager {
if (configFile.exists()) {
for (File fileList : configFile.listFiles()) {
Config config = new FileManager.Config(fileManager, fileList);
FileConfiguration configLoad = config.getFileConfiguration();
UUID islandOwnerUUID = UUID.fromString(fileList.getName().replaceFirst("[.][^.]+$", ""));
List<String> islandSignature = new ArrayList<>();
if (configLoad.getString("Visitor.Signature.Message") != null) {
islandSignature = configLoad.getStringList("Visitor.Signature.Message");
if (fileList != null && fileList.getName().contains(".yml") && fileList.getName().length() > 35) {
try {
Config config = new FileManager.Config(fileManager, fileList);
FileConfiguration configLoad = config.getFileConfiguration();
UUID islandOwnerUUID = UUID.fromString(fileList.getName().replace(".yml", ""));
if (islandOwnerUUID == null) {
islandOwnerUUID = UUID.fromString(fileList.getName().replaceFirst("[.][^.]+$", ""));
if (islandOwnerUUID == null) {
continue;
}
}
List<String> islandSignature = new ArrayList<>();
if (configLoad.getString("Visitor.Signature.Message") != null) {
islandSignature = configLoad.getStringList("Visitor.Signature.Message");
}
int division = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getInt("Island.Levelling.Division");
if (division == 0) {
division = 1;
}
int size = 100;
if (configLoad.getString("Size") != null) {
size = configLoad.getInt("Size");
}
createIsland(islandOwnerUUID, new Location[] { fileManager.getLocation(config, "Location.Normal.Island", true), fileManager.getLocation(config, "Location.Nether.Island", true) }, size, configLoad.getStringList("Members").size() + configLoad.getStringList("Operators").size() + 1, new Level(islandOwnerUUID, skyblock), islandSignature, configLoad.getBoolean("Visitor.Open"));
} catch (Exception e) {
e.printStackTrace();
}
}
int division = skyblock.getFileManager().getConfig(new File(skyblock.getDataFolder(), "config.yml")).getFileConfiguration().getInt("Island.Levelling.Division");
if (division == 0) {
division = 1;
}
int size = 100;
if (configLoad.getString("Size") != null) {
size = configLoad.getInt("Size");
}
createIsland(islandOwnerUUID, new Location[] { fileManager.getLocation(config, "Location.Normal.Island", true), fileManager.getLocation(config, "Location.Nether.Island", true) }, size, configLoad.getStringList("Members").size() + configLoad.getStringList("Operators").size() + 1, new Level(islandOwnerUUID, skyblock), islandSignature, configLoad.getBoolean("Visitor.Open"));
}
}
}

View File

@ -1,6 +1,6 @@
name: SkyBlock
main: me.goodandevil.skyblock.SkyBlock
version: 34
version: 35
api-version: 1.13
description: A unique SkyBlock plugin
author: GoodAndEvil