Class NPCs


  • public class NPCs
    extends Interactables<NPC>
    A class containing methods which are used to retrieve local NPC from the game.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @NonNull java.util.List<@NonNull NPC> all()
      static @NonNull java.util.List<@NonNull NPC> all​(@NonNull java.lang.Integer... ids)  
      static @NonNull java.util.List<@NonNull NPC> all​(@NonNull java.lang.String... names)  
      static @NonNull java.util.List<@NonNull NPC> all​(@NonNull Filter<NPC> filter)  
      static @Nullable NPC closest​(@NonNull java.lang.Integer... ids)  
      static @Nullable NPC closest​(@NonNull java.lang.String... names)  
      static @Nullable NPC closest​(@NonNull Filter<NPC> filter)  
      static @Nullable NPC closest​(@NonNull Filter<NPC> filter, @NonNull Tile toTile, boolean walkingDistance)  
      static @Nullable NPC closest​(@NonNull Filter<NPC> filter, Tile toTile)  
      static @Nullable NPC @NonNull [] getArray()  
      static @Nullable NPC getAtIndex​(int index)
      Gets local NPC at index specified
      static @NonNull java.util.List<@NonNull NPC> getInteractingWith​(int playerIndex)
      Gets a list of NPC's that are interacting with a given player index.
      static boolean isIgnoreHealth()  
      static boolean isIncludeNullNames()  
      static void setIgnoreHealth​(boolean ignoreHealth)
      Setting this to true will allow for NPCs with 0 health to show up in closest(Filter) and all(Filter) calls.
      static void setIncludeNullNames​(boolean includeNullNames)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setIgnoreHealth

        public static void setIgnoreHealth​(boolean ignoreHealth)
        Setting this to true will allow for NPCs with 0 health to show up in closest(Filter) and all(Filter) calls.

        This is sometimes needed for special NPCs that appear to have 0 health but are still interactable.

        Parameters:
        ignoreHealth - true if you want NPCs with 0 health to not be filtered out
      • all

        public static @NonNull java.util.List<@NonNull NPC> all()
      • all

        public static @NonNull java.util.List<@NonNull NPC> all​(@NonNull java.lang.Integer... ids)
      • all

        public static @NonNull java.util.List<@NonNull NPC> all​(@NonNull java.lang.String... names)
      • all

        public static @NonNull java.util.List<@NonNull NPC> all​(@NonNull Filter<NPC> filter)
      • closest

        public static @Nullable NPC closest​(@NonNull java.lang.String... names)
      • closest

        public static @Nullable NPC closest​(@NonNull java.lang.Integer... ids)
      • closest

        public static @Nullable NPC closest​(@NonNull Filter<NPC> filter)
      • closest

        public static @Nullable NPC closest​(@NonNull Filter<NPC> filter,
                                            Tile toTile)
      • closest

        public static @Nullable NPC closest​(@NonNull Filter<NPC> filter,
                                            @NonNull Tile toTile,
                                            boolean walkingDistance)
      • getAtIndex

        public static @Nullable NPC getAtIndex​(int index)
        Gets local NPC at index specified
        Parameters:
        index - index of NPC
        Returns:
        NPC at specified index
      • getArray

        public static @Nullable NPC @NonNull [] getArray()
      • getInteractingWith

        public static @NonNull java.util.List<@NonNull NPC> getInteractingWith​(int playerIndex)
        Gets a list of NPC's that are interacting with a given player index. Automatically adjusts index for interaction index validation.
        Parameters:
        playerIndex - a given Player's Player.getIndex()
        Returns:
        List of NPC that are interacting with the given index. Empty if no npcs are interacting with that index.
      • isIgnoreHealth

        public static boolean isIgnoreHealth()
      • isIncludeNullNames

        public static boolean isIncludeNullNames()
      • setIncludeNullNames

        public static void setIncludeNullNames​(boolean includeNullNames)