From dc86362c9ad7c4c617640cdc1a17cb423921e7a1 Mon Sep 17 00:00:00 2001 From: Wesley Wolfe Date: Fri, 6 Dec 2013 00:05:23 -0600 Subject: [PATCH] Implement Firework.detonate(). Adds BUKKIT-4538 This implements the detonate method from bukkit by setting the fuse timer to 0. This makes a firework explode using the normal codepath, but without waiting for the fuse. --- .../java/org/bukkit/craftbukkit/entity/CraftFirework.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index 7082d62550..5437d8598e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java @@ -47,14 +47,17 @@ public class CraftFirework extends CraftEntity implements Firework { return "CraftFirework"; } + @Override public EntityType getType() { return EntityType.FIREWORK; } + @Override public FireworkMeta getFireworkMeta() { return (FireworkMeta) item.getItemMeta(); } + @Override public void setFireworkMeta(FireworkMeta meta) { item.setItemMeta(meta); @@ -63,4 +66,9 @@ public class CraftFirework extends CraftEntity implements Firework { getHandle().getDataWatcher().h(FIREWORK_ITEM_INDEX); // Update } + + @Override + public void detonate() { + getHandle().expectedLifespan = 0; + } }