Class endstone::PlayerEditBookEvent¶
ClassList > endstone > PlayerEditBookEvent
Called when a player edits or signs a book.
#include <endstone/event/player/player_edit_book_event.h>
Inherits the following classes: endstone::Cancellable
Public Functions¶
| Type | Name |
|---|---|
| ENDSTONE_EVENT (PlayerEditBookEvent) |
|
| PlayerEditBookEvent (const NotNull< Player > & player, int slot, const NotNull< BookMeta > & previous_book_meta, const NotNull< BookMeta > & new_book_meta, bool signing) |
|
| NotNull< BookMeta > | getNewBookMeta () const Gets a copy of the metadata that the player is attempting to add to the book. |
| NotNull< BookMeta > | getPreviousBookMeta () const Gets a copy of the metadata before the edit. |
| int | getSlot () const Gets the inventory slot containing the book. |
| bool | isSigning () const Gets whether the book should be signed. |
| void | setNewBookMeta (const NotNull< BookMeta > & new_book_meta) Replaces the metadata that will be applied after the edit. |
| void | setSigning (bool signing) Sets whether the book should be signed. |
Public Functions inherited from endstone::Cancellable¶
| Type | Name |
|---|---|
| virtual void | cancel () Cancel this event. |
| virtual bool | isCancelled () override const Gets the cancellation state of this event. |
| virtual void | setCancelled (bool cancel) override Sets the cancellation state of this event. |
Public Functions inherited from endstone::ICancellable¶
| Type | Name |
|---|---|
| virtual void | cancel () = 0 Cancels this event. |
| virtual bool | isCancelled () const = 0 Gets the cancellation state of this event. |
| virtual void | setCancelled (bool cancel) = 0 Sets the cancellation state of this event. |
| virtual | ~ICancellable () = default |
Public Functions Documentation¶
function ENDSTONE_EVENT¶
function PlayerEditBookEvent¶
inline endstone::PlayerEditBookEvent::PlayerEditBookEvent (
const NotNull < Player > & player,
int slot,
const NotNull < BookMeta > & previous_book_meta,
const NotNull < BookMeta > & new_book_meta,
bool signing
)
function getNewBookMeta¶
Gets a copy of the metadata that the player is attempting to add to the book.
Note:
This is a copy: use setNewBookMeta() to change what will actually be added to the book.
A title, an author and a generation are only written when the book is being signed. On a plain edit the book stays a book and quill, which holds none of them, and they are dropped. See isSigning().
Returns:
the book metadata after the edit
function getPreviousBookMeta¶
Gets a copy of the metadata before the edit.
Note:
This is a copy: changes made to it are not written back to the book.
Returns:
the book metadata before the edit
function getSlot¶
Gets the inventory slot containing the book.
Returns:
the inventory slot containing the book
function isSigning¶
Gets whether the book should be signed.
Returns:
true if the book should be signed
function setNewBookMeta¶
Replaces the metadata that will be applied after the edit.
inline void endstone::PlayerEditBookEvent::setNewBookMeta (
const NotNull < BookMeta > & new_book_meta
)
Parameters:
new_book_metathe metadata to apply after the edit
function setSigning¶
Sets whether the book should be signed.
Parameters:
signingtrue to sign the book, false to leave it unsigned
The documentation for this class was generated from the following file include/endstone/event/player/player_edit_book_event.h