[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002
2024-02-01 10:15:57 +01:00
parent d676979ea0
commit f7e469eb2e
187 changed files with 2415 additions and 2258 deletions

View File

@@ -18,6 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
@@ -25,8 +26,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Fired when a witch consumes the potion in their hand to buff themselves.
+ */
+public class WitchConsumePotionEvent extends EntityEvent implements Cancellable {
+ @Nullable private ItemStack potion;
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @Nullable private ItemStack potion;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public WitchConsumePotionEvent(@NotNull Witch witch, @Nullable ItemStack potion) {
+ super(witch);
+ this.potion = potion;
@@ -43,80 +49,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @Nullable
+ public ItemStack getPotion() {
+ return potion;
+ return this.potion;
+ }
+
+ /**
+ * Sets the potion to be consumed and applied to the witch.
+ *
+ * @param potion The potion
+ */
+ public void setPotion(@Nullable ItemStack potion) {
+ this.potion = potion != null ? potion.clone() : null;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private boolean cancelled = false;
+
+ /**
+ * @return Event was cancelled or potion was null
+ * @return Event was cancelled or potion was {@code null}
+ */
+ @Override
+ public boolean isCancelled() {
+ return cancelled || potion == null;
+ return this.cancelled || this.potion == null;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class WitchThrowPotionEvent extends Event implements Cancellable {
+ public WitchThrowPotionEvent() {
+ this.cancelled = cancel;
+ }
+
+
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private boolean cancelled = false;
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ return HANDLER_LIST;
+ }
+}