Swap some nullable annotations (#9696)

This commit is contained in:
Lulu13022002 2023-09-14 12:44:12 +02:00 committed by GitHub
commit eea0c649ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 186 additions and 72 deletions

View file

@ -6,33 +6,34 @@ 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..aa9ccd7c806e864455ecd5f15ddb17c0fa8728c4
index 0000000000000000000000000000000000000000..66e41bfe89f35d3947ea47aedcd36ac8f01ac5b6
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java
@@ -0,0 +1,97 @@
@@ -0,0 +1,98 @@
+package io.papermc.paper.event.entity;
+
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when a LivingEntity loads a crossbow with a projectile.
+ */
+public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final ItemStack crossbow;
+ private final EquipmentSlot hand;
+ private boolean cancelled;
+ private boolean consumeItem = true;
+
+ public EntityLoadCrossbowEvent(@NotNull LivingEntity entity, @Nullable ItemStack crossbow, @NotNull EquipmentSlot hand) {
+ @ApiStatus.Internal
+ public EntityLoadCrossbowEvent(@NotNull LivingEntity entity, @NotNull ItemStack crossbow, @NotNull EquipmentSlot hand) {
+ super(entity);
+ this.crossbow = crossbow;
+ this.hand = hand;
@ -49,7 +50,7 @@ index 0000000000000000000000000000000000000000..aa9ccd7c806e864455ecd5f15ddb17c0
+ *
+ * @return the crossbow involved in this event
+ */
+ @Nullable
+ @NotNull
+ public ItemStack getCrossbow() {
+ return crossbow;
+ }
@ -99,11 +100,11 @@ index 0000000000000000000000000000000000000000..aa9ccd7c806e864455ecd5f15ddb17c0
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}