diff --git a/src/main/java/pl/minecon724/giants/Main.java b/src/main/java/pl/minecon724/giants/Main.java index 8db4296..16a065b 100644 --- a/src/main/java/pl/minecon724/giants/Main.java +++ b/src/main/java/pl/minecon724/giants/Main.java @@ -25,6 +25,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntitySpawnEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; @@ -160,6 +161,14 @@ public class Main extends JavaPlugin implements Listener { LivingEntity entity = e.getEntity(); if (entity.getType() == EntityType.GIANT) { giants.remove(entity); + for (Entry> d : drops.entrySet()) { + int max = d.getValue().get(0); + int min = d.getValue().get(1); + ItemStack is = new ItemStack(d.getKey(), rnd.nextInt((max - min) + 1) + min); + if (rnd.nextInt(100) < d.getValue().get(2)) { + entity.getWorld().dropItemNaturally(entity.getLocation(), is); + } + } for (Entity p : entity.getPassengers()) ((LivingEntity) p).setHealth(0); } }