Interface MobTargetEvent
- All Superinterfaces:
Cancellable, Event, MobEvent
Fired when a mob is about to take a new target: one it noticed, one that hurt it, or one a plugin
gave it.
It does not fire when the mob keeps its target, nor when it gives up on one. Cancelling it leaves the mob with its previous target; the mob may try again later, firing the event anew. Setting the target of the mob from a listener fires a nested event.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns the target the mob had,nullfor none.voidsetTarget(@Nullable LivingEntity target) Gives the mob another target instead.target()Returns the target the mob is about to take,nullif a listener took it away.Methods inherited from interface Cancellable
isCancelled, setCancelled
-
Method Details
-
previousTarget
@Nullable LivingEntity previousTarget()Returns the target the mob had,nullfor none.- Returns:
- the target the mob had,
nullfor none - Since:
- 0.1.0
-
target
@Nullable LivingEntity target()Returns the target the mob is about to take,nullif a listener took it away.- Returns:
- the target the mob is about to take,
nullif a listener took it away - Since:
- 0.1.0
-
setTarget
Gives the mob another target instead.- Parameters:
target- the new target;nullto leave the mob without any- Since:
- 0.1.0
-