SPIGOT-1813: EntityCombustByEntityEvent not Cancelled

This commit is contained in:
md_5 2016-03-11 07:01:33 +11:00
parent c126d6101e
commit 7d330bc9f3

View File

@ -247,11 +247,12 @@
} }
public void openSign(TileEntitySign tileentitysign) {} public void openSign(TileEntitySign tileentitysign) {}
@@ -884,7 +978,15 @@ @@ -884,8 +978,15 @@
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth(); f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isBurning()) { if (j > 0 && !entity.isBurning()) {
- flag4 = true; - flag4 = true;
- entity.setOnFire(1);
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item + // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 1); + EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 1);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent); + org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
@ -261,10 +262,10 @@
+ entity.setOnFire(combustEvent.getDuration()); + entity.setOnFire(combustEvent.getDuration());
+ } + }
+ // CraftBukkit end + // CraftBukkit end
entity.setOnFire(1);
} }
} }
@@ -925,11 +1027,28 @@
@@ -925,11 +1026,28 @@
} }
if (entity instanceof EntityPlayer && entity.velocityChanged) { if (entity instanceof EntityPlayer && entity.velocityChanged) {
@ -293,7 +294,7 @@
} }
if (flag2) { if (flag2) {
@@ -991,7 +1110,8 @@ @@ -991,7 +1109,8 @@
if (itemstack3 != null && object instanceof EntityLiving) { if (itemstack3 != null && object instanceof EntityLiving) {
itemstack3.a((EntityLiving) object, this); itemstack3.a((EntityLiving) object, this);
@ -303,7 +304,7 @@
this.a(EnumHand.MAIN_HAND, (ItemStack) null); this.a(EnumHand.MAIN_HAND, (ItemStack) null);
} }
} }
@@ -1001,7 +1121,14 @@ @@ -1001,7 +1120,14 @@
this.a(StatisticList.y, Math.round(f5 * 10.0F)); this.a(StatisticList.y, Math.round(f5 * 10.0F));
if (j > 0) { if (j > 0) {
@ -319,7 +320,7 @@
} }
if (this.world instanceof WorldServer && f5 > 2.0F) { if (this.world instanceof WorldServer && f5 > 2.0F) {
@@ -1090,6 +1217,20 @@ @@ -1090,6 +1216,20 @@
this.stopRiding(); this.stopRiding();
} }
@ -340,7 +341,7 @@
this.setSize(0.2F, 0.2F); this.setSize(0.2F, 0.2F);
if (this.world.isLoaded(blockposition)) { if (this.world.isLoaded(blockposition)) {
EnumDirection enumdirection = (EnumDirection) this.world.getType(blockposition).get(BlockFacingHorizontal.FACING); EnumDirection enumdirection = (EnumDirection) this.world.getType(blockposition).get(BlockFacingHorizontal.FACING);
@@ -1172,6 +1313,23 @@ @@ -1172,6 +1312,23 @@
this.world.everyoneSleeping(); this.world.everyoneSleeping();
} }
@ -364,7 +365,7 @@
this.sleepTicks = flag ? 0 : 100; this.sleepTicks = flag ? 0 : 100;
if (flag2) { if (flag2) {
this.setRespawnPosition(this.bedPosition, false); this.setRespawnPosition(this.bedPosition, false);
@@ -1222,9 +1380,11 @@ @@ -1222,9 +1379,11 @@
if (blockposition != null) { if (blockposition != null) {
this.e = blockposition; this.e = blockposition;
this.f = flag; this.f = flag;