mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Pull CraftBukkit #1041 by @YLivay - address missing event for paintings breaking due to movement.
By: md_5 <md_5@live.com.au>
This commit is contained in:
parent
93b6957b56
commit
abb5a8c429
1 changed files with 39 additions and 0 deletions
|
@ -0,0 +1,39 @@
|
|||
From 256a6b7401b53e15483740d253e65a6124dee309 Mon Sep 17 00:00:00 2001
|
||||
From: Yariv Livay <yarivlivay@gmail.com>
|
||||
Date: Sat, 2 Mar 2013 09:36:52 +1100
|
||||
Subject: [PATCH] BUKKIT-3661, fixed missing HangingBreakEvent when
|
||||
EntityHanging moves
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityHanging.java | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java
|
||||
index 8cc80b9..77f9c76 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHanging.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHanging.java
|
||||
@@ -261,6 +261,21 @@ public abstract class EntityHanging extends Entity {
|
||||
if (!this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
if (dead) return; // CraftBukkit
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ PaintingBreakEvent paintingEvent = null;
|
||||
+ if (this instanceof EntityPainting) {
|
||||
+ // Fire old painting event until it can be removed
|
||||
+ paintingEvent = new PaintingBreakEvent((Painting) this.getBukkitEntity(), PaintingBreakEvent.RemoveCause.valueOf(event.getCause().name()));
|
||||
+ paintingEvent.setCancelled(event.isCancelled());
|
||||
+ this.world.getServer().getPluginManager().callEvent(paintingEvent);
|
||||
+ }
|
||||
+ if (event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.die();
|
||||
this.h();
|
||||
}
|
||||
--
|
||||
1.8.1-rc2
|
||||
|
Loading…
Reference in a new issue