Package org.mcmonkey.sentinel.targeting
Class SentinelTargetList
java.lang.Object
org.mcmonkey.sentinel.targeting.SentinelTargetList
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents an "other target" for use with caching. -
Field Summary
Modifier and TypeFieldDescriptionList of target lists that need to be matched in full on exactly one entity to qualify as a match.List of entity-name-based targets.List of equipped-item-based targets.List of event-based targets.List of scoreboard-group-based targets.List of held-item-based targets.List of inventory-item-based targets.List of target lists that need to be matched in full to qualify as a match.List of NPC-name-based targets.List of offhand-item-based targets.List of targets not handled by any other target type list.List of player-name-based targets.List of targets handled by special status.Cache of "other" targets.List of target-type-based targets.Cache of target objects.ArrayList
<org.bukkit.entity.LivingEntity> Helper list, general ignorable. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks if the targets cache ('targetsProcessed') needs to be reprocessed, and refills it if so.Returns a duplicate of the target list, with all inner arrays duplicated.void
fillListFromKey
(ArrayList<String> list, net.citizensnpcs.api.util.DataKey key) Fills the target list from a Citizens data key, during load time.Gets a list of target strings, fit for input to a remove command.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.void
init()
Initialize the targets list after loading it.boolean
isEventTarget
(org.bukkit.event.entity.EntityDamageByEntityEvent event, SentinelTrait sentinel) Returns whether the damager in a damage event is targeted by this list.boolean
isEventTarget
(SentinelTrait sentinel, org.bukkit.event.player.AsyncPlayerChatEvent event) Returns whether a chat event is targeted by this list.boolean
isReverseEventTarget
(SentinelTrait sentinel, org.bukkit.event.entity.EntityDamageByEntityEvent event) Returns whether the victim in a damage event is targeted by this list.boolean
isTarget
(org.bukkit.entity.LivingEntity entity) Returns whether an entity is targeted by this target list.boolean
isTarget
(org.bukkit.entity.LivingEntity entity, SentinelTrait sentinel) Returns whether an entity is targeted by this target list on a specific Sentinel NPC.boolean
isTargetNoCache
(org.bukkit.entity.LivingEntity entity) Returns whether an entity is targeted by this target list.void
Fills the cache 'targetsProcessed' set and does not deduplicate the source list.void
Fills the cache 'targetsProcessed' set then uses that set to deduplicate the source 'targets' set.Forms a pipe-separated list for all-in-one-target output.Forms a \0x01-separated list for all-in-one-target output.Forms a comma-separated list for multi-target output.int
Returns the total count of targets (other than multi-targets).void
Updates old (Sentinel 1.6 or lower) saves to new (Sentinel 1.7 or higher) saves.
-
Field Details
-
targetsProcessed
Cache of target objects. -
otherTargetCache
Cache of "other" targets. -
tempTargeted
Helper list, general ignorable. -
targets
List of target-type-based targets. -
byPlayerName
List of player-name-based targets. -
byNpcName
List of NPC-name-based targets. -
byEntityName
List of entity-name-based targets. -
byHeldItem
List of held-item-based targets. -
byOffhandItem
List of offhand-item-based targets. -
byEquippedItem
List of equipped-item-based targets. -
byInventoryItem
List of inventory-item-based targets. -
byGroup
List of scoreboard-group-based targets. -
byEvent
List of event-based targets. -
byStatus
List of targets handled by special status. -
byOther
List of targets not handled by any other target type list. -
byAllInOne
List of target lists that need to be matched in full on exactly one entity to qualify as a match. -
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
Returns a duplicate of the target list, with all inner arrays duplicated. -
init
public void init()Initialize the targets list after loading it. -
isTarget
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
Fills the target list from a Citizens data key, during load time. -
updateOld
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
Forms a \0x01-separated list for all-in-one-target output. -
getTargetRemovableStrings
Gets a list of target strings, fit for input to a remove command. -
toMultiTargetString
Forms a comma-separated list for multi-target output. -
toAllInOneString
Forms a pipe-separated list for all-in-one-target output.
-