Don't drop items from hidden slimes. Fixes PC-276

This commit is contained in:
Sam Sun 2016-05-17 12:39:09 -04:00
parent 9141ed645a
commit cd0e59087a
2 changed files with 9 additions and 0 deletions

View File

@ -103,6 +103,11 @@ public class Creature extends MiniPlugin
event.setDroppedExp(0);
List<ItemStack> drops = event.getDrops();
if (event.getEntity().hasMetadata("Creature.DoNotDrop"))
{
drops.clear();
return;
}
if (event.getEntityType() == EntityType.PLAYER)
drops.add(ItemStackFactory.Instance.CreateStack(Material.BONE, 1));

View File

@ -27,6 +27,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.EulerAngle;
import org.spigotmc.event.entity.EntityDismountEvent;
@ -559,6 +560,7 @@ public abstract class SiegeWeapon implements Listener
{
entity.setCustomName(Integer.toString(_uniqueId));
entity.setCustomNameVisible(false);
entity.setMetadata("Creature.DoNotDrop", new FixedMetadataValue(_clans.getPlugin(), true));
_comprisedOf.add(entity);
@ -569,6 +571,8 @@ public abstract class SiegeWeapon implements Listener
{
Entity entity = _entityMapping.get(uniqueName);
entity.removeMetadata("Creature.DoNotDrop", _clans.getPlugin());
_entityMapping.remove(uniqueName);
_comprisedOf.remove(entity);