summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorAndrew Ardill <andrew.ardill@gmail.com>2011-11-29 20:50:38 +1100
committerAndrew Ardill <andrew.ardill@gmail.com>2011-11-29 20:56:08 +1100
commit4595a700568f290f848e46a436cf4347343be6da (patch)
treec5ae09d650ce9279a008b86082db093d781faa55 /src/main
parent1b5dc772b35598fd0b60ab55ba274f5bd2df24e4 (diff)
downloadbukkit-4595a700568f290f848e46a436cf4347343be6da.tar
bukkit-4595a700568f290f848e46a436cf4347343be6da.tar.gz
bukkit-4595a700568f290f848e46a436cf4347343be6da.tar.lz
bukkit-4595a700568f290f848e46a436cf4347343be6da.tar.xz
bukkit-4595a700568f290f848e46a436cf4347343be6da.zip
Extend EntityCombustEvent to allow setting combustion duration.
Also extend with two new events that track the entity or block that caused the combustion.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/entity/Projectile.java2
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityCombustByBlockEvent.java24
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityCombustByEntityEvent.java21
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityCombustEvent.java25
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityListener.java2
5 files changed, 70 insertions, 4 deletions
diff --git a/src/main/java/org/bukkit/entity/Projectile.java b/src/main/java/org/bukkit/entity/Projectile.java
index 95aae5f9..c8212540 100644
--- a/src/main/java/org/bukkit/entity/Projectile.java
+++ b/src/main/java/org/bukkit/entity/Projectile.java
@@ -25,6 +25,8 @@ public interface Projectile extends Entity {
/**
* Determine if this projectile should bounce or not when it hits.
*
+ * If a small fireball does not bounce it will set the target on fire.
+ *
* @return true if it should bounce.
*/
public boolean doesBounce();
diff --git a/src/main/java/org/bukkit/event/entity/EntityCombustByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityCombustByBlockEvent.java
new file mode 100644
index 00000000..addb42fd
--- /dev/null
+++ b/src/main/java/org/bukkit/event/entity/EntityCombustByBlockEvent.java
@@ -0,0 +1,24 @@
+package org.bukkit.event.entity;
+
+import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
+
+public class EntityCombustByBlockEvent extends EntityCombustEvent {
+
+ private Block combuster;
+
+ public EntityCombustByBlockEvent(Block combuster, Entity combustee, int duration) {
+ super(combustee, duration);
+ this.combuster = combuster;
+ }
+
+ /**
+ * The combuster can be lava or a block that is on fire.
+ *
+ * WARNING: block may be null.
+ * @return the Block that set the combustee alight.
+ */
+ public Block getCombuster() {
+ return combuster;
+ }
+}
diff --git a/src/main/java/org/bukkit/event/entity/EntityCombustByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityCombustByEntityEvent.java
new file mode 100644
index 00000000..15ab75f1
--- /dev/null
+++ b/src/main/java/org/bukkit/event/entity/EntityCombustByEntityEvent.java
@@ -0,0 +1,21 @@
+package org.bukkit.event.entity;
+
+import org.bukkit.entity.Entity;
+
+public class EntityCombustByEntityEvent extends EntityCombustEvent {
+
+ private Entity combuster;
+
+ public EntityCombustByEntityEvent(Entity combuster, Entity combustee, int duration) {
+ super(combustee, duration);
+ this.combuster = combuster;
+ }
+
+ /**
+ * The combuster can be a WeatherStorm a Blaze, or an Entity holding a FIRE_ASPECT enchanted item.
+ * @return the Entity that set the combustee alight.
+ */
+ public Entity getCombuster() {
+ return combuster;
+ }
+}
diff --git a/src/main/java/org/bukkit/event/entity/EntityCombustEvent.java b/src/main/java/org/bukkit/event/entity/EntityCombustEvent.java
index 0587576e..9b3f38f3 100644
--- a/src/main/java/org/bukkit/event/entity/EntityCombustEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityCombustEvent.java
@@ -4,15 +4,17 @@ import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable;
/**
- * Called when an entity combusts due to the sun.
+ * Called when an entity combusts.
*<p />
* If an Entity Combust event is cancelled, the entity will not combust.
*/
public class EntityCombustEvent extends EntityEvent implements Cancellable {
+ private int duration;
private boolean cancel;
- public EntityCombustEvent(Entity what) {
- super(Type.ENTITY_COMBUST, what);
+ public EntityCombustEvent(Entity combustee, int duration) {
+ super(Type.ENTITY_COMBUST, combustee);
+ this.duration = duration;
this.cancel = false;
}
@@ -23,4 +25,21 @@ public class EntityCombustEvent extends EntityEvent implements Cancellable {
public void setCancelled(boolean cancel) {
this.cancel = cancel;
}
+
+ /**
+ * @return the amount of time (in seconds) the combustee should be alight for
+ */
+ public int getDuration() {
+ return duration;
+ }
+
+ /**
+ * The number of seconds the combustee should be alight for.
+ *
+ * This value will only ever increase the combustion time, not decrease existing combustion times.
+ * @param duration the time in seconds to be alight for.
+ */
+ public void setDuration(int duration) {
+ this.duration = duration;
+ }
}
diff --git a/src/main/java/org/bukkit/event/entity/EntityListener.java b/src/main/java/org/bukkit/event/entity/EntityListener.java
index c325cb37..3e8db64e 100644
--- a/src/main/java/org/bukkit/event/entity/EntityListener.java
+++ b/src/main/java/org/bukkit/event/entity/EntityListener.java
@@ -27,7 +27,7 @@ public class EntityListener implements Listener {
public void onItemSpawn(ItemSpawnEvent event) {}
/**
- * Called when an entity combusts due to the sun.
+ * Called when an entity combusts.
*<p />
* If an Entity Combust event is cancelled, the entity will not combust.
*