EntityLoadCrossbowEvent#shouldConsumeItem

This commit is contained in:
Shane Freeder 2021-01-14 15:53:42 +00:00
parent 4740bd6c89
commit 7232d8f2af
2 changed files with 37 additions and 8 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..8ba1c04af4058e70bf5925b9ccd36c3c8f8f8250
index 0000000000000000000000000000000000000000..287f487b266d5c12fcf6f028452735e314d55636
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java
@@ -0,0 +1,84 @@
@@ -0,0 +1,101 @@
+package io.papermc.paper.event.entity;
+
+import org.bukkit.entity.LivingEntity;
@ -30,6 +30,7 @@ index 0000000000000000000000000000000000000000..8ba1c04af4058e70bf5925b9ccd36c3c
+ 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) {
+ super(entity);
@ -63,6 +64,22 @@ index 0000000000000000000000000000000000000000..8ba1c04af4058e70bf5925b9ccd36c3c
+ return hand;
+ }
+
+ /**
+ *
+ * @return should the itemstack be consumed
+ */
+ public boolean shouldConsumeItem() {
+ return consumeItem;
+ }
+
+ /**
+ *
+ * @param consume should the item be consumed
+ */
+ public void setConsumeItem(boolean consume) {
+ this.consumeItem = consume;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;