Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

added ability to change drops in case of Entity death #200

Closed
wants to merge 1 commit into from

2 participants

@sunkid

This simply adds the ability to change what an entity drops after death.

@Dinnerbone
Owner

You can already set the drops. Replacing them entirely with this method will just encourage conflicts with plugins overwriting the drops set by another plugin.

@Dinnerbone Dinnerbone closed this
@sunkid

How can the drops be set for a player?

@Dinnerbone
Owner
List<ItemStack> drops = event.getDrops();
drops.add(new ItemStack(Material.APPLE));
drops.addAll(someInternalListOfDrops);
for (ItemStack drop : drops) {
    if (drop.getType() == Material.SAND) {
        drop.setType(Material.GLASS);
    }
}
@sunkid

Yeah, OK, well... blush

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 9, 2011
  1. @sunkid
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
View
8 src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
@@ -24,4 +24,12 @@ public EntityDeathEvent(final Entity what, final List<ItemStack> drops) {
public List<ItemStack> getDrops() {
return drops;
}
+
+ /**
+ * Set the items to be dropped by the dead entity
+ * @param drops Items to be dropped
+ */
+ public void setDrops(List<ItemStack> drops) {
+ this.drops = drops;
+ }
}
Something went wrong with that request. Please try again.