aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch
diff options
context:
space:
mode:
authorShane Freeder <[email protected]>2024-05-09 14:51:33 +0100
committerShane Freeder <[email protected]>2024-05-09 14:51:33 +0100
commit3693bbdc6b65e68db10375d3eeab70f06708b729 (patch)
tree4a71a5e6e5f50b3e2937053a5d4b4196ef67665b /patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch
parentf2512b12385961f8ca1f69efebe5ed0e00c0caa8 (diff)
downloadPaper-timings/use-internals.tar.gz
Paper-timings/use-internals.zip
Use internals for getting block/entity countstimings/use-internals
For a long time I've been meaning to move some of this logic internally as this would allow us to avoid hitting systems like block state snapshots which can create issues as many of the spigot implementations of this stuff are increasingly broken, leading to unexpected crashes during ticking, even if the API cannot properly interact with these such states/items, it's generally more preferable to not crash the server in the course, and just let those interactions fail more gracefully.
Diffstat (limited to 'patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch')
-rw-r--r--patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch78
1 files changed, 78 insertions, 0 deletions
diff --git a/patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch
new file mode 100644
index 0000000000..f85f2a4f26
--- /dev/null
+++ b/patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch
@@ -0,0 +1,78 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Nassim Jahnke <[email protected]>
+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;
+ }