Minor Fixes

# Fixed possible NPE when a player disconnects from the server preventing objects being removed. This is a problem with certain Java versions.
# Fixed 'Island Visit' menu not updating when the inventory viewer adds or removes a vote if voting is enabled.
# Fixed Island level not showing in the 'Island Visit' menu.
This commit is contained in:
Unknown 2018-11-23 21:57:02 +00:00
parent 2216ff36d1
commit 03adddeefd
3 changed files with 15 additions and 6 deletions

View File

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

View File

@ -40,7 +40,10 @@ public class Quit implements Listener {
IslandManager islandManager = plugin.getIslandManager();
PlayerData playerData = playerDataManager.getPlayerData(player);
playerData.setLastOnline(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new Date()));
try {
playerData.setLastOnline(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new Date()));
} catch (Exception e) {}
if (islandManager.hasIsland(player)) {
Island island = islandManager.getIsland(playerData.getOwner());

View File

@ -220,7 +220,7 @@ public class Visit implements Listener {
}
}
inv.addItem(inv.createItem(SkullUtil.create(targetPlayerTexture[0], targetPlayerTexture[1]), configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player", targetPlayerName), itemLore, inv.createItemLoreVariable(new String[] { "%level#" + visit.getLevel(), "%members#" + visit.getMembers(), "%votes#" + visit.getVoters().size(), "%visits#" + visit.getVisitors().size(), "%players#" + playersAtIsland, "%player_capacity#" + playerCapacity, "%action#" + voteAction }), null, null), inventorySlot);
inv.addItem(inv.createItem(SkullUtil.create(targetPlayerTexture[0], targetPlayerTexture[1]), configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player", targetPlayerName), itemLore, inv.createItemLoreVariable(new String[] { "%level#" + visit.getLevel().getLevel(), "%members#" + visit.getMembers(), "%votes#" + visit.getVoters().size(), "%visits#" + visit.getVisitors().size(), "%players#" + playersAtIsland, "%player_capacity#" + playerCapacity, "%action#" + voteAction }), null, null), inventorySlot);
} else {
if (signatureEnabled) {
for (String itemLoreList : configLoad.getStringList("Menu.Visit.Item.Island.Vote.Disabled.Signature.Enabled.Lore")) {
@ -242,7 +242,7 @@ public class Visit implements Listener {
itemLore.addAll(configLoad.getStringList("Menu.Visit.Item.Island.Vote.Disabled.Signature.Disabled.Lore"));
}
inv.addItem(inv.createItem(SkullUtil.create(targetPlayerTexture[0], targetPlayerTexture[1]), configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player", targetPlayerName), itemLore, inv.createItemLoreVariable(new String[] { "%level#" + visit.getLevel(), "%members#" + visit.getMembers(), "%visits#" + visit.getVisitors().size(), "%players#" + playersAtIsland, "%player_capacity#" + playerCapacity }), null, null), inventorySlot);
inv.addItem(inv.createItem(SkullUtil.create(targetPlayerTexture[0], targetPlayerTexture[1]), configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player", targetPlayerName), itemLore, inv.createItemLoreVariable(new String[] { "%level#" + visit.getLevel().getLevel(), "%members#" + visit.getMembers(), "%visits#" + visit.getVisitors().size(), "%players#" + playersAtIsland, "%player_capacity#" + playerCapacity }), null, null), inventorySlot);
}
}
}
@ -340,9 +340,12 @@ public class Visit implements Listener {
for (Location.World worldList : Location.World.values()) {
if (LocationUtil.isLocationAtLocationRadius(player.getLocation(), island.getLocation(worldList, Location.Environment.Island), island.getRadius())) {
visit.removeVoter(player.getUniqueId());
player.sendMessage(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Island.Visit.Vote.Removed.Message").replace("%player", targetPlayerName)));
player.sendMessage(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Island.Visit.Vote.Removed.Message").replace("%player", targetPlayerName)));
soundManager.playSound(player, Sounds.EXPLODE.bukkitSound(), 1.0F, 1.0F);
open(player, (Visit.Type) playerData.getType(), (Visit.Sort) playerData.getSort());
return;
}
}
@ -353,9 +356,12 @@ public class Visit implements Listener {
for (Location.World worldList : Location.World.values()) {
if (LocationUtil.isLocationAtLocationRadius(player.getLocation(), island.getLocation(worldList, Location.Environment.Island), island.getRadius())) {
visit.addVoter(player.getUniqueId());
player.sendMessage(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Island.Visit.Vote.Added.Message").replace("%player", targetPlayerName)));
player.sendMessage(ChatColor.translateAlternateColorCodes('&', configLoad.getString("Island.Visit.Vote.Added.Message").replace("%player", targetPlayerName)));
soundManager.playSound(player, Sounds.LEVEL_UP.bukkitSound(), 1.0F, 1.0F);
open(player, (Visit.Type) playerData.getType(), (Visit.Sort) playerData.getSort());
return;
}
}