geforkt von Mirrors/Paper
[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). By: Wesley Wolfe <weswolf@aol.com>
Dieser Commit ist enthalten in:
Ursprung
89d79e64db
Commit
f545b84e46
@ -12,6 +12,11 @@ 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);
|
super(entity, targetBlock, Material.AIR, (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LivingEntity getEntity() {
|
||||||
|
return (LivingEntity) entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,13 @@ 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.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a LivingEntity changes a block
|
* Called when any Entity, excluding players, changes a block.
|
||||||
*
|
|
||||||
* This event specifically excludes player entities
|
|
||||||
*/
|
*/
|
||||||
public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
|
public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
@ -18,11 +17,26 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
|
|||||||
private final Material to;
|
private final Material to;
|
||||||
private final byte data;
|
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) {
|
public EntityChangeBlockEvent(final LivingEntity what, final Block block, final Material to) {
|
||||||
this (what, block, to, (byte) 0);
|
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);
|
super(what);
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.cancel = false;
|
this.cancel = false;
|
||||||
@ -30,11 +44,6 @@ public class EntityChangeBlockEvent extends EntityEvent implements Cancellable {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public LivingEntity getEntity() {
|
|
||||||
return (LivingEntity) entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the block the entity is changing
|
* Gets the block the entity is changing
|
||||||
*
|
*
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren