类 BlockPlaceEvent
- 所有已实现的接口:
Cancellable
- 直接已知子类:
BlockMultiPlaceEvent
如果方块放置事件被取消,那么这个方块将不能被放置
-
嵌套类概要
从类继承的嵌套类/接口 org.bukkit.event.Event
Event.Result
-
字段概要
修饰符和类型字段说明protected boolean
protected boolean
protected EquipmentSlot
protected ItemStack
protected Block
protected Player
protected BlockState
从类继承的字段 org.bukkit.event.block.BlockEvent
block
-
构造器概要
构造器说明BlockPlaceEvent
(@NotNull Block placedBlock, @NotNull BlockState replacedBlockState, @NotNull Block placedAgainst, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild) 已过时。BlockPlaceEvent
(@NotNull Block placedBlock, @NotNull BlockState replacedBlockState, @NotNull Block placedAgainst, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild, @NotNull EquipmentSlot hand) -
方法概要
修饰符和类型方法说明boolean
canBuild()
获取这个方块是否可以建造.获取这个方块是依附在哪个方块上放置的.获得被放置的方块(还未真正被放置).获取被替换的方块的 BlockState.getHand()
获取放置这个方块的手.static @NotNull HandlerList
获取玩家放置的方块的物品形式(在玩家手上).获得放置这个方块的玩家.boolean
获取这个事件是否被取消.一个被取消的事件不会在服务器里执行,但是仍然会传递事件到其他插件.void
setBuild
(boolean canBuild) 设置这个方块是否可以被放置.void
setCancelled
(boolean cancel) 取消这个事件.从类继承的方法 org.bukkit.event.block.BlockEvent
getBlock
从类继承的方法 org.bukkit.event.Event
getEventName, isAsynchronous
-
字段详细资料
-
cancel
protected boolean cancel -
canBuild
protected boolean canBuild -
placedAgainst
-
replacedBlockState
-
itemInHand
-
player
-
hand
-
-
构造器详细资料
-
方法详细资料
-
isCancelled
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
在接口中Cancellable
- 返回:
- 如果事件已经被取消,则为true
-
setCancelled
public 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
在接口中Cancellable
- 参数:
cancel
- 如果你想取消这个事件,则为true
-
getPlayer
获得放置这个方块的玩家.原文:Gets the player who placed the block involved in this event.
- 返回:
- 放置这个方块的玩家
-
getBlockPlaced
获得被放置的方块(还未真正被放置).原文:Clarity method for getting the placed block. Not really needed except for reasons of clarity.
- 返回:
- 被放置后的方块
-
getBlockReplacedState
获取被替换的方块的 BlockState. 通常被替换的方块是空气.原文:Gets the BlockState for the block which was replaced. Material type air mostly.
- 返回:
- 被替换的方块的 BlockState.
-
getBlockAgainst
获取这个方块是依附在哪个方块上放置的.原文:Gets the block that this block was placed against
- 返回:
- 放置时依附的方块
-
getItemInHand
获取玩家放置的方块的物品形式(在玩家手上).原文:Gets the item in the player's hand when they placed the block.
- 返回:
- 这个方块的ItemStack对象
-
getHand
获取放置这个方块的手.原文:Gets the hand which placed the block
- 返回:
- 主手或副手,取决于放置方块所用的手
-
canBuild
public boolean canBuild()获取这个方块是否可以建造.默认情况下,如果玩家还在重生/生成时服务器将阻止它们. 注意,这跟BLOCK_CANBUILD是完全不同的检测.这是指玩家而不是像仙人掌一样的物理现象.
原文:Gets the value whether the player would be allowed to build here. Defaults to spawn if the server was going to stop them (such as, the player is in Spawn). Note that this is an entirely different check than BLOCK_CANBUILD, as this refers to a player, not universe-physics rule like cactus on dirt.
- 返回:
- boolean 服务器是否允许此方块的建造
-
setBuild
public void setBuild(boolean canBuild) 设置这个方块是否可以被放置.原文:Sets the canBuild state of this event. Set to true if you want the player to be able to build
- 参数:
canBuild
- 是否允许玩家放置这个方块
-
getHandlers
- 指定者:
getHandlers
在类中Event
-
getHandlerList
-