Added method NPCManager#getShownToPlayer

This commit is contained in:
Jitse Boonstra 2020-08-08 19:22:51 +02:00
parent 03af1d08aa
commit d126b79742
1 changed files with 13 additions and 0 deletions

View File

@ -4,6 +4,9 @@
package net.jitse.npclib.internal;
import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@ -18,6 +21,16 @@ public final class NPCManager {
return npcs;
}
public static Set<NPCBase> getShownToPlayer(Player player) {
Set<NPCBase> set = Collections.emptySet();
for (NPCBase npc : getAllNPCs()) {
if (npc.getShown().contains(player.getUniqueId())) {
set.add(npc);
}
}
return set;
}
public static void add(NPCBase npc) {
npcs.add(npc);
}