Package org.mcmonkey.sentinel
Class SentinelTrait
java.lang.Object
net.citizensnpcs.api.trait.Trait
org.mcmonkey.sentinel.SentinelTrait
- All Implemented Interfaces:
Runnable
,org.bukkit.event.Listener
public class SentinelTrait
extends net.citizensnpcs.api.trait.Trait
The main Sentinel trait.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptiondouble
The NPC's accuracy value (0 = perfectly accurate).boolean
Whether the NPC can receive knockback.double
The NPC's armor value (-1 means automatically calculated from equipment, 0 means no armor and 1 means invincible armor...int
Ticks since last removal of arrows from the NPC.Helper for attacking.int
How long (in ticks) between using melee attacks.static final int
Constant: the maximum attack rate value (in ticks).int
How long (in ticks) between firing ranged shots.boolean
Whether this NPC automatically switches weapons.double
How far to stay from avoid targets.org.bukkit.Location
The NPC's avoid return point (null = just run away).boolean
Whether the NPC has chased a target during the most recent update.double
The maximum distance from a guard point the NPC can run (when chasing a target).org.bukkit.entity.LivingEntity
The target entity this NPC is chasing (if any).boolean
Whether the NPC chases targets when using melee weapons.int
Tick counter for therun
method.double
The NPC's damage value (-1 means automatically calculated from weapon, anything else is equal to the HP lost by an unarmored target).int
How much XP to drop when the NPC dies.boolean
If set 'true', the NPC will never teleport through Sentinel logic.Chances of item drops, matched to the 'drops' list.ArrayList
<org.bukkit.inventory.ItemStack> What the NPC drops when dead.boolean
Whether mob targets killed by the NPC can drop items.long
How long (in ticks) to retain an enemy target when out-of-view.boolean
Whether the NPC "fights back" against attacks (targets anyone that damages it).Players in range of the NPC that have already been greeted.The text to greet friendly players with (empty string = no greeting).double
The range this NPC gives greetings or warnings at.int
The rate in ticks this NPC gives greetings or warnings at.double
Minimum distance before choosing a new point (relative to guarded player).int
ID of an NPC to guard, if any.long
Lower 64 bits of the guarded player's UUID.long
Upper 64 bits of the guarded player's UUID.double
Maximum possible distance of point to choose (relative to the guarded player).int
How long (in ticks) before the NPC heals by 1 HP (when damaged).static final int
Constant: the maximum heal rate value (in ticks).double
The NPC's maximum health (NOT its current health when the NPC is spawned and injured).static final double
Constant: the smallest health value that can be given to an NPC.boolean
Whether this NPC should ignore Line of Sight requirement.boolean
Whether the NPC cannot be harmed (true = no harm, false = receives damage normally).boolean
Whether the NPC is currently trying to block with a shield.Helper for items.Last known entity UUID for this Sentinel NPC.Map of player UUIDs to the last ticks-alive stamp they were greeted at.boolean
Whether the NPC needs ammo to fire ranged weapons (otherwise, infinite ammo).Entities that will need their drops cleared if they die soon (because they were killed by this NPC).boolean
Indicates that the NPC needs to return to safety when next possible.boolean
Set true when waypoints are paused by Sentinel, to indicate that an unpause is needed (to avoid over-doing the unpause call, which can disrupt unrelated unpauses).boolean
If true: other behavior (unrelated to Sentinel) should be paused, as Sentinel is engaged in combat.org.bukkit.Location
Special case for where the NPC has been forced to run to in certain situations.double
How far this NPC is willing to fire projectiles.boolean
Whether the NPC should be protected from damage by ignore targets.double
Maximum distance after which damage starts being ignored.double
Maximum range to trigger attacks from.boolean
Whether the NPC chases targets when using ranged weapons.double
How far this NPC's punches can reach.int
Ticks before a new target is properly noticed.boolean
Whether this NPC should have 'realistic' targeting.org.bukkit.scheduler.BukkitRunnable
Runnable for respawning, if needed.long
How long (in ticks) after death before the NPC respawns.boolean
boolean
Whether the NPC runs away when attacked.boolean
Whether to protect NPC arrow shots from damaging targets that weren't meant to be hit.long
When the shield can next be used (based on tick timer), if it has been disabled via axe strike.org.bukkit.Location
The NPC's respawn location (null = respawn where the NPC died at).double
How fast the NPC moves when chasing (1 = normal speed).The name of the squad this NPC is in (null for no squad).long
Statistics value: how many arrows this NPC has fired.long
Statistics value: how many attacks this NPC has attempted.double
Statistics value: how much damage this NPC has given.double
Statistics value: how much damage this NPC has taken.long
Statistics value: how many eggs this NPC has thrown.long
Statistics value: how many evoker fangs this NPC has spawned.long
Statistics value: how many fireballs this NPC has fired.long
Statistics value: how many llama spits this NPC has spit.long
Statistics value: how many pearls this NPC has used.long
Statistics value: how many potions this NPC has thrown.long
Statistics value: how many times this NPC has punched a target.long
Statistics value: how many shulker bullets this NPC has shot.long
Statistics value: how many skulls this NPC has thrown.long
Statistics value: how many snowballs this NPC has thrown.long
Statistics value: how long (in ticks) this NPC has ever been in the world, in total.long
Statistics value: how many times this NPC has spawned into the world.Helper for targeting logic.int
Tick counter for the NPC guarding a player (to avoid updating positions too quickly).int
How long ago (in ticks) the NPC was last burned.long
Time since the last attack.long
Time since the last heal.The text to warn enemy players with (empty string = no greeting).Map of weapon material names to custom damage amount.Helper for weapons.Map of held weapon material names to redirect 'work like' material names.The name of a WorldGuard region this Sentinel must stay within (if any).Cache object, refer to 'worldguardRegion'.Fields inherited from class net.citizensnpcs.api.trait.Trait
npc
-
Constructor Summary
ConstructorDescriptionConstructs the Sentinel Trait object - should only be called by the Citizens API internal functionality. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new avoid-target (by target description string).void
Adds a new ignore (by target description string).void
Adds a new target (by target description string).void
Sets the NPC's local parameter speed modifier to its proper current value.boolean
canPathTo
(org.bukkit.Location loc) Determines whether the NPC is allowed to path to a location, by checking chase range and firing an event.void
Outputs a debug message (if debug is enabled).void
faceLocation
(org.bukkit.Location l) Rotates an NPC to face a target location.double
Gets the minimum distance from the NPC's head to launch a projectile from (to avoid it colliding with the NPC's own collision box).org.bukkit.util.Vector
fixForAcc
(org.bukkit.util.Vector input) Alters a vector per accuracy potential (makes the vector less accurate).void
generalDeathHandler
(org.bukkit.entity.LivingEntity entity) Handles some basics for when the NPC died.double
getArmor
(org.bukkit.entity.LivingEntity ent) Gets the NPC's current armor value (based on worn armor if calculation is required).double
Gets the NPC's current damage value (based on held weapon if calculation is required).double
getDamage
(boolean forRangedAttacks) Gets the NPC's current damage value (based on held weapon if calculation is required).double
getDamage
(boolean forRangedAttacks, org.bukkit.inventory.ItemStack weapon) Gets the NPC's current damage value (based on a specific weapon if calculation is required).List
<org.bukkit.inventory.ItemStack> getDrops()
Gets a list of items to drop (factoring in the drop chance values).Gets the UUID of the player this Sentinel is set to be guarding.org.bukkit.entity.LivingEntity
Gets the entity this NPC is guarding, or null.org.bukkit.Location
Gets the location this NPC is guarding (the NPC's own location if nothing else to guard).AbstractMap.SimpleEntry
<org.bukkit.Location, org.bukkit.util.Vector> getLaunchDetail
(org.bukkit.Location target, org.bukkit.util.Vector lead) Gets a 'launch detail' (starting location for the projectile position, and a vector holding the exact launch vector, scaled to the correct speed).org.bukkit.entity.LivingEntity
Gets the living entity for the NPC.boolean
hitIsBlocked
(org.bukkit.entity.Entity damager) Returns a boolean indicating whether a hit from the given damager should be blocked by a shield.void
load
(net.citizensnpcs.api.util.DataKey key) Updater for older Sentinel saves (up to 1.7.2)org.bukkit.Location
Gets the nearest pathing point to this NPC.void
onAttach()
Called when the Sentinel trait is attached to the NPC - fills all default values from config.void
onDeath()
Handler for when the NPC died.void
Called when the NPC despawns.void
onPlayerMovesInRange
(org.bukkit.event.player.PlayerMoveEvent event) Called every time a player moves at all, for use with monitoring if players move into range of an NPC.void
onPlayerTeleports
(org.bukkit.event.player.PlayerTeleportEvent event) Called whenever a player teleports, for use with NPC guarding logic.void
onRemove()
Called when the Sentinel trait is removed from an NPC.void
onSpawn()
Called when the NPC spawns in.void
pathTo
(org.bukkit.Location target) Causes the NPC to immediately path over to a position.void
Pauses waypoint navigation if currrently navigating, and fires the pause event.double
Returns a random decimal number within acceptable accuracy range (can be negative).void
removeAvoid
(String target) Removes an avoid-target (by target description string).void
removeIgnore
(String target) Removes an ignore (by target description string).void
removeTarget
(String target) Removes a target (by target description string).void
run()
Called every tick to run Sentinel updates if needed.void
Runs a full update cycle on the NPC.void
save
(net.citizensnpcs.api.util.DataKey key) void
Causes the NPC to speak a message to a player.void
setGuarding
(int npcID) Sets the NPC to be guarding an NPC.void
setGuarding
(UUID uuid) Sets the NPC to be guarding an entity.void
setHealth
(double heal) Sets the NPC's maximum health.void
setInvincible
(boolean inv) Sets whether the NPC is invincible.void
Marks that the NPC can see a target (Changes the state of some entity types, eg opening a shulker box).void
Marks that the NPC can no longer see a target (Changes the state of some entity types, eg closing a shulker box).void
Causes the NPC to start blocking with a shield (if it has one).void
Causes the NPC to stop blocking with a shield (if it has one).void
Swings the NPC's weapon (plays an ARM_SWING animation if possible - otherwise, does nothing).boolean
tryUpdateChaseTarget
(org.bukkit.entity.LivingEntity newTarget) Attempts to update the chasing target, calling the needed events and checking for modifications.void
Un-Pauses (resumes) waypoint navigation if currrently navigating, and fires the un-pause event.void
updateOld
(net.citizensnpcs.api.util.DataKey key) Updater for older Sentinel saves (up to 1.7.2)void
useItem()
Animates the NPC using their item, and stops the animation 10 ticks later (useful for replicating bow draws, etc).boolean
Validates this Sentinel NPC's presence on the current NPCs list.void
whenAnEnemyDies
(UUID dead) Called when a target dies to remove them from the target list.void
whenAttacksAreHappeningFromMe
(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when this sentinel attacks something, to correct damage handling.void
whenAttacksAreHappeningFromMyArrow
(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when this sentinel attacks something with a projectile, to correct damage handling.void
whenAttacksAreHappeningToMe
(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when this sentinel gets attacked, to correct the armor handling.void
whenAttacksHappened
(org.bukkit.event.entity.EntityDamageByEntityEvent event) void
whenImHurt
(org.bukkit.event.entity.EntityDamageEvent event) Called when this sentinel gets hurt.void
whenSomethingDies
(org.bukkit.event.entity.EntityDeathEvent event) Called when any entity dies.void
whenSomethingMightDie
(UUID mightDie) Called when an entity might die from damage (called before Sentinel detects that an NPC might have killed an entity).void
whenWeDie
(org.bukkit.event.entity.EntityDeathEvent event) Called when the NPC dies.Methods inherited from class net.citizensnpcs.api.trait.Trait
getName, getNPC, isRunImplemented, linkToNPC, onCopy, onDespawn, onPreSpawn, onRemove
-
Field Details
-
healthMin
public static final double healthMinConstant: the smallest health value that can be given to an NPC.- See Also:
-
attackRateMax
public static final int attackRateMaxConstant: the maximum attack rate value (in ticks).- See Also:
-
healRateMax
public static final int healRateMaxConstant: the maximum heal rate value (in ticks).- See Also:
-
targetingHelper
Helper for targeting logic. -
itemHelper
Helper for items. -
weaponHelper
Helper for weapons. -
attackHelper
Helper for attacking. -
stats_ticksSpawned
public long stats_ticksSpawnedStatistics value: how long (in ticks) this NPC has ever been in the world, in total. -
stats_timesSpawned
public long stats_timesSpawnedStatistics value: how many times this NPC has spawned into the world. -
stats_arrowsFired
public long stats_arrowsFiredStatistics value: how many arrows this NPC has fired. -
stats_potionsThrown
public long stats_potionsThrownStatistics value: how many potions this NPC has thrown. -
stats_fireballsFired
public long stats_fireballsFiredStatistics value: how many fireballs this NPC has fired. -
stats_snowballsThrown
public long stats_snowballsThrownStatistics value: how many snowballs this NPC has thrown. -
stats_eggsThrown
public long stats_eggsThrownStatistics value: how many eggs this NPC has thrown. -
stats_skullsThrown
public long stats_skullsThrownStatistics value: how many skulls this NPC has thrown. -
stats_llamaSpitShot
public long stats_llamaSpitShotStatistics value: how many llama spits this NPC has spit. -
stats_shulkerBulletsShot
public long stats_shulkerBulletsShotStatistics value: how many shulker bullets this NPC has shot. -
stats_evokerFangsSpawned
public long stats_evokerFangsSpawnedStatistics value: how many evoker fangs this NPC has spawned. -
stats_pearlsUsed
public long stats_pearlsUsedStatistics value: how many pearls this NPC has used. -
stats_punches
public long stats_punchesStatistics value: how many times this NPC has punched a target. -
stats_attackAttempts
public long stats_attackAttemptsStatistics value: how many attacks this NPC has attempted. -
stats_damageTaken
public double stats_damageTakenStatistics value: how much damage this NPC has taken. -
stats_damageGiven
public double stats_damageGivenStatistics value: how much damage this NPC has given. -
allTargets
-
allIgnores
-
allAvoids
-
avoidRange
public double avoidRangeHow far to stay from avoid targets. -
range
public double rangeMaximum range to trigger attacks from. -
damage
public double damageThe NPC's damage value (-1 means automatically calculated from weapon, anything else is equal to the HP lost by an unarmored target). -
armor
public double armorThe NPC's armor value (-1 means automatically calculated from equipment, 0 means no armor and 1 means invincible armor... decimals between 0 and 1 are normal). -
health
public double healthThe NPC's maximum health (NOT its current health when the NPC is spawned and injured). -
rangedChase
public boolean rangedChaseWhether the NPC chases targets when using ranged weapons. -
closeChase
public boolean closeChaseWhether the NPC chases targets when using melee weapons. -
invincible
public boolean invincibleWhether the NPC cannot be harmed (true = no harm, false = receives damage normally). -
protectFromIgnores
public boolean protectFromIgnoresWhether the NPC should be protected from damage by ignore targets. -
protectFromRange
public double protectFromRangeMaximum distance after which damage starts being ignored. -
fightback
public boolean fightbackWhether the NPC "fights back" against attacks (targets anyone that damages it). -
runaway
public boolean runawayWhether the NPC runs away when attacked. -
attackRate
public int attackRateHow long (in ticks) between using melee attacks. -
attackRateRanged
public int attackRateRangedHow long (in ticks) between firing ranged shots. -
healRate
public int healRateHow long (in ticks) before the NPC heals by 1 HP (when damaged). -
guardingUpper
public long guardingUpperUpper 64 bits of the guarded player's UUID. -
guardingLower
public long guardingLowerLower 64 bits of the guarded player's UUID. -
guardedNPC
public int guardedNPCID of an NPC to guard, if any. -
needsAmmo
public boolean needsAmmoWhether the NPC needs ammo to fire ranged weapons (otherwise, infinite ammo). -
safeShot
public boolean safeShotWhether to protect NPC arrow shots from damaging targets that weren't meant to be hit. -
respawnTime
public long respawnTimeHow long (in ticks) after death before the NPC respawns. -
chaseRange
public double chaseRangeThe maximum distance from a guard point the NPC can run (when chasing a target). -
spawnPoint
public org.bukkit.Location spawnPointThe NPC's respawn location (null = respawn where the NPC died at). -
avoidReturnPoint
public org.bukkit.Location avoidReturnPointThe NPC's avoid return point (null = just run away). -
drops
What the NPC drops when dead. -
dropChances
Chances of item drops, matched to the 'drops' list. -
enemyDrops
public boolean enemyDropsWhether mob targets killed by the NPC can drop items. -
enemyTargetTime
public long enemyTargetTimeHow long (in ticks) to retain an enemy target when out-of-view. -
speed
public double speedHow fast the NPC moves when chasing (1 = normal speed). -
warningText
The text to warn enemy players with (empty string = no greeting). -
greetingText
The text to greet friendly players with (empty string = no greeting). -
greetRange
public double greetRangeThe range this NPC gives greetings or warnings at. -
greetRate
public int greetRateThe rate in ticks this NPC gives greetings or warnings at. -
autoswitch
public boolean autoswitchWhether this NPC automatically switches weapons. -
squad
The name of the squad this NPC is in (null for no squad). -
accuracy
public double accuracyThe NPC's accuracy value (0 = perfectly accurate). -
realistic
public boolean realisticWhether this NPC should have 'realistic' targeting. -
ignoreLOS
public boolean ignoreLOSWhether this NPC should ignore Line of Sight requirement. If set true, the NPC can see targets through walls. -
reach
public double reachHow far this NPC's punches can reach. -
projectileRange
public double projectileRangeHow far this NPC is willing to fire projectiles. -
guardDistanceMinimum
public double guardDistanceMinimumMinimum distance before choosing a new point (relative to guarded player). -
guardSelectionRange
public double guardSelectionRangeMaximum possible distance of point to choose (relative to the guarded player). -
retainTarget
public boolean retainTarget -
weaponDamage
Map of weapon material names to custom damage amount. -
weaponRedirects
Map of held weapon material names to redirect 'work like' material names. -
disableTeleporting
public boolean disableTeleportingIf set 'true', the NPC will never teleport through Sentinel logic. When enabling this, you should set the Citizens "stuckAction" NavigatorParameter to "null" as well. -
reactionSlowdown
public int reactionSlowdownTicks before a new target is properly noticed. 0 = no slowdown applied. -
allowKnockback
public boolean allowKnockbackWhether the NPC can receive knockback. -
worldguardRegion
The name of a WorldGuard region this Sentinel must stay within (if any). -
deathXP
public int deathXPHow much XP to drop when the NPC dies. -
worldguardRegionCache
Cache object, refer to 'worldguardRegion'. -
chasing
public org.bukkit.entity.LivingEntity chasingThe target entity this NPC is chasing (if any). Do not alter directly, prefer attackHelper.chase(...) -
isBlocking
public boolean isBlockingWhether the NPC is currently trying to block with a shield. -
ticksSinceLastBurn
public int ticksSinceLastBurnHow long ago (in ticks) the NPC was last burned. -
shieldAxeCooldown
public long shieldAxeCooldownWhen the shield can next be used (based on tick timer), if it has been disabled via axe strike. -
greetedAlready
Players in range of the NPC that have already been greeted. -
lastGreetTime
Map of player UUIDs to the last ticks-alive stamp they were greeted at. -
timeSinceAttack
public long timeSinceAttackTime since the last attack. -
timeSinceHeal
public long timeSinceHealTime since the last heal. -
chased
public boolean chasedWhether the NPC has chased a target during the most recent update. Do not alter directly, prefer attackHelper.chase(...) -
ticksCountGuard
public int ticksCountGuardTick counter for the NPC guarding a player (to avoid updating positions too quickly). -
needsToUnpause
public boolean needsToUnpauseSet true when waypoints are paused by Sentinel, to indicate that an unpause is needed (to avoid over-doing the unpause call, which can disrupt unrelated unpauses). -
otherBehaviorPaused
public boolean otherBehaviorPausedIf true: other behavior (unrelated to Sentinel) should be paused, as Sentinel is engaged in combat. Consider also listening to event 'SentinelCombatStateChangeEvent'. -
pathingTo
public org.bukkit.Location pathingToSpecial case for where the NPC has been forced to run to in certain situations. -
needsSafeReturn
public boolean needsSafeReturnIndicates that the NPC needs to return to safety when next possible. -
arrowResetTicker
public int arrowResetTickerTicks since last removal of arrows from the NPC. -
cTick
public int cTickTick counter for therun
method. -
respawnMe
public org.bukkit.scheduler.BukkitRunnable respawnMeRunnable for respawning, if needed. -
lastEntityUUID
Last known entity UUID for this Sentinel NPC. -
needsDropsClear
Entities that will need their drops cleared if they die soon (because they were killed by this NPC).
-
-
Constructor Details
-
SentinelTrait
public SentinelTrait()Constructs the Sentinel Trait object - should only be called by the Citizens API internal functionality. To add Sentinel to an NPC, usenpc.addTrait(SentinelTrait.class)
.
-
-
Method Details
-
load
public void load(net.citizensnpcs.api.util.DataKey key) Updater for older Sentinel saves (up to 1.7.2)- Overrides:
load
in classnet.citizensnpcs.api.trait.Trait
-
save
public void save(net.citizensnpcs.api.util.DataKey key) - Overrides:
save
in classnet.citizensnpcs.api.trait.Trait
-
updateOld
public void updateOld(net.citizensnpcs.api.util.DataKey key) Updater for older Sentinel saves (up to 1.7.2) -
addTarget
Adds a new target (by target description string). -
addIgnore
Adds a new ignore (by target description string). -
addAvoid
Adds a new avoid-target (by target description string). -
removeTarget
Removes a target (by target description string). -
removeIgnore
Removes an ignore (by target description string). -
removeAvoid
Removes an avoid-target (by target description string). -
startBlocking
public void startBlocking()Causes the NPC to start blocking with a shield (if it has one). -
stopBlocking
public void stopBlocking()Causes the NPC to stop blocking with a shield (if it has one). -
autoSpeedModifier
public void autoSpeedModifier()Sets the NPC's local parameter speed modifier to its proper current value. -
getGuarding
Gets the UUID of the player this Sentinel is set to be guarding. Null indicates not guarding anyone. -
setGuarding
public void setGuarding(int npcID) Sets the NPC to be guarding an NPC. -1 indicates not guarding anyone. -
setGuarding
Sets the NPC to be guarding an entity. Null indicates not guarding anyone. -
whenImHurt
public void whenImHurt(org.bukkit.event.entity.EntityDamageEvent event) Called when this sentinel gets hurt. -
hitIsBlocked
public boolean hitIsBlocked(org.bukkit.entity.Entity damager) Returns a boolean indicating whether a hit from the given damager should be blocked by a shield. -
whenAttacksAreHappeningToMe
public void whenAttacksAreHappeningToMe(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when this sentinel gets attacked, to correct the armor handling. -
whenAttacksAreHappeningFromMe
public void whenAttacksAreHappeningFromMe(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when this sentinel attacks something, to correct damage handling. -
whenAttacksAreHappeningFromMyArrow
public void whenAttacksAreHappeningFromMyArrow(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when this sentinel attacks something with a projectile, to correct damage handling. -
whenAttacksHappened
public void whenAttacksHappened(org.bukkit.event.entity.EntityDamageByEntityEvent event) -
whenAnEnemyDies
Called when a target dies to remove them from the target list. -
onAttach
public void onAttach()Called when the Sentinel trait is attached to the NPC - fills all default values from config.- Overrides:
onAttach
in classnet.citizensnpcs.api.trait.Trait
-
onRemove
public void onRemove()Called when the Sentinel trait is removed from an NPC.- Overrides:
onRemove
in classnet.citizensnpcs.api.trait.Trait
-
useItem
public void useItem()Animates the NPC using their item, and stops the animation 10 ticks later (useful for replicating bow draws, etc). -
swingWeapon
public void swingWeapon()Swings the NPC's weapon (plays an ARM_SWING animation if possible - otherwise, does nothing). -
firingMinimumRange
public double firingMinimumRange()Gets the minimum distance from the NPC's head to launch a projectile from (to avoid it colliding with the NPC's own collision box). -
getLaunchDetail
public AbstractMap.SimpleEntry<org.bukkit.Location,org.bukkit.util.Vector> getLaunchDetail(org.bukkit.Location target, org.bukkit.util.Vector lead) Gets a 'launch detail' (starting location for the projectile position, and a vector holding the exact launch vector, scaled to the correct speed). -
randomAcc
public double randomAcc()Returns a random decimal number within acceptable accuracy range (can be negative). -
fixForAcc
public org.bukkit.util.Vector fixForAcc(org.bukkit.util.Vector input) Alters a vector per accuracy potential (makes the vector less accurate). -
faceLocation
public void faceLocation(org.bukkit.Location l) Rotates an NPC to face a target location. -
getDamage
public double getDamage()Gets the NPC's current damage value (based on held weapon if calculation is required). -
getDamage
public double getDamage(boolean forRangedAttacks) Gets the NPC's current damage value (based on held weapon if calculation is required). -
getDamage
public double getDamage(boolean forRangedAttacks, org.bukkit.inventory.ItemStack weapon) Gets the NPC's current damage value (based on a specific weapon if calculation is required). -
getArmor
public double getArmor(org.bukkit.entity.LivingEntity ent) Gets the NPC's current armor value (based on worn armor if calculation is required). -
getLivingEntity
public org.bukkit.entity.LivingEntity getLivingEntity()Gets the living entity for the NPC. -
specialMarkVision
public void specialMarkVision()Marks that the NPC can see a target (Changes the state of some entity types, eg opening a shulker box). -
specialUnmarkVision
public void specialUnmarkVision()Marks that the NPC can no longer see a target (Changes the state of some entity types, eg closing a shulker box). -
canPathTo
public boolean canPathTo(org.bukkit.Location loc) Determines whether the NPC is allowed to path to a location, by checking chase range and firing an event. -
pathTo
public void pathTo(org.bukkit.Location target) Causes the NPC to immediately path over to a position. -
pauseWaypoints
public void pauseWaypoints()Pauses waypoint navigation if currrently navigating, and fires the pause event. -
unpauseWaypoints
public void unpauseWaypoints()Un-Pauses (resumes) waypoint navigation if currrently navigating, and fires the un-pause event. -
getGuardingEntity
public org.bukkit.entity.LivingEntity getGuardingEntity()Gets the entity this NPC is guarding, or null. -
runUpdate
public void runUpdate()Runs a full update cycle on the NPC. -
getGuardZone
public org.bukkit.Location getGuardZone()Gets the location this NPC is guarding (the NPC's own location if nothing else to guard). -
nearestPathPoint
public org.bukkit.Location nearestPathPoint()Gets the nearest pathing point to this NPC. -
run
public void run()Called every tick to run Sentinel updates if needed. -
onSpawn
public void onSpawn()Called when the NPC spawns in.- Overrides:
onSpawn
in classnet.citizensnpcs.api.trait.Trait
-
sayTo
Causes the NPC to speak a message to a player. -
onPlayerTeleports
public void onPlayerTeleports(org.bukkit.event.player.PlayerTeleportEvent event) Called whenever a player teleports, for use with NPC guarding logic. -
onPlayerMovesInRange
public void onPlayerMovesInRange(org.bukkit.event.player.PlayerMoveEvent event) Called every time a player moves at all, for use with monitoring if players move into range of an NPC. -
whenSomethingMightDie
Called when an entity might die from damage (called before Sentinel detects that an NPC might have killed an entity). -
debug
Outputs a debug message (if debug is enabled). -
getDrops
Gets a list of items to drop (factoring in the drop chance values). -
whenWeDie
public void whenWeDie(org.bukkit.event.entity.EntityDeathEvent event) Called when the NPC dies. -
generalDeathHandler
public void generalDeathHandler(org.bukkit.entity.LivingEntity entity) Handles some basics for when the NPC died. -
whenSomethingDies
public void whenSomethingDies(org.bukkit.event.entity.EntityDeathEvent event) Called when any entity dies. -
onDeath
public void onDeath()Handler for when the NPC died. -
onDespawn
public void onDespawn()Called when the NPC despawns.- Overrides:
onDespawn
in classnet.citizensnpcs.api.trait.Trait
-
setHealth
public void setHealth(double heal) Sets the NPC's maximum health. -
setInvincible
public void setInvincible(boolean inv) Sets whether the NPC is invincible. -
validateOnList
public boolean validateOnList()Validates this Sentinel NPC's presence on the current NPCs list. -
tryUpdateChaseTarget
public boolean tryUpdateChaseTarget(org.bukkit.entity.LivingEntity newTarget) Attempts to update the chasing target, calling the needed events and checking for modifications.
-