mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 21:19:00 +01:00
[Bleeding] Added EntityBreakDoorEvent. Fixes BUKKIT-1134
This commit is contained in:
parent
69ee00b6f0
commit
06b814fd7e
@ -30,6 +30,12 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (--this.i == 0 && this.a.world.difficulty == 3) {
|
if (--this.i == 0 && this.a.world.difficulty == 3) {
|
||||||
|
// CraftBukkit start
|
||||||
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.a, this.b, this.c, this.d).isCancelled()) {
|
||||||
|
this.c();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
this.a.world.setTypeId(this.b, this.c, this.d, 0);
|
this.a.world.setTypeId(this.b, this.c, this.d, 0);
|
||||||
this.a.world.triggerEffect(1012, this.b, this.c, this.d, 0);
|
this.a.world.triggerEffect(1012, this.b, this.c, this.d, 0);
|
||||||
this.a.world.triggerEffect(2001, this.b, this.c, this.d, this.e.id);
|
this.a.world.triggerEffect(2001, this.b, this.c, this.d, this.e.id);
|
||||||
|
@ -441,6 +441,16 @@ public class CraftEventFactory {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EntityBreakDoorEvent callEntityBreakDoorEvent(Entity entity, int x, int y, int z) {
|
||||||
|
org.bukkit.entity.Entity entity1 = entity.getBukkitEntity();
|
||||||
|
Block block = entity1.getWorld().getBlockAt(x, y, z);
|
||||||
|
|
||||||
|
EntityBreakDoorEvent event = new EntityBreakDoorEvent((LivingEntity) entity1, block);
|
||||||
|
entity1.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
public static Container callInventoryOpenEvent(EntityPlayer player, Container container) {
|
public static Container callInventoryOpenEvent(EntityPlayer player, Container container) {
|
||||||
if (player.activeContainer != player.defaultContainer) { // fire INVENTORY_CLOSE if one already open
|
if (player.activeContainer != player.defaultContainer) { // fire INVENTORY_CLOSE if one already open
|
||||||
player.netServerHandler.handleContainerClose(new Packet101CloseWindow(player.activeContainer.windowId));
|
player.netServerHandler.handleContainerClose(new Packet101CloseWindow(player.activeContainer.windowId));
|
||||||
|
Loading…
Reference in New Issue
Block a user