# Fixed visitors teleporting to the Main spawnpoint rather than the Visitor spawn point when they fall into the void at an island.
# Fixed NPE when performing the command '/island coop' if the player doesn't have permission.
# Fixed player not being removed from island when they leave the team.
This commit is contained in:
Unknown 2018-12-09 02:20:24 +00:00
parent 687abeffd2
commit 08728495fd
8 changed files with 95 additions and 40 deletions

View File

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

View File

@ -89,6 +89,42 @@ public class Island {
configLoad.set("Settings", null); configLoad.set("Settings", null);
} }
if (configLoad.getString("Members") != null) {
List<String> members = configLoad.getStringList("Members");
for (int i = 0; i < members.size(); i++) {
String member = members.get(i);
Config playerDataConfig = new FileManager.Config(fileManager,
new File(skyblock.getDataFolder().toString() + "/player-data", member + ".yml"));
FileConfiguration playerDataConfigLoad = playerDataConfig.getFileConfiguration();
if (playerDataConfigLoad.getString("Island.Owner") == null
|| !playerDataConfigLoad.getString("Island.Owner").equals(uuid.toString())) {
members.remove(member);
}
}
configLoad.set("Members", members);
}
if (configLoad.getString("Operators") != null) {
List<String> operators = configLoad.getStringList("Operators");
for (int i = 0; i < operators.size(); i++) {
String operator = operators.get(i);
Config playerDataConfig = new FileManager.Config(fileManager,
new File(skyblock.getDataFolder().toString() + "/player-data", operator + ".yml"));
FileConfiguration playerDataConfigLoad = playerDataConfig.getFileConfiguration();
if (playerDataConfigLoad.getString("Island.Owner") == null
|| !playerDataConfigLoad.getString("Island.Owner").equals(uuid.toString())) {
operators.remove(operator);
}
}
configLoad.set("Operators", operators);
}
for (Location.World worldList : Location.World.values()) { for (Location.World worldList : Location.World.values()) {
for (Location.Environment environmentList : Location.Environment.values()) { for (Location.Environment environmentList : Location.Environment.values()) {
if (environmentList != Location.Environment.Island) { if (environmentList != Location.Environment.Island) {
@ -480,8 +516,9 @@ public class Island {
public boolean removeRole(IslandRole role, UUID uuid) { public boolean removeRole(IslandRole role, UUID uuid) {
if (!(role == IslandRole.Visitor || role == IslandRole.Coop || role == IslandRole.Owner)) { if (!(role == IslandRole.Visitor || role == IslandRole.Coop || role == IslandRole.Owner)) {
if (hasRole(role, uuid)) { if (hasRole(role, uuid)) {
Config config = skyblock.getFileManager().getConfig(new File( Config config = skyblock.getFileManager()
new File(skyblock.getDataFolder().toString() + "/island-data"), uuid.toString() + ".yml")); .getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"),
getOwnerUUID().toString() + ".yml"));
File configFile = config.getFile(); File configFile = config.getFile();
FileConfiguration configLoad = config.getFileConfiguration(); FileConfiguration configLoad = config.getFileConfiguration();
List<String> islandMembers = configLoad.getStringList(role.name() + "s"); List<String> islandMembers = configLoad.getStringList(role.name() + "s");

View File

@ -436,21 +436,29 @@ public class IslandManager {
UUID islandOwnerUUID = null; UUID islandOwnerUUID = null;
Config config = fileManager.getConfig(
new File(new File(skyblock.getDataFolder().toString() + "/player-data"), uuid.toString() + ".yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (isIslandExist(uuid)) { if (isIslandExist(uuid)) {
if (configLoad.getString("Island.Owner") == null
|| !configLoad.getString("Island.Owner").equals(uuid.toString())) {
fileManager.deleteConfig(
new File(skyblock.getDataFolder().toString() + "/island-data", uuid.toString() + ".yml"));
return;
}
islandOwnerUUID = uuid; islandOwnerUUID = uuid;
} else { } else {
Config config = fileManager.getConfig(
new File(new File(skyblock.getDataFolder().toString() + "/player-data"), uuid.toString() + ".yml"));
FileConfiguration configLoad = config.getFileConfiguration();
if (configLoad.getString("Island.Owner") != null) { if (configLoad.getString("Island.Owner") != null) {
islandOwnerUUID = UUID.fromString(configLoad.getString("Island.Owner")); islandOwnerUUID = UUID.fromString(configLoad.getString("Island.Owner"));
} }
} }
if (islandOwnerUUID != null && !hasIsland(islandOwnerUUID)) { if (islandOwnerUUID != null && !hasIsland(islandOwnerUUID)) {
File configFile = new File(skyblock.getDataFolder().toString() + "/island-data"); config = fileManager.getConfig(new File(skyblock.getDataFolder().toString() + "/island-data",
Config config = fileManager.getConfig(new File(configFile, islandOwnerUUID.toString() + ".yml")); islandOwnerUUID.toString() + ".yml"));
org.bukkit.Location islandNormalLocation = fileManager.getLocation(config, "Location.Normal.Island", true); org.bukkit.Location islandNormalLocation = fileManager.getLocation(config, "Location.Normal.Island", true);

View File

@ -135,8 +135,16 @@ public class Move implements Listener {
if (keepItemsOnDeath) { if (keepItemsOnDeath) {
player.setFallDistance(0.0F); player.setFallDistance(0.0F);
player.teleport(island.getLocation(world, if (island.getVisit().isVisitor(player.getUniqueId())) {
me.goodandevil.skyblock.island.Location.Environment.Main)); player.teleport(island.getLocation(
me.goodandevil.skyblock.island.Location.World.Normal,
me.goodandevil.skyblock.island.Location.Environment.Visitor));
} else {
player.teleport(island.getLocation(
me.goodandevil.skyblock.island.Location.World.Normal,
me.goodandevil.skyblock.island.Location.Environment.Main));
}
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F,
1.0F); 1.0F);
} }
@ -168,8 +176,16 @@ public class Move implements Listener {
player.setFallDistance(0.0F); player.setFallDistance(0.0F);
player.teleport(island.getLocation(world, if (island.getVisit().isVisitor(player.getUniqueId())) {
me.goodandevil.skyblock.island.Location.Environment.Main)); player.teleport(island.getLocation(
me.goodandevil.skyblock.island.Location.World.Normal,
me.goodandevil.skyblock.island.Location.Environment.Visitor));
} else {
player.teleport(island.getLocation(
me.goodandevil.skyblock.island.Location.World.Normal,
me.goodandevil.skyblock.island.Location.Environment.Main));
}
soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F, soundManager.playSound(player, Sounds.ENDERMAN_TELEPORT.bukkitSound(), 1.0F,
1.0F); 1.0F);
} }

View File

@ -61,7 +61,6 @@ public final class WorldBorder {
Method transitionSizeBetween = worldBorder.getClass().getMethod("transitionSizeBetween", double.class, Method transitionSizeBetween = worldBorder.getClass().getMethod("transitionSizeBetween", double.class,
double.class, long.class); double.class, long.class);
transitionSizeBetween.invoke(worldBorder, size, size - 1.0D, 20000000L);
if (color == Color.Green) { if (color == Color.Green) {
transitionSizeBetween.invoke(worldBorder, size - 0.2D, size - 0.1D + 0.1D, 20000000L); transitionSizeBetween.invoke(worldBorder, size - 0.2D, size - 0.1D + 0.1D, 20000000L);

View File

@ -35,23 +35,23 @@ public final class EntityUtil {
ArmorStand armorStand = (ArmorStand) entity; ArmorStand armorStand = (ArmorStand) entity;
entityData.setArms(armorStand.hasArms()); entityData.setArms(armorStand.hasArms());
if (armorStand.getItemInHand() != null) { if (armorStand.getItemInHand() != null && armorStand.getItemInHand().getType() != Material.AIR) {
entityData.setHand(ItemStackUtil.serializeItemStack(armorStand.getItemInHand())); entityData.setHand(ItemStackUtil.serializeItemStack(armorStand.getItemInHand()));
} }
if (armorStand.getHelmet() != null) { if (armorStand.getHelmet() != null && armorStand.getHelmet().getType() != Material.AIR) {
entityData.setHelmet(ItemStackUtil.serializeItemStack(armorStand.getHelmet())); entityData.setHelmet(ItemStackUtil.serializeItemStack(armorStand.getHelmet()));
} }
if (armorStand.getChestplate() != null) { if (armorStand.getChestplate() != null && armorStand.getChestplate().getType() != Material.AIR) {
entityData.setChestplate(ItemStackUtil.serializeItemStack(armorStand.getChestplate())); entityData.setChestplate(ItemStackUtil.serializeItemStack(armorStand.getChestplate()));
} }
if (armorStand.getLeggings() != null) { if (armorStand.getLeggings() != null && armorStand.getLeggings().getType() != Material.AIR) {
entityData.setLeggings(ItemStackUtil.serializeItemStack(armorStand.getLeggings())); entityData.setLeggings(ItemStackUtil.serializeItemStack(armorStand.getLeggings()));
} }
if (armorStand.getBoots() != null) { if (armorStand.getBoots() != null && armorStand.getBoots().getType() != Material.AIR) {
entityData.setBoots(ItemStackUtil.serializeItemStack(armorStand.getBoots())); entityData.setBoots(ItemStackUtil.serializeItemStack(armorStand.getBoots()));
} }
@ -84,38 +84,41 @@ public final class EntityUtil {
if (NMSVersion > 8) { if (NMSVersion > 8) {
entityData.setAI(livingEntity.hasAI()); entityData.setAI(livingEntity.hasAI());
if (entityEquipment.getItemInMainHand() != null) { if (entityEquipment.getItemInMainHand() != null
&& entityEquipment.getItemInMainHand().getType() != Material.AIR) {
entityData.setHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInMainHand())); entityData.setHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInMainHand()));
} }
entityData.setHandChance(entityEquipment.getItemInMainHandDropChance()); entityData.setHandChance(entityEquipment.getItemInMainHandDropChance());
if (entityEquipment.getItemInOffHand() != null) { if (entityEquipment.getItemInOffHand() != null
&& entityEquipment.getItemInOffHand().getType() != Material.AIR) {
entityData.setOffHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInOffHand())); entityData.setOffHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInOffHand()));
} }
entityData.setOffHandChange(entityEquipment.getItemInOffHandDropChance()); entityData.setOffHandChange(entityEquipment.getItemInOffHandDropChance());
} else { } else {
if (entityEquipment.getItemInHand() != null) { if (entityEquipment.getItemInHand() != null
&& entityEquipment.getItemInHand().getType() != Material.AIR) {
entityData.setHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInHand())); entityData.setHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInHand()));
} }
entityData.setHandChance(entityEquipment.getItemInHandDropChance()); entityData.setHandChance(entityEquipment.getItemInHandDropChance());
} }
if (entityEquipment.getHelmet() != null) { if (entityEquipment.getHelmet() != null && entityEquipment.getHelmet().getType() != Material.AIR) {
entityData.setHelmet(ItemStackUtil.serializeItemStack(entityEquipment.getHelmet())); entityData.setHelmet(ItemStackUtil.serializeItemStack(entityEquipment.getHelmet()));
} }
if (entityEquipment.getChestplate() != null) { if (entityEquipment.getChestplate() != null && entityEquipment.getChestplate().getType() != Material.AIR) {
entityData.setChestplate(ItemStackUtil.serializeItemStack(entityEquipment.getChestplate())); entityData.setChestplate(ItemStackUtil.serializeItemStack(entityEquipment.getChestplate()));
} }
if (entityEquipment.getLeggings() != null) { if (entityEquipment.getLeggings() != null && entityEquipment.getLeggings().getType() != Material.AIR) {
entityData.setLeggings(ItemStackUtil.serializeItemStack(entityEquipment.getLeggings())); entityData.setLeggings(ItemStackUtil.serializeItemStack(entityEquipment.getLeggings()));
} }
if (entityEquipment.getBoots() != null) { if (entityEquipment.getBoots() != null && entityEquipment.getBoots().getType() != Material.AIR) {
entityData.setBoots(ItemStackUtil.serializeItemStack(entityEquipment.getBoots())); entityData.setBoots(ItemStackUtil.serializeItemStack(entityEquipment.getBoots()));
} }
@ -144,9 +147,7 @@ public final class EntityUtil {
List<String> items = new ArrayList<>(); List<String> items = new ArrayList<>();
for (ItemStack itemList : horse.getInventory().getContents()) { for (ItemStack itemList : horse.getInventory().getContents()) {
if (itemList == null) { if (itemList != null && itemList.getType() != Material.AIR) {
items.add(ItemStackUtil.serializeItemStack(new ItemStack(Material.AIR)));
} else {
items.add(ItemStackUtil.serializeItemStack(itemList)); items.add(ItemStackUtil.serializeItemStack(itemList));
} }
} }
@ -181,9 +182,7 @@ public final class EntityUtil {
List<String> items = new ArrayList<>(); List<String> items = new ArrayList<>();
for (ItemStack itemList : villager.getInventory().getContents()) { for (ItemStack itemList : villager.getInventory().getContents()) {
if (itemList == null) { if (itemList != null && itemList.getType() != Material.AIR) {
items.add(ItemStackUtil.serializeItemStack(new ItemStack(Material.AIR)));
} else {
items.add(ItemStackUtil.serializeItemStack(itemList)); items.add(ItemStackUtil.serializeItemStack(itemList));
} }
} }
@ -200,9 +199,7 @@ public final class EntityUtil {
List<String> items = new ArrayList<>(); List<String> items = new ArrayList<>();
for (ItemStack itemList : llama.getInventory().getContents()) { for (ItemStack itemList : llama.getInventory().getContents()) {
if (itemList == null) { if (itemList != null && itemList.getType() != Material.AIR) {
items.add(ItemStackUtil.serializeItemStack(new ItemStack(Material.AIR)));
} else {
items.add(ItemStackUtil.serializeItemStack(itemList)); items.add(ItemStackUtil.serializeItemStack(itemList));
} }
} }
@ -229,9 +226,7 @@ public final class EntityUtil {
List<String> items = new ArrayList<>(); List<String> items = new ArrayList<>();
for (ItemStack itemList : ((InventoryHolder) entity).getInventory().getContents()) { for (ItemStack itemList : ((InventoryHolder) entity).getInventory().getContents()) {
if (itemList == null) { if (itemList != null && itemList.getType() != Material.AIR) {
items.add(ItemStackUtil.serializeItemStack(new ItemStack(Material.AIR)));
} else {
items.add(ItemStackUtil.serializeItemStack(itemList)); items.add(ItemStackUtil.serializeItemStack(itemList));
} }
} }

View File

@ -439,7 +439,7 @@ Command:
Coop: Coop:
Info: Info:
Message: "&f&oOpen the Island Coop menu or add/remove coop players." Message: "&f&oOpen the Island Coop menu or add/remove coop players."
Permisison: Permission:
Message: "&bSkyBlock &8| &cError&8: &eYou do not have the right to do that." Message: "&bSkyBlock &8| &cError&8: &eYou do not have the right to do that."
Invalid: Invalid:
Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island coop [<player>]" Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island coop [<player>]"

View File

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