From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Wed, 23 Dec 2020 00:43:27 -0600
Subject: [PATCH] PlayerBookTooLargeEvent


diff --git a/src/main/java/net/pl3x/purpur/event/player/PlayerBookTooLargeEvent.java b/src/main/java/net/pl3x/purpur/event/player/PlayerBookTooLargeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..39378ee2bfadf42ff358cc7b42dd75ac61615e15
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/player/PlayerBookTooLargeEvent.java
@@ -0,0 +1,65 @@
+package net.pl3x.purpur.event.player;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a player tries to bypass book limitations
+ */
+public class PlayerBookTooLargeEvent extends PlayerEvent {
+    private static final HandlerList handlers = new HandlerList();
+    private final ItemStack book;
+    private boolean kickPlayer = true;
+
+    /**
+     * @param player The player
+     * @param book The book
+     */
+    public PlayerBookTooLargeEvent(@NotNull Player player, @NotNull ItemStack book) {
+        super(player, !Bukkit.isPrimaryThread());
+        this.book = book;
+    }
+
+    /**
+     * Get the book containing the wanted edits
+     *
+     * @return The book
+     */
+    @NotNull
+    public ItemStack getBook() {
+        return book;
+    }
+
+    /**
+     * Whether server should kick the player or not
+     *
+     * @return True to kick player
+     */
+    public boolean shouldKickPlayer() {
+        return kickPlayer;
+    }
+
+    /**
+     * Whether server should kick the player or not
+     *
+     * @param kickPlayer True to kick player
+     */
+    public void setShouldKickPlayer(boolean kickPlayer) {
+        this.kickPlayer = kickPlayer;
+    }
+
+    @Override
+    @NotNull
+    public HandlerList getHandlers() {
+        return handlers;
+    }
+
+    @NotNull
+    public static HandlerList getHandlerList() {
+        return handlers;
+    }
+}
