mirror of
				https://hub.spigotmc.org/stash/scm/spigot/spigot.git
				synced 2025-11-01 09:09:35 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			47 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From da320bdd605e18db400fb951812f9d37bbdb8435 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/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
 | 
						|
index c980c6326..94a576555 100644
 | 
						|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
 | 
						|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
 | 
						|
@@ -2219,6 +2219,16 @@ public abstract class Entity implements INamableTileEntity, EntityAccess, IComma
 | 
						|
                 }
 | 
						|
             }
 | 
						|
             // 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.passengers.isEmpty()) {
 | 
						|
                 this.passengers = ImmutableList.of(entity);
 | 
						|
             } else {
 | 
						|
@@ -2260,6 +2270,16 @@ public abstract class Entity implements INamableTileEntity, EntityAccess, IComma
 | 
						|
                 }
 | 
						|
             }
 | 
						|
             // 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
 | 
						|
             if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
 | 
						|
                 this.passengers = ImmutableList.of();
 | 
						|
             } else {
 | 
						|
-- 
 | 
						|
2.25.1
 | 
						|
 |