From 79b32bd11b364be2aad5da98b230b5afd22275a6 Mon Sep 17 00:00:00 2001 From: filoghost Date: Sun, 4 Jan 2015 12:21:57 +0100 Subject: [PATCH] Do not count NPCs for Citizens. --- .../task/WorldPlayerCounterTask.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/task/WorldPlayerCounterTask.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/task/WorldPlayerCounterTask.java index 2f6c26ba..6a65bbc3 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/task/WorldPlayerCounterTask.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/task/WorldPlayerCounterTask.java @@ -1,9 +1,11 @@ package com.gmail.filoghost.holographicdisplays.task; +import java.util.List; import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.World; +import org.bukkit.entity.Player; import com.gmail.filoghost.holographicdisplays.util.Utils; @@ -16,7 +18,15 @@ public class WorldPlayerCounterTask implements Runnable { worlds.clear(); for (World world : Bukkit.getWorlds()) { - worlds.put(world.getName(), world.getPlayers().size()); + List players = world.getPlayers(); + int count = 0; + + for (Player player : players) { + if (!player.hasMetadata("NPC")) { + count++; + } + } + worlds.put(world.getName(), count); } }