mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-01 05:01:37 +01:00
Do not remove leash knot if leasing to an existing leash knot gets cancelled
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
6041b5c6b5
commit
44c4305918
@ -14,20 +14,21 @@
|
||||
public class EntityLeash extends EntityHanging {
|
||||
|
||||
public static final double OFFSET_Y = 0.375D;
|
||||
@@ -89,6 +96,12 @@
|
||||
@@ -89,6 +96,13 @@
|
||||
EntityInsentient entityinsentient = (EntityInsentient) iterator.next();
|
||||
|
||||
if (entityinsentient.getLeashHolder() == entityhuman) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(entityinsentient, entityinsentient.getLeashHolder()));
|
||||
+ flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityinsentient.setLeashedTo(this, true);
|
||||
flag = true;
|
||||
}
|
||||
@@ -97,18 +110,32 @@
|
||||
@@ -97,18 +111,32 @@
|
||||
boolean flag1 = false;
|
||||
|
||||
if (!flag) {
|
||||
|
Loading…
Reference in New Issue
Block a user