mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Fix TrackedTamingEntity
This commit is contained in:
parent
12e3a5d222
commit
d4826eebd8
@ -7,6 +7,7 @@ import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -20,12 +21,13 @@ public class TrackedTamingEntity extends BukkitRunnable {
|
|||||||
private final mcMMO pluginRef;
|
private final mcMMO pluginRef;
|
||||||
|
|
||||||
protected TrackedTamingEntity(mcMMO pluginRef, LivingEntity livingEntity, CallOfTheWildType callOfTheWildType, TamingManager tamingManagerRef) {
|
protected TrackedTamingEntity(mcMMO pluginRef, LivingEntity livingEntity, CallOfTheWildType callOfTheWildType, TamingManager tamingManagerRef) {
|
||||||
|
this.pluginRef = pluginRef;
|
||||||
this.tamingManagerRef = tamingManagerRef;
|
this.tamingManagerRef = tamingManagerRef;
|
||||||
this.callOfTheWildType = callOfTheWildType;
|
this.callOfTheWildType = callOfTheWildType;
|
||||||
this.livingEntity = livingEntity;
|
this.livingEntity = livingEntity;
|
||||||
this.id = livingEntity.getUniqueId();
|
this.id = livingEntity.getUniqueId();
|
||||||
|
|
||||||
int tamingCOTWLength = pluginRef.getConfigManager().getConfigTaming().getSubSkills().getCallOfTheWild()..getTamingCOTWLength(livingEntity.getType());
|
int tamingCOTWLength = pluginRef.getConfigManager().getConfigTaming().getSubSkills().getCallOfTheWild().getCOTWSummon(callOfTheWildType).getSummonLifespan();
|
||||||
|
|
||||||
if (tamingCOTWLength > 0) {
|
if (tamingCOTWLength > 0) {
|
||||||
this.length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
|
this.length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
|
||||||
@ -39,7 +41,7 @@ public class TrackedTamingEntity extends BukkitRunnable {
|
|||||||
Location location = livingEntity.getLocation();
|
Location location = livingEntity.getLocation();
|
||||||
location.getWorld().playSound(location, Sound.BLOCK_FIRE_EXTINGUISH, 0.8F, 0.8F);
|
location.getWorld().playSound(location, Sound.BLOCK_FIRE_EXTINGUISH, 0.8F, 0.8F);
|
||||||
ParticleEffectUtils.playCallOfTheWildEffect(livingEntity);
|
ParticleEffectUtils.playCallOfTheWildEffect(livingEntity);
|
||||||
pluginRef.getCombatTools().dealDamage(livingEntity, livingEntity.getMaxHealth(), DamageCause.SUICIDE, livingEntity);
|
pluginRef.getCombatTools().dealDamage(livingEntity, livingEntity.getMaxHealth(), EntityDamageEvent.DamageCause.SUICIDE, livingEntity);
|
||||||
|
|
||||||
if(tamingManagerRef != null)
|
if(tamingManagerRef != null)
|
||||||
tamingManagerRef.removeFromTracker(this);
|
tamingManagerRef.removeFromTracker(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user