Remove armor stands causing memory leaks

This commit is contained in:
AlexTheCoder 2017-04-23 22:20:53 -04:00
parent c78ee51307
commit 9829527688

View File

@ -10,7 +10,6 @@ import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -45,7 +44,6 @@ public class CombatLogNPC
private boolean _creative;
private LivingEntity _npc;
private ArmorStand _stand;
private CraftLivingEntity _lastDamager;
@ -153,13 +151,6 @@ public class CombatLogNPC
System.out.println("Despawning");
if (_npc != null)
{
if (_stand != null)
{
_stand.setPassenger(null);
_stand.remove();
_stand = null;
}
_npc.remove();
_npc = null;
_hologram.stop();
@ -210,17 +201,6 @@ public class CombatLogNPC
// Disguise
DisguisePlayer disguise = new DisguisePlayer(skel, ((CraftPlayer) player).getHandle().getProfile());
_disguiseManager.disguise(disguise, attempted -> inRange.contains(attempted));
if (!UtilEnt.isGrounded(player))
{
ArmorStand stand = player.getWorld().spawn(spawnLoc.clone().subtract(0,1,0), ArmorStand.class);
stand.setVisible(false);
stand.setPassenger(skel);
stand.setGravity(false);
_stand = stand;
}
return skel;
}