public class BlockDispenseEvent extends BlockEvent implements Cancellable
取消该事件, 物品就不会被射出.
Event.Resultblock| 构造器和说明 |
|---|
BlockDispenseEvent(Block block,
ItemStack dispensed,
Vector velocity) |
| 限定符和类型 | 方法和说明 |
|---|---|
static HandlerList |
getHandlerList() |
HandlerList |
getHandlers() |
ItemStack |
getItem()
获取被射出的物品.
|
Vector |
getVelocity()
获取物品射出的速度、角度.
|
boolean |
isCancelled()
获取这个事件是否被取消.一个被取消的事件不会在服务器里被执行,但是仍然会传递事件到其他插件。
|
void |
setCancelled(boolean cancel)
取消这个事件.
|
void |
setItem(ItemStack item)
设置被射出的物品.
|
void |
setVelocity(Vector vel)
设置物品射出的速度、角度.
|
getBlockgetEventName, isAsynchronouspublic ItemStack getItem()
注意:修改返回的item对象没用, 必须用 setItem(org.bukkit.inventory.ItemStack) 代替.
原文:Gets the item that is being dispensed. Modifying the returned item will
have no effect, you must use setItem(org.bukkit.inventory.ItemStack) instead.
public void setItem(ItemStack item)
原文:Sets the item being dispensed.
item - 被射出的物品public Vector getVelocity()
注意: 修改返回的对象并不会修改速度, 必须
用setVelocity(org.bukkit.util.Vector) 代替.
原文:Gets the velocity.
Note: Modifying the returned Vector will not change the velocity, you
must use setVelocity(org.bukkit.util.Vector) instead.
public void setVelocity(Vector vel)
原文:Sets the velocity of the item being dispensed.
vel - 射出的物品的速度、角度.public boolean isCancelled()
Cancellable原文:Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins
isCancelled 在接口中 Cancellablepublic void setCancelled(boolean cancel)
Cancellable原文:Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
setCancelled 在接口中 Cancellablecancel - 如果你想取消这个事件,则为truepublic HandlerList getHandlers()
getHandlers 在类中 Eventpublic static HandlerList getHandlerList()