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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleThe NPC's accuracy value (0 = perfectly accurate).booleanWhether the NPC can receive knockback.doubleThe NPC's armor value (-1 means automatically calculated from equipment, 0 means no armor and 1 means invincible armor...intTicks since last removal of arrows from the NPC.Helper for attacking.intHow long (in ticks) between using melee attacks.static final intConstant: the maximum attack rate value (in ticks).intHow long (in ticks) between firing ranged shots.booleanWhether this NPC automatically switches weapons.doubleHow far to stay from avoid targets.org.bukkit.LocationThe NPC's avoid return point (null = just run away).booleanWhether the NPC has chased a target during the most recent update.doubleThe maximum distance from a guard point the NPC can run (when chasing a target).org.bukkit.entity.LivingEntityThe target entity this NPC is chasing (if any).booleanWhether the NPC chases targets when using melee weapons.intTick counter for therunmethod.doubleThe NPC's damage value (-1 means automatically calculated from weapon, anything else is equal to the HP lost by an unarmored target).intHow much XP to drop when the NPC dies.booleanIf 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.booleanWhether mob targets killed by the NPC can drop items.longHow long (in ticks) to retain an enemy target when out-of-view.booleanWhether 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).doubleThe range this NPC gives greetings or warnings at.intThe rate in ticks this NPC gives greetings or warnings at.doubleMinimum distance before choosing a new point (relative to guarded player).intID of an NPC to guard, if any.longLower 64 bits of the guarded player's UUID.longUpper 64 bits of the guarded player's UUID.doubleMaximum possible distance of point to choose (relative to the guarded player).intHow long (in ticks) before the NPC heals by 1 HP (when damaged).static final intConstant: the maximum heal rate value (in ticks).doubleThe NPC's maximum health (NOT its current health when the NPC is spawned and injured).static final doubleConstant: the smallest health value that can be given to an NPC.booleanWhether this NPC should ignore Line of Sight requirement.booleanWhether the NPC cannot be harmed (true = no harm, false = receives damage normally).booleanWhether 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.booleanWhether 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).booleanIndicates that the NPC needs to return to safety when next possible.booleanSet 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).booleanIf true: other behavior (unrelated to Sentinel) should be paused, as Sentinel is engaged in combat.org.bukkit.LocationSpecial case for where the NPC has been forced to run to in certain situations.doubleHow far this NPC is willing to fire projectiles.booleanWhether the NPC should be protected from damage by ignore targets.doubleMaximum distance after which damage starts being ignored.doubleMaximum range to trigger attacks from.booleanWhether the NPC chases targets when using ranged weapons.doubleHow far this NPC's punches can reach.intTicks before a new target is properly noticed.booleanWhether this NPC should have 'realistic' targeting.org.bukkit.scheduler.BukkitRunnableRunnable for respawning, if needed.longHow long (in ticks) after death before the NPC respawns.booleanbooleanWhether the NPC runs away when attacked.booleanWhether to protect NPC arrow shots from damaging targets that weren't meant to be hit.longWhen the shield can next be used (based on tick timer), if it has been disabled via axe strike.org.bukkit.LocationThe NPC's respawn location (null = respawn where the NPC died at).doubleHow fast the NPC moves when chasing (1 = normal speed).The name of the squad this NPC is in (null for no squad).longStatistics value: how many arrows this NPC has fired.longStatistics value: how many attacks this NPC has attempted.doubleStatistics value: how much damage this NPC has given.doubleStatistics value: how much damage this NPC has taken.longStatistics value: how many eggs this NPC has thrown.longStatistics value: how many evoker fangs this NPC has spawned.longStatistics value: how many fireballs this NPC has fired.longStatistics value: how many llama spits this NPC has spit.longStatistics value: how many pearls this NPC has used.longStatistics value: how many potions this NPC has thrown.longStatistics value: how many times this NPC has punched a target.longStatistics value: how many shulker bullets this NPC has shot.longStatistics value: how many skulls this NPC has thrown.longStatistics value: how many snowballs this NPC has thrown.longStatistics value: how long (in ticks) this NPC has ever been in the world, in total.longStatistics value: how many times this NPC has spawned into the world.Helper for targeting logic.intTick counter for the NPC guarding a player (to avoid updating positions too quickly).intHow long ago (in ticks) the NPC was last burned.longTime since the last attack.longTime 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
ConstructorsConstructorDescriptionConstructs the Sentinel Trait object - should only be called by the Citizens API internal functionality. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new avoid-target (by target description string).voidAdds a new ignore (by target description string).voidAdds a new target (by target description string).voidSets the NPC's local parameter speed modifier to its proper current value.booleancanPathTo(org.bukkit.Location loc) Determines whether the NPC is allowed to path to a location, by checking chase range and firing an event.voidOutputs a debug message (if debug is enabled).voidfaceLocation(org.bukkit.Location l) Rotates an NPC to face a target location.doubleGets 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.VectorfixForAcc(org.bukkit.util.Vector input) Alters a vector per accuracy potential (makes the vector less accurate).voidgeneralDeathHandler(org.bukkit.entity.LivingEntity entity) Handles some basics for when the NPC died.doublegetArmor(org.bukkit.entity.LivingEntity ent) Gets the NPC's current armor value (based on worn armor if calculation is required).doubleGets the NPC's current damage value (based on held weapon if calculation is required).doublegetDamage(boolean forRangedAttacks) Gets the NPC's current damage value (based on held weapon if calculation is required).doublegetDamage(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.LivingEntityGets the entity this NPC is guarding, or null.org.bukkit.LocationGets 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.LivingEntityGets the living entity for the NPC.booleanhitIsBlocked(org.bukkit.entity.Entity damager) Returns a boolean indicating whether a hit from the given damager should be blocked by a shield.voidload(net.citizensnpcs.api.util.DataKey key) Updater for older Sentinel saves (up to 1.7.2)org.bukkit.LocationGets the nearest pathing point to this NPC.voidonAttach()Called when the Sentinel trait is attached to the NPC - fills all default values from config.voidonDeath()Handler for when the NPC died.voidCalled when the NPC despawns.voidonPlayerMovesInRange(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.voidonPlayerTeleports(org.bukkit.event.player.PlayerTeleportEvent event) Called whenever a player teleports, for use with NPC guarding logic.voidonRemove()Called when the Sentinel trait is removed from an NPC.voidonSpawn()Called when the NPC spawns in.voidpathTo(org.bukkit.Location target) Causes the NPC to immediately path over to a position.voidPauses waypoint navigation if currrently navigating, and fires the pause event.doubleReturns a random decimal number within acceptable accuracy range (can be negative).voidremoveAvoid(String target) Removes an avoid-target (by target description string).voidremoveIgnore(String target) Removes an ignore (by target description string).voidremoveTarget(String target) Removes a target (by target description string).voidrun()Called every tick to run Sentinel updates if needed.voidRuns a full update cycle on the NPC.voidsave(net.citizensnpcs.api.util.DataKey key) voidCauses the NPC to speak a message to a player.voidsetGuarding(int npcID) Sets the NPC to be guarding an NPC.voidsetGuarding(UUID uuid) Sets the NPC to be guarding an entity.voidsetHealth(double heal) Sets the NPC's maximum health.voidsetInvincible(boolean inv) Sets whether the NPC is invincible.voidMarks that the NPC can see a target (Changes the state of some entity types, eg opening a shulker box).voidMarks that the NPC can no longer see a target (Changes the state of some entity types, eg closing a shulker box).voidCauses the NPC to start blocking with a shield (if it has one).voidCauses the NPC to stop blocking with a shield (if it has one).voidSwings the NPC's weapon (plays an ARM_SWING animation if possible - otherwise, does nothing).booleantryUpdateChaseTarget(org.bukkit.entity.LivingEntity newTarget) Attempts to update the chasing target, calling the needed events and checking for modifications.voidUn-Pauses (resumes) waypoint navigation if currrently navigating, and fires the un-pause event.voidupdateOld(net.citizensnpcs.api.util.DataKey key) Updater for older Sentinel saves (up to 1.7.2)voiduseItem()Animates the NPC using their item, and stops the animation 10 ticks later (useful for replicating bow draws, etc).booleanValidates this Sentinel NPC's presence on the current NPCs list.voidwhenAnEnemyDies(UUID dead) Called when a target dies to remove them from the target list.voidwhenAttacksAreHappeningFromMe(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when this sentinel attacks something, to correct damage handling.voidwhenAttacksAreHappeningFromMyArrow(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when this sentinel attacks something with a projectile, to correct damage handling.voidwhenAttacksAreHappeningToMe(org.bukkit.event.entity.EntityDamageByEntityEvent event) Called when this sentinel gets attacked, to correct the armor handling.voidwhenAttacksHappened(org.bukkit.event.entity.EntityDamageByEntityEvent event) voidwhenImHurt(org.bukkit.event.entity.EntityDamageEvent event) Called when this sentinel gets hurt.voidwhenSomethingDies(org.bukkit.event.entity.EntityDeathEvent event) Called when any entity dies.voidwhenSomethingMightDie(UUID mightDie) Called when an entity might die from damage (called before Sentinel detects that an NPC might have killed an entity).voidwhenWeDie(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 therunmethod. -
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:
loadin classnet.citizensnpcs.api.trait.Trait
-
save
public void save(net.citizensnpcs.api.util.DataKey key) - Overrides:
savein 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:
onAttachin classnet.citizensnpcs.api.trait.Trait
-
onRemove
public void onRemove()Called when the Sentinel trait is removed from an NPC.- Overrides:
onRemovein 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:
onSpawnin 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:
onDespawnin 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.
-