2016-03-15 20:14:49 +00:00
|
|
|
From 10154dcc951a95851fbbcf02976a9fc6eca2643b Mon Sep 17 00:00:00 2001
|
2016-02-29 21:33:06 +00:00
|
|
|
From: md_5 <git@md-5.net>
|
|
|
|
Date: Sat, 27 Feb 2016 10:07:58 +1100
|
|
|
|
Subject: [PATCH] Entity Mount and Dismount Events
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2016-03-15 20:14:49 +00:00
|
|
|
index 280ceb8..1104a04 100644
|
2016-02-29 21:33:06 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2016-03-15 20:14:49 +00:00
|
|
|
@@ -1681,6 +1681,13 @@ public abstract class Entity implements ICommandListener {
|
2016-02-29 21:33:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
+ // Spigot start
|
2016-03-01 19:41:39 +00:00
|
|
|
+ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent(entity.getBukkitEntity(), this.getBukkitEntity());
|
2016-02-29 21:33:06 +00:00
|
|
|
+ Bukkit.getPluginManager().callEvent(event);
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // Spigot end
|
|
|
|
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bt() instanceof EntityHuman)) {
|
|
|
|
this.passengers.add(0, entity);
|
|
|
|
} else {
|
2016-03-15 20:14:49 +00:00
|
|
|
@@ -1710,6 +1717,7 @@ public abstract class Entity implements ICommandListener {
|
2016-02-29 21:33:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2016-03-01 19:41:39 +00:00
|
|
|
+ Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity())); // Spigot
|
2016-02-29 21:33:06 +00:00
|
|
|
this.passengers.remove(entity);
|
|
|
|
entity.j = 60;
|
|
|
|
}
|
|
|
|
--
|
|
|
|
2.5.0
|
|
|
|
|