类 BlockPhysicsEvent

所有已实现的接口:
Cancellable

public class BlockPhysicsEvent extends BlockEvent implements Cancellable
方块物理事件(例如是沙子掉落、流水).
这是一个高频率事件, 在一个繁忙的服务器上, 一秒内本事件可能会触发上千次. 建议插件小心监听此事件, 当使用本事件时仅执行一些轻量级的检查.
另外, 取消此事件可能会使事件陷入一个不合常理的状态(看起来就像世界末日). 例如, 如果你使用此事件在当该方块需要附着到某个东西上时其使悬浮在半空中, 那么无法保证在服务器重启后或地图更新后 此悬浮的方块能保持不变 (就是当方块发生物理变化时尝试改变它们会出现一些未知后果的意思, 具体自己测一下啦).
插件也应当注意, 在可能的情况下, 该事件可能只会因"根源"方块的物理(状态)更新而被调用以限制事件的频繁调用. 导致其它方块状态改变的物理更新可能不会引起其它方块(通常是相邻的方块)的事件. 如果你担忧监听这些改变(可能会产生较大开销), 那么你应该自己检查相邻的方块.

原文: Thrown when a block physics check is called.
This event is a high frequency event, it may be called thousands of times per a second on a busy server. Plugins are advised to listen to the event with caution and only perform lightweight checks when using it.
In addition to this, cancelling the event is liable to leave the world in an inconsistent state. For example if you use the event to leave a block floating in mid air when that block has a requirement to be attached to something, there is no guarantee that the floating block will persist across server restarts or map upgrades.
Plugins should also note that where possible this event may only called for the "root" block of physics updates in order to limit event spam. Physics updates that cause other blocks to change their state may not result in an event for each of those blocks (usually adjacent). If you are concerned about monitoring these changes then you should check adjacent blocks yourself.

  • 构造器详细资料

  • 方法详细资料

    • getSourceBlock

      @NotNull public @NotNull Block getSourceBlock()
      获取触发本事件的源方块. 注意:

      原文:Gets the source block that triggered this event. Note: This will default to block if not set.

      返回:
      源方块
    • getChangedType

      @NotNull public @NotNull Material getChangedType()
      获取事件中被改变的方块.

      原文:Gets the type of block that changed, causing this event

      返回:
      事件中被改变的方块的种类
    • 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
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      指定者:
      getHandlers 在类中 Event
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()