mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-09-18 21:33:01 +00:00
47 lines
1.9 KiB
Diff
47 lines
1.9 KiB
Diff
From b705d088e85d65a513178e407d52bc5047887d83 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index c6a55f43c..c8a999904 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -1893,6 +1893,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
|
|
}
|
|
}
|
|
// CraftBukkit end
|
|
+ // Spigot start
|
|
+ org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent(entity.getBukkitEntity(), this.getBukkitEntity());
|
|
+ // Suppress during worldgen
|
|
+ if (this.valid) {
|
|
+ Bukkit.getPluginManager().callEvent(event);
|
|
+ }
|
|
+ if (event.isCancelled()) {
|
|
+ return false;
|
|
+ }
|
|
+ // Spigot end
|
|
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
|
this.passengers.add(0, entity);
|
|
} else {
|
|
@@ -1926,6 +1936,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
|
|
}
|
|
}
|
|
// CraftBukkit end
|
|
+ // Spigot start
|
|
+ org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity());
|
|
+ // Suppress during worldgen
|
|
+ if (this.valid) {
|
|
+ Bukkit.getPluginManager().callEvent(event);
|
|
+ }
|
|
+ if (event.isCancelled()) {
|
|
+ return false;
|
|
+ }
|
|
+ // Spigot end
|
|
this.passengers.remove(entity);
|
|
entity.j = 60;
|
|
}
|
|
--
|
|
2.25.1
|
|
|