PlayerEditBookEvent
PlayerEditBookEvent
=> org.bukkit.event.Event
=> org.bukkit.event.player.PlayerEvent
=> org.bukkit.event.player.PlayerEditBookEvent
Called when a player edits or signs a book and quill item. If the event iscancelled, no changes are made to the BookMeta当玩家编辑一份书与笔物品堆的内容或在一份书与笔物品堆上签名时触发。如果本事件被取消,则涉事物品堆的BookMeta
不会改变。
方法声明: public BookMeta getPreviousBookMeta()
方法签名: ()Lorg/bukkit/inventory/meta/BookMeta;
Gets the book meta currently on the book.Note: this is a copy of the book meta. You cannot use this object tochange the existing book meta.@return the book meta currently on the book该方法用于获取书与笔物品堆修改前的现有BookMeta
。注意,该方法的返回值只是物品堆BookMeta
的一份副本。对这份副本进行任何修改都不会对涉事物品堆造成任何影响。@return 书与笔物品堆修改前的现有BookMeta
。
方法声明: public BookMeta getNewBookMeta()
方法签名: ()Lorg/bukkit/inventory/meta/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 {@link#setNewBookMeta(BookMeta)} to change what will actually be added to thebook.@return the book meta that the player is attempting to add该方法用于获取玩家修改以后的新BookMeta
。注意,该方法的返回值只是物品堆BookMeta
的一份副本。修改副本以后,调用setNewBookMeta(BookMeta)
方法可将修改体现在涉事物品 堆上。@return 玩家修改以后的新BookMeta
。
方法声明: public int getSlot()
方法签名: ()I
Gets the inventory slot number for the book item that triggered thisevent.This is a slot number on the player's hotbar in the range 0-8, or -1 foroff hand.@return the inventory slot number that the book item occupies@deprecated books may be signed from off hand该方法用于获取涉事书本物品堆所在的槽位序号。如果书本物品堆在玩家的快捷物品栏,则序号为0-8
,如果物品堆在玩家副手,则序号为-1
。@return 书本物品堆所在的槽位序号。@deprecated 书本物品堆可 能位于副手(参见译注)。译注:文档有误。最初并没有“签名副手所持的书与笔”这一操作,因此该方法一开始只返回0-8
的槽位序号,后来副手书与笔也可以被签名了,但该方法没有及时更新,仍然只能返回主手的快捷物品栏的槽位序号,因此被标记为过时(不支持副手)。再后来该方法得到了更新,当书与笔位于副手时返回-1
,因此它已经不再处于过时状态了。该方法的文档却未能与时俱进地修改。
方法声明: public void setNewBookMeta(@NotNull BookMeta newBookMeta) throws IllegalArgumentException
方法签名: (Lorg/bukkit/inventory/meta/BookMeta;)V
Sets the book meta that will actually be added to the book.@param newBookMeta new book meta@throws IllegalArgumentException if the new book meta is null该方法用于设置书与笔物品堆的新BookMeta
。此方法参数中的BookMeta
将会在游戏内被实际体现。@param newBookMeta 新BookMeta
。@deprecated 如果传入的参数为null
,则抛出IllegalArgumentException
。
方法声明: public boolean isSigning()
方法签名: ()Z
Gets whether or not the book is being signed. If a book is signed theMaterial changes from BOOK_AND_QUILL to WRITTEN_BOOK.@return true if the book is being signed该方法用于获取该书本是否要被签名。如果一本书被签名了,那么其材质将由BOOK_AND_QUILL
变为WRITTEN_BOOK
。@return 该书本是否要被签名,如果要被签名则返回true
。
方法声明: public void setSigning(boolean signing)
方法签名: (Z)V
Sets whether or not the book is being signed. If a book is signed theMaterial changes from BOOK_AND_QUILL to WRITTEN_BOOK.@param signing whether or not the book is being signed.该方法用于设置该书本是否要被签名。如果一本书被签名了,那么其材质将由BOOK_AND_QUILL
变为WRITTEN_BOOK
。@param signing 该书本是否要被签名。
方法声明: public HandlerList getHandlers()
方法签名: ()Lorg/bukkit/event/HandlerList;
方法声明: public static HandlerList getHandlerList()
方法签名: ()Lorg/bukkit/event/HandlerList;
方法声明: public boolean isCancelled()
方法签名: ()Z
方法声明: public void setCancelled(boolean cancel)
方法签名: (Z)V
Last modified 1mo ago