[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 EntityLoadCrossbowEvent
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8f01ac5b6
index 0000000000000000000000000000000000000000..8434ea803e3135380f9351c82a414ccb65c478a9
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java
@@ -0,0 +1,98 @@
@@ -0,0 +1,96 @@
+package io.papermc.paper.event.entity;
+
+import org.bukkit.entity.LivingEntity;
@ -25,12 +25,14 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
+ * Called when a LivingEntity loads a crossbow with a projectile.
+ */
+public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final ItemStack crossbow;
+ private final EquipmentSlot hand;
+ private boolean cancelled;
+
+ private boolean consumeItem = true;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public EntityLoadCrossbowEvent(@NotNull LivingEntity entity, @NotNull ItemStack crossbow, @NotNull EquipmentSlot hand) {
@ -42,7 +44,7 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
+ @NotNull
+ @Override
+ public LivingEntity getEntity() {
+ return (LivingEntity) entity;
+ return (LivingEntity) super.getEntity();
+ }
+
+ /**
@ -52,7 +54,7 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
+ */
+ @NotNull
+ public ItemStack getCrossbow() {
+ return crossbow;
+ return this.crossbow;
+ }
+
+ /**
@ -62,19 +64,17 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
+ */
+ @NotNull
+ public EquipmentSlot getHand() {
+ return hand;
+ return this.hand;
+ }
+
+ /**
+ *
+ * @return should the itemstack be consumed
+ */
+ public boolean shouldConsumeItem() {
+ return consumeItem;
+ return this.consumeItem;
+ }
+
+ /**
+ *
+ * @param consume should the item be consumed
+ */
+ public void setConsumeItem(boolean consume) {
@ -83,14 +83,12 @@ index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ return this.cancelled;
+ }
+
+ /**
+ * Set whether or not to cancel the crossbow being loaded. If canceled, the
+ * Set whether to cancel the crossbow being loaded. If canceled, the
+ * projectile that would be loaded into the crossbow will not be consumed.
+ *
+ * @param cancel true if you wish to cancel this event
+ */
+ @Override
+ public void setCancelled(boolean cancel) {