summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorWesley Wolfe <weswolf@aol.com>2012-11-30 12:08:30 -0600
committerWesley Wolfe <weswolf@aol.com>2012-12-04 22:17:03 -0600
commitaddfe146de945e26dffc50930eb6fa6bd24c91f4 (patch)
treecfd7af8fa0a0d90ae180852eae755c030ee813eb /src/main/java/org
parentccf33ccdfbcaad4be59c7e2f27098e46803e0b76 (diff)
downloadbukkit-addfe146de945e26dffc50930eb6fa6bd24c91f4.tar
bukkit-addfe146de945e26dffc50930eb6fa6bd24c91f4.tar.gz
bukkit-addfe146de945e26dffc50930eb6fa6bd24c91f4.tar.lz
bukkit-addfe146de945e26dffc50930eb6fa6bd24c91f4.tar.xz
bukkit-addfe146de945e26dffc50930eb6fa6bd24c91f4.zip
[BREAKING] EntityChangeBlockEvent can be non-living. Adds BUKKIT-3078
Non-living entities can change blocks, specifically falling blocks. This change is a small source break, but mainly a byte-code break (requires plugins to recompile).
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java7
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java27
2 files changed, 24 insertions, 10 deletions
diff --git a/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java b/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java
index 8e39c03c..263837a6 100644
--- a/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java
@@ -12,6 +12,11 @@ import org.bukkit.entity.LivingEntity;
*/
public class EntityBreakDoorEvent extends EntityChangeBlockEvent {
public EntityBreakDoorEvent(final LivingEntity entity, final Block targetBlock) {
- super(entity, targetBlock, Material.AIR);
+ super(entity, targetBlock, Material.AIR, (byte) 0);
+ }
+
+ @Override
+ public LivingEntity getEntity() {
+ return (LivingEntity) entity;
}
}
diff --git a/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java
index d2b03f48..a18d11f9 100644
--- a/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java
@@ -2,14 +2,13 @@ package org.bukkit.event.entity;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/**
- * Called when a LivingEntity changes a block
- *
- * This event specifically excludes player entities
+ * Called when any Entity, excluding players, changes a block.
*/
public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@@ -18,11 +17,26 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
private final Material to;
private final byte data;
+ /**
+ *
+ * @param what the LivingEntity causing the change
+ * @param block the block (before the change)
+ * @param to the future material being changed to
+ * @deprecated Provided as a backward compatibility before the data byte was provided, and type increased to all entities
+ */
+ @Deprecated
public EntityChangeBlockEvent(final LivingEntity what, final Block block, final Material to) {
this (what, block, to, (byte) 0);
}
- public EntityChangeBlockEvent(final LivingEntity what, final Block block, final Material to, final byte data) {
+ /**
+ *
+ * @param what the Entity causing the change
+ * @param block the block (before the change)
+ * @param to the future material being changed to
+ * @param data the future block data
+ */
+ public EntityChangeBlockEvent(final Entity what, final Block block, final Material to, final byte data) {
super(what);
this.block = block;
this.cancel = false;
@@ -30,11 +44,6 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
this.data = data;
}
- @Override
- public LivingEntity getEntity() {
- return (LivingEntity) entity;
- }
-
/**
* Gets the block the entity is changing
*