# 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>
<artifactId>SkyBlock</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>40</version>
<version>41</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>

View File

@ -89,6 +89,42 @@ public class Island {
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.Environment environmentList : Location.Environment.values()) {
if (environmentList != Location.Environment.Island) {
@ -480,8 +516,9 @@ public class Island {
public boolean removeRole(IslandRole role, UUID uuid) {
if (!(role == IslandRole.Visitor || role == IslandRole.Coop || role == IslandRole.Owner)) {
if (hasRole(role, uuid)) {
Config config = skyblock.getFileManager().getConfig(new File(
new File(skyblock.getDataFolder().toString() + "/island-data"), uuid.toString() + ".yml"));
Config config = skyblock.getFileManager()
.getConfig(new File(new File(skyblock.getDataFolder().toString() + "/island-data"),
getOwnerUUID().toString() + ".yml"));
File configFile = config.getFile();
FileConfiguration configLoad = config.getFileConfiguration();
List<String> islandMembers = configLoad.getStringList(role.name() + "s");

View File

@ -436,21 +436,29 @@ public class IslandManager {
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 (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;
} 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) {
islandOwnerUUID = UUID.fromString(configLoad.getString("Island.Owner"));
}
}
if (islandOwnerUUID != null && !hasIsland(islandOwnerUUID)) {
File configFile = new File(skyblock.getDataFolder().toString() + "/island-data");
Config config = fileManager.getConfig(new File(configFile, islandOwnerUUID.toString() + ".yml"));
config = fileManager.getConfig(new File(skyblock.getDataFolder().toString() + "/island-data",
islandOwnerUUID.toString() + ".yml"));
org.bukkit.Location islandNormalLocation = fileManager.getLocation(config, "Location.Normal.Island", true);

View File

@ -135,8 +135,16 @@ public class Move implements Listener {
if (keepItemsOnDeath) {
player.setFallDistance(0.0F);
player.teleport(island.getLocation(world,
me.goodandevil.skyblock.island.Location.Environment.Main));
if (island.getVisit().isVisitor(player.getUniqueId())) {
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,
1.0F);
}
@ -168,8 +176,16 @@ public class Move implements Listener {
player.setFallDistance(0.0F);
player.teleport(island.getLocation(world,
me.goodandevil.skyblock.island.Location.Environment.Main));
if (island.getVisit().isVisitor(player.getUniqueId())) {
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,
1.0F);
}

View File

@ -61,7 +61,6 @@ public final class WorldBorder {
Method transitionSizeBetween = worldBorder.getClass().getMethod("transitionSizeBetween", double.class,
double.class, long.class);
transitionSizeBetween.invoke(worldBorder, size, size - 1.0D, 20000000L);
if (color == Color.Green) {
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;
entityData.setArms(armorStand.hasArms());
if (armorStand.getItemInHand() != null) {
if (armorStand.getItemInHand() != null && armorStand.getItemInHand().getType() != Material.AIR) {
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()));
}
if (armorStand.getChestplate() != null) {
if (armorStand.getChestplate() != null && armorStand.getChestplate().getType() != Material.AIR) {
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()));
}
if (armorStand.getBoots() != null) {
if (armorStand.getBoots() != null && armorStand.getBoots().getType() != Material.AIR) {
entityData.setBoots(ItemStackUtil.serializeItemStack(armorStand.getBoots()));
}
@ -84,38 +84,41 @@ public final class EntityUtil {
if (NMSVersion > 8) {
entityData.setAI(livingEntity.hasAI());
if (entityEquipment.getItemInMainHand() != null) {
if (entityEquipment.getItemInMainHand() != null
&& entityEquipment.getItemInMainHand().getType() != Material.AIR) {
entityData.setHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInMainHand()));
}
entityData.setHandChance(entityEquipment.getItemInMainHandDropChance());
if (entityEquipment.getItemInOffHand() != null) {
if (entityEquipment.getItemInOffHand() != null
&& entityEquipment.getItemInOffHand().getType() != Material.AIR) {
entityData.setOffHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInOffHand()));
}
entityData.setOffHandChange(entityEquipment.getItemInOffHandDropChance());
} else {
if (entityEquipment.getItemInHand() != null) {
if (entityEquipment.getItemInHand() != null
&& entityEquipment.getItemInHand().getType() != Material.AIR) {
entityData.setHand(ItemStackUtil.serializeItemStack(entityEquipment.getItemInHand()));
}
entityData.setHandChance(entityEquipment.getItemInHandDropChance());
}
if (entityEquipment.getHelmet() != null) {
if (entityEquipment.getHelmet() != null && entityEquipment.getHelmet().getType() != Material.AIR) {
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()));
}
if (entityEquipment.getLeggings() != null) {
if (entityEquipment.getLeggings() != null && entityEquipment.getLeggings().getType() != Material.AIR) {
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()));
}
@ -144,9 +147,7 @@ public final class EntityUtil {
List<String> items = new ArrayList<>();
for (ItemStack itemList : horse.getInventory().getContents()) {
if (itemList == null) {
items.add(ItemStackUtil.serializeItemStack(new ItemStack(Material.AIR)));
} else {
if (itemList != null && itemList.getType() != Material.AIR) {
items.add(ItemStackUtil.serializeItemStack(itemList));
}
}
@ -181,9 +182,7 @@ public final class EntityUtil {
List<String> items = new ArrayList<>();
for (ItemStack itemList : villager.getInventory().getContents()) {
if (itemList == null) {
items.add(ItemStackUtil.serializeItemStack(new ItemStack(Material.AIR)));
} else {
if (itemList != null && itemList.getType() != Material.AIR) {
items.add(ItemStackUtil.serializeItemStack(itemList));
}
}
@ -200,9 +199,7 @@ public final class EntityUtil {
List<String> items = new ArrayList<>();
for (ItemStack itemList : llama.getInventory().getContents()) {
if (itemList == null) {
items.add(ItemStackUtil.serializeItemStack(new ItemStack(Material.AIR)));
} else {
if (itemList != null && itemList.getType() != Material.AIR) {
items.add(ItemStackUtil.serializeItemStack(itemList));
}
}
@ -229,9 +226,7 @@ public final class EntityUtil {
List<String> items = new ArrayList<>();
for (ItemStack itemList : ((InventoryHolder) entity).getInventory().getContents()) {
if (itemList == null) {
items.add(ItemStackUtil.serializeItemStack(new ItemStack(Material.AIR)));
} else {
if (itemList != null && itemList.getType() != Material.AIR) {
items.add(ItemStackUtil.serializeItemStack(itemList));
}
}

View File

@ -439,7 +439,7 @@ Command:
Coop:
Info:
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."
Invalid:
Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island coop [<player>]"

View File

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