testserver/Spigot-Server-Patches/0060-Made-EntityDismountEve...

30 lines
1.3 KiB
Diff

From 031f1df60d5934708755d7afe14817d30fdf8b4d Mon Sep 17 00:00:00 2001
From: Nik Gil <nikmanG@users.noreply.github.com>
Date: Thu, 3 Mar 2016 04:04:19 -0600
Subject: [PATCH] Made EntityDismountEvent Cancellable
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 782abd6..b15c5f6 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1741,7 +1741,14 @@ public abstract class Entity implements ICommandListener {
}
}
// CraftBukkit end
- Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity())); // Spigot
+ // Paper start - make EntityDismountEvent cancellable
+ if (!new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity()).callEvent()) {
+ if (entity instanceof EntityPlayer) {
+ ((EntityPlayer) entity).playerConnection.sendPacket(new net.minecraft.server.PacketPlayOutMount(this));
+ }
+ return;
+ }
+ // Paper end
this.passengers.remove(entity);
entity.j = 60;
}
--
2.8.0