Klasse ThreatService
java.lang.Object
de.delinkedde.mobarenareborn.threat.ThreatService
Turns recorded threat into mob targeting and keeps the threat table tidy.
When a player damages an arena mob the threat is recorded and the mob is retargeted to its top-threat player. A taunt overrides threat so the tank becomes the target. A periodic prune removes records for mobs that no longer exist (for example mobs removed when a round ends without a death event).
Targeting uses the public Mob.setTarget(LivingEntity) API; no server internals are
touched.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidonDamage(@NotNull LivingEntity mob, @NotNull Player player, double amount) Records damage threat and retargets the mob.voidRemoves threat records for a mob.voidremovePlayer(@NotNull UUID player) Removes a player from all threat records.voidstart()Starts the periodic prune task.voidstop()Cancels the prune task and clears all threat.voidtaunt(@NotNull Collection<? extends LivingEntity> mobs, @NotNull Player tank, double threatValue) Forces the given mobs to target a player by setting maximum threat (taunt).
-
Konstruktordetails
-
ThreatService
- Parameter:
plugin- the owning plugin, used for scheduling the prune task
-
-
Methodendetails
-
start
public void start()Starts the periodic prune task. Safe to call once during enable. -
stop
public void stop()Cancels the prune task and clears all threat. -
onDamage
public void onDamage(@NotNull @NotNull LivingEntity mob, @NotNull @NotNull Player player, double amount) Records damage threat and retargets the mob.- Parameter:
mob- the damaged arena mobplayer- the attacking playeramount- the damage dealt
-
taunt
public void taunt(@NotNull @NotNull Collection<? extends LivingEntity> mobs, @NotNull @NotNull Player tank, double threatValue) Forces the given mobs to target a player by setting maximum threat (taunt).- Parameter:
mobs- the mobs to taunttank- the player to draw aggro tothreatValue- the absolute threat value to assign
-
removeMob
Removes threat records for a mob.- Parameter:
mob- the mob id
-
removePlayer
Removes a player from all threat records.- Parameter:
player- the player id
-