Paper/patches/api/0251-Add-dropLeash-variable-to-EntityUnleashEvent.patch
Nassim Jahnke 71c84c8132
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
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:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD

CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor

Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00

79 lines
3.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Fri, 29 Jan 2021 15:13:04 +0100
Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent
diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
index a33986a0c437a673435206fc337031a7eebdab3b..e0e068799a1868c8e561869015f41f553ef4fbdb 100644
--- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
@@ -10,10 +10,19 @@ import org.jetbrains.annotations.NotNull;
public class EntityUnleashEvent extends EntityEvent {
private static final HandlerList handlers = new HandlerList();
private final UnleashReason reason;
+ private boolean dropLeash; // Paper
+ // Paper start - drop leash variable
+ @Deprecated
public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason) {
+ this(entity, reason, false);
+ }
+
+ public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason, boolean dropLeash) {
super(entity);
+ // Paper end
this.reason = reason;
+ this.dropLeash = dropLeash; // Paper
}
/**
@@ -26,6 +35,26 @@ public class EntityUnleashEvent extends EntityEvent {
return reason;
}
+ // Paper start
+ /**
+ * Returns whether a leash item will be dropped.
+ *
+ * @return Whether the leash item will be dropped
+ */
+ public boolean isDropLeash() {
+ return dropLeash;
+ }
+
+ /**
+ * Sets whether a leash item should be dropped.
+ *
+ * @param dropLeash Whether the leash item should be dropped
+ */
+ public void setDropLeash(boolean dropLeash) {
+ this.dropLeash = dropLeash;
+ }
+ // Paper end
+
@NotNull
@Override
public HandlerList getHandlers() {
diff --git a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
index 075af9c1c179bcc2f0e7cb4db4e0d54d6d58ce5c..d63bd62606763d0902ea800f0c35a1cfd07fc8ec 100644
--- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
@@ -17,8 +17,15 @@ public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Canc
private final Player player;
private final EquipmentSlot hand;
+ // Paper start - drop leash variable
+ @Deprecated
public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand) {
- super(entity, UnleashReason.PLAYER_UNLEASH);
+ this(entity, player, hand, false);
+ }
+
+ public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand, boolean dropLeash) {
+ super(entity, UnleashReason.PLAYER_UNLEASH, dropLeash);
+ // Paper end
this.player = player;
this.hand = hand;
}