mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
928bcc8d3a
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 09943450 Update SnakeYAML version 5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc 6f82b381 PR-788: Add getHand() to all relevant events CraftBukkit Changes: aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe 5329dd6fd PR-1107: Add getHand() to all relevant events 93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
69 lines
2 KiB
Diff
69 lines
2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: TheViperShow <29604693+TheViperShow@users.noreply.github.com>
|
|
Date: Wed, 22 Apr 2020 09:40:23 +0200
|
|
Subject: [PATCH] Add BlockFailedDispenseEvent
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..dab794341170ed10d5a05c1b4c180d164e0f70e2
|
|
--- /dev/null
|
|
+++ b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java
|
|
@@ -0,0 +1,57 @@
|
|
+package io.papermc.paper.event.block;
|
|
+
|
|
+import org.bukkit.block.Block;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.block.BlockEvent;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Called when a block tries to dispense an item, but its inventory is empty.
|
|
+ */
|
|
+public class BlockFailedDispenseEvent extends BlockEvent {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+
|
|
+ private boolean shouldPlayEffect = true;
|
|
+
|
|
+ public BlockFailedDispenseEvent(@NotNull Block theBlock) {
|
|
+ super(theBlock);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return if the effect should be played
|
|
+ */
|
|
+ public boolean shouldPlayEffect() {
|
|
+ return this.shouldPlayEffect;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets if the effect for empty dispensers should be played
|
|
+ *
|
|
+ * @param playEffect if the effect should be played
|
|
+ */
|
|
+ public void shouldPlayEffect(boolean playEffect) {
|
|
+ this.shouldPlayEffect = playEffect;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * {@inheritDoc}
|
|
+ *
|
|
+ * @return {@link #shouldPlayEffect()}
|
|
+ */
|
|
+ @Override
|
|
+ public boolean callEvent() {
|
|
+ super.callEvent();
|
|
+ return this.shouldPlayEffect();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public @NotNull
|
|
+ HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ public static @NotNull
|
|
+ HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|