mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 11:18:23 +01:00
Update EntityChangeBlockEvent to new BlockData API
By: md_5 <git@md-5.net>
This commit is contained in:
parent
ab51d58f44
commit
e1107a65b2
2 changed files with 7 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue