Don't need this here

This commit is contained in:
TfT_02 2014-12-20 19:14:49 +01:00
parent ebeebbde72
commit 3422c5d3eb

View File

@ -4,18 +4,13 @@ import java.util.UUID;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.ParticleEffectUtils;
@ -23,18 +18,11 @@ public class TrackedTamingEntity extends BukkitRunnable {
private LivingEntity livingEntity; private LivingEntity livingEntity;
private UUID id; private UUID id;
private int length; private int length;
private Player owner;
protected TrackedTamingEntity(LivingEntity livingEntity) { protected TrackedTamingEntity(LivingEntity livingEntity) {
this.livingEntity = livingEntity; this.livingEntity = livingEntity;
this.id = livingEntity.getUniqueId(); this.id = livingEntity.getUniqueId();
AnimalTamer tamer = ((Tameable)livingEntity).getOwner();
if (tamer != null && tamer instanceof Player) {
this.owner = (Player) tamer;
}
int tamingCOTWLength = Config.getInstance().getTamingCOTWLength(livingEntity.getType()); int tamingCOTWLength = Config.getInstance().getTamingCOTWLength(livingEntity.getType());
if (tamingCOTWLength > 0) { if (tamingCOTWLength > 0) {
@ -52,14 +40,7 @@ public class TrackedTamingEntity extends BukkitRunnable {
CombatUtils.dealDamage(livingEntity, livingEntity.getMaxHealth(), DamageCause.SUICIDE, livingEntity); CombatUtils.dealDamage(livingEntity, livingEntity.getMaxHealth(), DamageCause.SUICIDE, livingEntity);
} }
if (!UserManager.hasPlayerDataKey(owner)) { TamingManager.removeFromTracker(this);
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(owner);
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
tamingManager.removeFromTracker(this);
this.cancel(); this.cancel();
} }