Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/patches/api/0263-Add-dropLeash-variable-to-EntityUnleashEvent.patch
Noah van der Aa 2e99e5e677
Updated Upstream (Bukkit/CraftBukkit) (#7411)
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:
af88996a SPIGOT-6890: Add repair cost amount in AnvilInventory
bc7bd363 PR-716: Fix scheduler javadocs (previously, the <b> tag broke the rendering)
6db1ab70 Improve item cooldown JavaDocs

CraftBukkit Changes:
13670b44 SPIGOT-6890: Add repair cost amount in AnvilInventory
0d109e86 PR-999: Prevent non-item cooldowns
2022-01-27 15:35:36 +01:00

79 Zeilen
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
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 cf78950b56d4977f6c4d9d98d183bfc5ba3bacc0..68eab1563caba1ee4f52b308f390e4e172667fc5 100644
--- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
@@ -13,8 +13,15 @@ public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Canc
private final Player player;
private boolean cancelled = false;
+ // Paper start - drop leash variable
+ @Deprecated
public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player) {
- super(entity, UnleashReason.PLAYER_UNLEASH);
+ this(entity, player, false);
+ }
+
+ public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, boolean dropLeash) {
+ super(entity, UnleashReason.PLAYER_UNLEASH, dropLeash);
+ // Paper end
this.player = player;
}