[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002 2024-02-01 10:15:57 +01:00 committed by GitHub
parent b3c81089ae
commit 294347bee2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
295 changed files with 3245 additions and 3088 deletions

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6522eb262
index 0000000000000000000000000000000000000000..c38ac6d0e0ac4ecbdc73d2bedd7731ff34c9d192
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java
@@ -0,0 +1,84 @@
@@ -0,0 +1,89 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.NamespacedKey;
@ -17,17 +17,22 @@ index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a player clicks a recipe in the recipe book
+ */
+public class PlayerRecipeBookClickEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancel = false;
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private NamespacedKey recipe;
+ private boolean makeAll;
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public PlayerRecipeBookClickEvent(@NotNull Player player, @NotNull NamespacedKey recipe, boolean makeAll) {
+ super(player);
+ this.recipe = recipe;
@ -41,7 +46,7 @@ index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6
+ */
+ @NotNull
+ public NamespacedKey getRecipe() {
+ return recipe;
+ return this.recipe;
+ }
+
+ /**
@ -54,17 +59,17 @@ index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6
+ }
+
+ /**
+ * Gets a boolean which indicates whether or not the player requested to make the maximum amount of results. This is
+ * true if shift is pressed while the recipe is clicked in the recipe book
+ * Gets a boolean which indicates whether the player requested to make the maximum amount of results. This is
+ * {@code true} if shift is pressed while the recipe is clicked in the recipe book
+ *
+ * @return {@code true} if shift is pressed while the recipe is clicked
+ */
+ public boolean isMakeAll() {
+ return makeAll;
+ return this.makeAll;
+ }
+
+ /**
+ * Sets whether or not the maximum amount of results should be made. If this is true, the request is handled as if
+ * Sets whether the maximum amount of results should be made. If this is {@code true}, the request is handled as if
+ * the player had pressed shift while clicking on the recipe
+ *
+ * @param makeAll {@code true} if the request should attempt to make the maximum amount of results
@ -75,23 +80,23 @@ index 0000000000000000000000000000000000000000..7fa937d339ee98ad308deebb523fead6
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}
diff --git a/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java