3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 13:00:06 +01:00

Fix crash caused by tnt destroying item frames

Dieser Commit ist enthalten in:
md_5 2013-12-06 20:32:13 +11:00
Ursprung d8487572a0
Commit b51765cc5d

Datei anzeigen

@ -1,24 +1,27 @@
From 44a4aeef7c0503db9894cd45b16d0dc8a93848f6 Mon Sep 17 00:00:00 2001 From 86d7a42c6a245d2f9675abb33bf63d9f076bffe9 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Thu, 5 Dec 2013 18:41:32 +1100 Date: Thu, 5 Dec 2013 18:41:32 +1100
Subject: [PATCH] Fire EntityDamageByEntityEvent for ItemFrames Subject: [PATCH] Fire EntityDamageByEntityEvent for ItemFrames
diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java
index 261d0c1..58d0d26 100644 index 261d0c1..0fdcffe 100644
--- a/src/main/java/net/minecraft/server/EntityItemFrame.java --- a/src/main/java/net/minecraft/server/EntityItemFrame.java
+++ b/src/main/java/net/minecraft/server/EntityItemFrame.java +++ b/src/main/java/net/minecraft/server/EntityItemFrame.java
@@ -23,6 +23,15 @@ public class EntityItemFrame extends EntityHanging { @@ -23,6 +23,18 @@ public class EntityItemFrame extends EntityHanging {
return false; return false;
} else if (this.getItem() != null) { } else if (this.getItem() != null) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
+ // Spigot Start + // Spigot Start
+ org.bukkit.event.entity.EntityDamageByEntityEvent event = new org.bukkit.event.entity.EntityDamageByEntityEvent( + if ( damagesource.getEntity() != null )
+ damagesource.getEntity().getBukkitEntity(), getBukkitEntity(), org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_ATTACK, f );
+ getBukkitEntity().getServer().getPluginManager().callEvent( event );
+ if ( event.isCancelled() )
+ { + {
+ return false; + org.bukkit.event.entity.EntityDamageByEntityEvent event = new org.bukkit.event.entity.EntityDamageByEntityEvent(
+ damagesource.getEntity().getBukkitEntity(), getBukkitEntity(), org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_ATTACK, f );
+ getBukkitEntity().getServer().getPluginManager().callEvent( event );
+ if ( event.isCancelled() )
+ {
+ return false;
+ }
+ } + }
+ // Spigot End + // Spigot End
this.b(damagesource.getEntity(), false); this.b(damagesource.getEntity(), false);