Makes formatting on book signing require the format permission
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
This commit is contained in:
@@ -27,6 +27,11 @@ public enum Permission {
|
||||
*/
|
||||
DECRYPT("decrypt"),
|
||||
|
||||
/**
|
||||
* The permission for formatting a book's text either through the `/formatBook` command or automatically
|
||||
*/
|
||||
FORMAT("format"),
|
||||
|
||||
;
|
||||
|
||||
private final @NotNull String node;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.knarcraft.bookswithoutborders.listener;
|
||||
|
||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||
import net.knarcraft.bookswithoutborders.config.Permission;
|
||||
import net.knarcraft.bookswithoutborders.utility.BookFormatter;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -16,7 +17,8 @@ public class BookEventListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBookSign(@NotNull PlayerEditBookEvent event) {
|
||||
if (event.isCancelled() || !event.isSigning() || !BooksWithoutBorders.getConfiguration().formatBooks()) {
|
||||
if (event.isCancelled() || !event.isSigning() || !BooksWithoutBorders.getConfiguration().formatBooks() ||
|
||||
!event.getPlayer().hasPermission(Permission.FORMAT.toString())) {
|
||||
return;
|
||||
}
|
||||
event.setNewBookMeta(BookFormatter.formatPages(event.getNewBookMeta()));
|
||||
|
Reference in New Issue
Block a user