Paper/patches/api/0319-Make-EntityUnleashEvent-cancellable.patch
Nassim Jahnke 928bcc8d3a
Updated Upstream (Bukkit/CraftBukkit) (#8430)
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
2022-10-02 09:56:36 +02:00

50 Zeilen
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 3 Jan 2021 21:25:39 -0800
Subject: [PATCH] Make EntityUnleashEvent cancellable
diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
index e0e068799a1868c8e561869015f41f553ef4fbdb..95248d0f5cf9b62d31a4883955b9088a7fc8a3b3 100644
--- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
@@ -6,11 +6,20 @@ import org.jetbrains.annotations.NotNull;
/**
* Called immediately prior to an entity being unleashed.
+ * <p>
+ * Cancelling this event when either:
+ * <ul>
+ * <li>the leashed entity dies,</li>
+ * <li>the entity changes dimension, or</li>
+ * <li>the client has disconnected the leash</li>
+ * </ul>
+ * will have no effect.
*/
-public class EntityUnleashEvent extends EntityEvent {
+public class EntityUnleashEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper
private static final HandlerList handlers = new HandlerList();
private final UnleashReason reason;
private boolean dropLeash; // Paper
+ private boolean cancelled; // Paper
// Paper start - drop leash variable
@Deprecated
@@ -53,6 +62,16 @@ public class EntityUnleashEvent extends EntityEvent {
public void setDropLeash(boolean dropLeash) {
this.dropLeash = dropLeash;
}
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
// Paper end
@NotNull