mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 19:55:52 -07:00
Update EntityChangeBlockEvent to new BlockData API
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -12,7 +12,7 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
*/
|
*/
|
||||||
public class EntityBreakDoorEvent extends EntityChangeBlockEvent {
|
public class EntityBreakDoorEvent extends EntityChangeBlockEvent {
|
||||||
public EntityBreakDoorEvent(final LivingEntity entity, final Block targetBlock) {
|
public EntityBreakDoorEvent(final LivingEntity entity, final Block targetBlock) {
|
||||||
super(entity, targetBlock, Material.AIR, (byte) 0);
|
super(entity, targetBlock, Material.AIR.createBlockData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -2,6 +2,7 @@ package org.bukkit.event.entity;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@@ -13,24 +14,13 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
|
|||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final Block block;
|
private final Block block;
|
||||||
private boolean cancel;
|
private boolean cancel;
|
||||||
private final Material to;
|
private final BlockData to;
|
||||||
private final byte data;
|
|
||||||
|
|
||||||
/**
|
public EntityChangeBlockEvent(final Entity what, final Block block, 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) {
|
|
||||||
super(what);
|
super(what);
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.cancel = false;
|
this.cancel = false;
|
||||||
this.to = to;
|
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
|
* @return the material that the block is changing into
|
||||||
*/
|
*/
|
||||||
public Material getTo() {
|
public Material getTo() {
|
||||||
return to;
|
return to.getMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the data for the block that would be changed into
|
* Gets the data for the block that would be changed into
|
||||||
*
|
*
|
||||||
* @return 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 BlockData getBlockData() {
|
||||||
public byte getData() {
|
return to;
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user