implement drops
This commit is contained in:
parent
f4f8f09a06
commit
1b18fc9ac0
1 changed files with 9 additions and 0 deletions
|
@ -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<Material, List<Integer>> 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue