Skip to content

Commit d126b79

Browse files
Jitse BoonstraJitse Boonstra
authored andcommitted
Added method NPCManager#getShownToPlayer
1 parent 03af1d0 commit d126b79

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

api/src/main/java/net/jitse/npclib/internal/NPCManager.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
package net.jitse.npclib.internal;
66

7+
import org.bukkit.entity.Player;
8+
9+
import java.util.Collections;
710
import java.util.HashSet;
811
import java.util.Set;
912

@@ -18,6 +21,16 @@ public static Set<NPCBase> getAllNPCs() {
1821
return npcs;
1922
}
2023

24+
public static Set<NPCBase> getShownToPlayer(Player player) {
25+
Set<NPCBase> set = Collections.emptySet();
26+
for (NPCBase npc : getAllNPCs()) {
27+
if (npc.getShown().contains(player.getUniqueId())) {
28+
set.add(npc);
29+
}
30+
}
31+
return set;
32+
}
33+
2134
public static void add(NPCBase npc) {
2235
npcs.add(npc);
2336
}

0 commit comments

Comments
 (0)