@@ -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;
|
||||
|
||||
@@ -410,7 +410,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
*/
|
||||
FLY_INTO_WALL,
|
||||
/**
|
||||
* Damage caused when an entity steps on {@link Material#MAGMA}.
|
||||
* Damage caused when an entity steps on {@link Material#MAGMA_BLOCK}.
|
||||
* <p>
|
||||
* Damage: 1
|
||||
*/
|
||||
@@ -421,6 +421,12 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
* <p>
|
||||
* Damage: 6
|
||||
*/
|
||||
CRAMMING
|
||||
CRAMMING,
|
||||
/**
|
||||
* Damage caused when an entity that should be in water is not.
|
||||
* <p>
|
||||
* Damage: 1
|
||||
*/
|
||||
DRYOUT
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
@@ -15,9 +15,9 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean cancel = false;
|
||||
private int exp;
|
||||
private final State state;
|
||||
private final Fish hookEntity;
|
||||
private final FishHook hookEntity;
|
||||
|
||||
public PlayerFishEvent(final Player player, final Entity entity, final Fish hookEntity, final State state) {
|
||||
public PlayerFishEvent(final Player player, final Entity entity, final FishHook hookEntity, final State state) {
|
||||
super(player);
|
||||
this.entity = entity;
|
||||
this.hookEntity = hookEntity;
|
||||
@@ -40,9 +40,9 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
/**
|
||||
* Gets the fishing hook.
|
||||
*
|
||||
* @return Fish the entity representing the fishing hook/bobber.
|
||||
* @return the entity representing the fishing hook/bobber.
|
||||
*/
|
||||
public Fish getHook() {
|
||||
public FishHook getHook() {
|
||||
return hookEntity;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ import org.bukkit.event.HandlerList;
|
||||
/**
|
||||
* Called when a player statistic is incremented.
|
||||
* <p>
|
||||
* This event is not called for {@link org.bukkit.Statistic#PLAY_ONE_TICK} or
|
||||
* movement based statistics.
|
||||
* This event is not called for some high frequency statistics, e.g. movement
|
||||
* based statistics.
|
||||
*
|
||||
*/
|
||||
public class PlayerStatisticIncrementEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
Reference in New Issue
Block a user