summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-07-20 10:29:27 +1000
committermd_5 <git@md-5.net>2018-07-20 10:29:27 +1000
commitd3b2e69dbd23ae87e159f8bafb2373f5c3a12a57 (patch)
tree217b8189bf2ddf99ed59d7467a8d3ef2dcc59688
parent6014108495394835c6c168d7604818bca3d2e869 (diff)
downloadbukkit-d3b2e69dbd23ae87e159f8bafb2373f5c3a12a57.tar
bukkit-d3b2e69dbd23ae87e159f8bafb2373f5c3a12a57.tar.gz
bukkit-d3b2e69dbd23ae87e159f8bafb2373f5c3a12a57.tar.lz
bukkit-d3b2e69dbd23ae87e159f8bafb2373f5c3a12a57.tar.xz
bukkit-d3b2e69dbd23ae87e159f8bafb2373f5c3a12a57.zip
Update EntityChangeBlockEvent to new BlockData API
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java2
-rw-r--r--src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java24
2 files changed, 7 insertions, 19 deletions
diff --git a/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java b/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java
index 2cbbc697..b877f1ba 100644
--- a/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java
@@ -12,7 +12,7 @@ import org.bukkit.entity.LivingEntity;
*/
public class EntityBreakDoorEvent extends EntityChangeBlockEvent {
public EntityBreakDoorEvent(final LivingEntity entity, final Block targetBlock) {
- super(entity, targetBlock, Material.AIR, (byte) 0);
+ super(entity, targetBlock, Material.AIR.createBlockData());
}
@Override
diff --git a/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java
index 9f69ded6..0fa1d0ce 100644
--- a/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityChangeBlockEvent.java
@@ -2,6 +2,7 @@ package org.bukkit.event.entity;
import org.bukkit.Material;
import org.bukkit.block.Block;
+import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@@ -13,24 +14,13 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final Block block;
private boolean cancel;
- private final Material to;
- private final byte data;
+ private final BlockData to;
- /**
- *
- * @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
- * @deprecated Magic value
- */
- @Deprecated
- public EntityChangeBlockEvent(final Entity what, final Block block, final Material to, final byte data) {
+ public EntityChangeBlockEvent(final Entity what, final Block block, final BlockData to) {
super(what);
this.block = block;
this.cancel = false;
this.to = to;
- this.data = data;
}
/**
@@ -56,18 +46,16 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
* @return the material that the block is changing into
*/
public Material getTo() {
- return to;
+ return to.getMaterial();
}
/**
* Gets the data for the block that would be changed into
*
* @return the data for the block that would be changed into
- * @deprecated Magic value
*/
- @Deprecated
- public byte getData() {
- return data;
+ public BlockData getBlockData() {
+ return to;
}
@Override