@@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
@@ -12,32 +13,25 @@ import org.bukkit.event.HandlerList;
|
||||
* <li>The Block returned by getBlock() is the block we are trying to place
|
||||
* on, not the block we are trying to place.
|
||||
* <li>If you want to figure out what is being placed, use {@link
|
||||
* #getMaterial()} or {@link #getMaterialId()} instead.
|
||||
* #getMaterial()} instead.
|
||||
* </ul>
|
||||
*/
|
||||
public class BlockCanBuildEvent extends BlockEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
protected boolean buildable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated
|
||||
protected int material;
|
||||
protected BlockData blockData;
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated Magic value
|
||||
* @param block the block involved in this event
|
||||
* @param id the id of the block to place
|
||||
* @param type the id of the block to place
|
||||
* @param canBuild whether we can build
|
||||
*/
|
||||
@Deprecated
|
||||
public BlockCanBuildEvent(final Block block, final int id, final boolean canBuild) {
|
||||
public BlockCanBuildEvent(final Block block, final BlockData type, final boolean canBuild) {
|
||||
super(block);
|
||||
buildable = canBuild;
|
||||
material = id;
|
||||
blockData = type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,18 +62,7 @@ public class BlockCanBuildEvent extends BlockEvent {
|
||||
* @return The Material that we are trying to place
|
||||
*/
|
||||
public Material getMaterial() {
|
||||
return Material.getMaterial(material);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Material ID for the Material that we are trying to place.
|
||||
*
|
||||
* @return The Material ID for the Material that we are trying to place
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMaterialId() {
|
||||
return material;
|
||||
return blockData.getMaterial();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.event.block;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@@ -10,39 +11,27 @@ import org.bukkit.event.HandlerList;
|
||||
*/
|
||||
public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final int changed;
|
||||
private final BlockData changed;
|
||||
private boolean cancel = false;
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated Magic value
|
||||
* @param block the block involved in this event
|
||||
* @param changed the changed block's type id
|
||||
* @param changed the changed block's type
|
||||
*/
|
||||
@Deprecated
|
||||
public BlockPhysicsEvent(final Block block, final int changed) {
|
||||
public BlockPhysicsEvent(final Block block, final BlockData changed) {
|
||||
super(block);
|
||||
this.changed = changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of block that changed, causing this event
|
||||
*
|
||||
* @return Changed block's type id
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
@Deprecated
|
||||
public int getChangedTypeId() {
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of block that changed, causing this event
|
||||
*
|
||||
* @return Changed block's type
|
||||
*/
|
||||
public Material getChangedType() {
|
||||
return Material.getMaterial(changed);
|
||||
return changed.getMaterial();
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class BlockPistonEvent extends BlockEvent implements Cancellable
|
||||
* @return stickiness of the piston
|
||||
*/
|
||||
public boolean isSticky() {
|
||||
return block.getType() == Material.PISTON_STICKY_BASE || block.getType() == Material.PISTON_MOVING_PIECE;
|
||||
return block.getType() == Material.STICKY_PISTON || block.getType() == Material.MOVING_PISTON;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,9 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
|
||||
* Overrides the {@link Instrument} to be used.
|
||||
*
|
||||
* @param instrument the Instrument. Has no effect if null.
|
||||
* @deprecated no effect on newer Minecraft versions
|
||||
*/
|
||||
@Deprecated
|
||||
public void setInstrument(Instrument instrument) {
|
||||
if (instrument != null) {
|
||||
this.instrument = instrument;
|
||||
@@ -65,7 +67,9 @@ public class NotePlayEvent extends BlockEvent implements Cancellable {
|
||||
* Overrides the {@link Note} to be played.
|
||||
*
|
||||
* @param note the Note. Has no effect if null.
|
||||
* @deprecated no effect on newer Minecraft versions
|
||||
*/
|
||||
@Deprecated
|
||||
public void setNote(Note note) {
|
||||
if (note != null) {
|
||||
this.note = note;
|
||||
|
||||
Reference in New Issue
Block a user