Class SentinelTargetList

java.lang.Object
org.mcmonkey.sentinel.targeting.SentinelTargetList

public class SentinelTargetList extends Object
  • Field Details

    • targetsProcessed

      public HashSet<SentinelTarget> targetsProcessed
      Cache of target objects.
    • otherTargetCache

      Cache of "other" targets.
    • tempTargeted

      public ArrayList<org.bukkit.entity.LivingEntity> tempTargeted
      Helper list, general ignorable.
    • targets

      public ArrayList<String> targets
      List of target-type-based targets.
    • byPlayerName

      public ArrayList<String> byPlayerName
      List of player-name-based targets.
    • byNpcName

      public ArrayList<String> byNpcName
      List of NPC-name-based targets.
    • byEntityName

      public ArrayList<String> byEntityName
      List of entity-name-based targets.
    • byHeldItem

      public ArrayList<String> byHeldItem
      List of held-item-based targets.
    • byOffhandItem

      public ArrayList<String> byOffhandItem
      List of offhand-item-based targets.
    • byEquippedItem

      public ArrayList<String> byEquippedItem
      List of equipped-item-based targets.
    • byInventoryItem

      public ArrayList<String> byInventoryItem
      List of inventory-item-based targets.
    • byGroup

      public ArrayList<String> byGroup
      List of scoreboard-group-based targets.
    • byEvent

      public ArrayList<String> byEvent
      List of event-based targets.
    • byStatus

      public ArrayList<String> byStatus
      List of targets handled by special status.
    • byOther

      public ArrayList<String> byOther
      List of targets not handled by any other target type list.
    • byAllInOne

      public ArrayList<SentinelTargetList> byAllInOne
      List of target lists that need to be matched in full on exactly one entity to qualify as a match.
    • byMultiple

      public ArrayList<SentinelTargetList> byMultiple
      List of target lists that need to be matched in full to qualify as a match.
  • Constructor Details

    • SentinelTargetList

      public SentinelTargetList()
  • Method Details

    • duplicate

      public SentinelTargetList duplicate()
      Returns a duplicate of the target list, with all inner arrays duplicated.
    • init

      public void init()
      Initialize the targets list after loading it.
    • isTarget

      public boolean isTarget(org.bukkit.entity.LivingEntity entity, SentinelTrait sentinel)
      Returns whether an entity is targeted by this target list on a specific Sentinel NPC. Does not include target-list-specific handling, such as current temporary targets.
    • isTarget

      public boolean isTarget(org.bukkit.entity.LivingEntity entity)
      Returns whether an entity is targeted by this target list. Does not account for NPC-specific target handlers, like 'owner' (which requires knowledge of who that owner is, based on which NPC is checking). To include that, use isTarget(LivingEntity, SentinelTrait)
    • isTargetNoCache

      public boolean isTargetNoCache(org.bukkit.entity.LivingEntity entity)
      Returns whether an entity is targeted by this target list. Does not account for NPC-specific target handlers, like 'owner' (which requires knowledge of who that owner is, based on which NPC is checking). To include that, use isTarget(LivingEntity, SentinelTrait) Explicitly does not reprocess the cache.
    • ifIsTargetDeleteTarget

      public boolean ifIsTargetDeleteTarget(org.bukkit.entity.LivingEntity entity)
      This is a special target method, that will remove the target from the targets list if it's matched. Primarily for the multi-targets system.
    • fillListFromKey

      public void fillListFromKey(ArrayList<String> list, net.citizensnpcs.api.util.DataKey key)
      Fills the target list from a Citizens data key, during load time.
    • updateOld

      public void updateOld(net.citizensnpcs.api.util.DataKey key, String name)
      Updates old (Sentinel 1.6 or lower) saves to new (Sentinel 1.7 or higher) saves.
    • isEventTarget

      public boolean isEventTarget(SentinelTrait sentinel, org.bukkit.event.player.AsyncPlayerChatEvent event)
      Returns whether a chat event is targeted by this list.
    • isReverseEventTarget

      public boolean isReverseEventTarget(SentinelTrait sentinel, org.bukkit.event.entity.EntityDamageByEntityEvent event)
      Returns whether the victim in a damage event is targeted by this list.
    • isEventTarget

      public boolean isEventTarget(org.bukkit.event.entity.EntityDamageByEntityEvent event, SentinelTrait sentinel)
      Returns whether the damager in a damage event is targeted by this list.
    • checkRecalculateTargetsCache

      public void checkRecalculateTargetsCache()
      Checks if the targets cache ('targetsProcessed') needs to be reprocessed, and refills it if so.
    • recalculateCacheNoClear

      public void recalculateCacheNoClear()
      Fills the cache 'targetsProcessed' set and does not deduplicate the source list. Also fills the 'otherTargetCache'.
    • recalculateTargetsCache

      public void recalculateTargetsCache()
      Fills the cache 'targetsProcessed' set then uses that set to deduplicate the source 'targets' set. Also fills the 'otherTargetCache'.
    • totalTargetsCount

      public int totalTargetsCount()
      Returns the total count of targets (other than multi-targets).
    • toComboString

      public String toComboString()
      Forms a \0x01-separated list for all-in-one-target output.
    • getTargetRemovableStrings

      public List<String> getTargetRemovableStrings()
      Gets a list of target strings, fit for input to a remove command.
    • toMultiTargetString

      public String toMultiTargetString()
      Forms a comma-separated list for multi-target output.
    • toAllInOneString

      public String toAllInOneString()
      Forms a pipe-separated list for all-in-one-target output.