mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-07 03:00:29 +01:00
Hide vanished player from Visitors menù
This commit is contained in:
parent
1927f5c633
commit
dd1b354af2
@ -159,24 +159,28 @@ public class Visitors {
|
||||
Set<UUID> islandVisitors = islandManager.getVisitorsAtIsland(island);
|
||||
Map<Integer, UUID> sortedIslandVisitors = new TreeMap<>();
|
||||
|
||||
for (UUID islandVisitorList : islandVisitors) {
|
||||
Player targetPlayer = Bukkit.getPlayer(islandVisitorList);
|
||||
if(targetPlayer != null && player.canSee(targetPlayer)){ // Remove vanished players
|
||||
sortedIslandVisitors.put(
|
||||
playerDataManager.getPlayerData(Bukkit.getServer().getPlayer(islandVisitorList)).getVisitTime(),
|
||||
islandVisitorList);
|
||||
}
|
||||
}
|
||||
|
||||
nInv.addItem(nInv.createItem(CompatibleMaterial.OAK_FENCE_GATE.getItem(),
|
||||
configLoad.getString("Menu.Visitors.Item.Exit.Displayname"), null, null, null, null), 0, 8);
|
||||
nInv.addItem(
|
||||
nInv.createItem(new ItemStack(Material.PAINTING),
|
||||
configLoad.getString("Menu.Visitors.Item.Statistics.Displayname"),
|
||||
configLoad.getStringList("Menu.Visitors.Item.Statistics.Lore"),
|
||||
new Placeholder[]{new Placeholder("%visitors", "" + islandVisitors.size())}, null, null),
|
||||
new Placeholder[]{new Placeholder("%visitors", "" + sortedIslandVisitors.size())}, null, null),
|
||||
4);
|
||||
nInv.addItem(
|
||||
nInv.createItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem(),
|
||||
configLoad.getString("Menu.Visitors.Item.Barrier.Displayname"), null, null, null, null),
|
||||
9, 10, 11, 12, 13, 14, 15, 16, 17);
|
||||
|
||||
for (UUID islandVisitorList : islandVisitors) {
|
||||
sortedIslandVisitors.put(
|
||||
playerDataManager.getPlayerData(Bukkit.getServer().getPlayer(islandVisitorList)).getVisitTime(),
|
||||
islandVisitorList);
|
||||
}
|
||||
|
||||
islandVisitors.clear();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user