类 PlayerEditBookEvent

所有已实现的接口:
Cancellable

public class PlayerEditBookEvent extends PlayerEvent implements Cancellable
当玩家编辑或签名书与笔时触发。如果事件中断取消,书与笔的元数据不会改变。
  • 构造器详细资料

    • PlayerEditBookEvent

      public PlayerEditBookEvent(Player who, int slot, BookMeta previousBookMeta, BookMeta newBookMeta, boolean isSigning)
  • 方法详细资料

    • getPreviousBookMeta

      public BookMeta getPreviousBookMeta()
      获取当前书本元数据。

      注意:获取书本的元数据副本。你无法使用该对象来修改书本元数据。

      原文:Gets the book meta currently on the book.

      Note: this is a copy of the book meta. You cannot use this object to change the existing book meta.

      返回:
      当前书本的元数据
    • getNewBookMeta

      public BookMeta getNewBookMeta()
      获取玩家试图新增的书本元数据。

      注意:获取的元数据为副本。使用 setNewBookMeta(BookMeta)修改实际想要更新的书本元数据

      原文:Gets the book meta that the player is attempting to add to the book.

      Note: this is a copy of the proposed new book meta. Use setNewBookMeta(BookMeta) to change what will actually be added to the

      返回:
      玩家试图新增的书本元数据
    • getSlot

      public int getSlot()
      获取触发事件时,书本在物品栏所在的格子序号。

      对应为玩家快捷操作栏,取值范围 0-8。

      原文:Gets the inventory slot number for the book item that triggered this event.

      This is a slot number on the player's hotbar in the range 0-8.

      返回:
      事件中书本在玩家物品栏所占用的格子序号
    • setNewBookMeta

      public void setNewBookMeta(BookMeta newBookMeta) throws IllegalArgumentException
      设置新增的书本元数据。

      原文:Sets the book meta that will actually be added to the book.

      参数:
      newBookMeta - 构造书本元数据
      抛出:
      IllegalArgumentException - 当构造的书本元数据不为空值时抛出异常
    • isSigning

      public boolean isSigning()
      检测书本是否正在被签名。如果正在签名,书与笔将转变为成书。

      原文:Gets whether or not the book is being signed. If a book is signed the Material changes from BOOK_AND_QUILL to WRITTEN_BOOK.

      返回:
      当书本正在被签名时,返回true。
    • setSigning

      public void setSigning(boolean signing)
      设置书本是否正在被签名。如果正在签名,书与笔将转变为成书。

      原文:Sets whether or not the book is being signed. If a book is signed the Material changes from BOOK_AND_QUILL to WRITTEN_BOOK.

      参数:
      signing - 书本是否正在被签名
    • getHandlers

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

      public static HandlerList getHandlerList()
    • 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