mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 13:36:16 +01:00
Fixed missing PlayerInteractEvent call in creative mode
This commit is contained in:
parent
9252230e3a
commit
cdbd318bb5
@ -82,20 +82,23 @@ public class ItemInWorldManager {
|
|||||||
|
|
||||||
public void dig(int i, int j, int k, int l) {
|
public void dig(int i, int j, int k, int l) {
|
||||||
// this.world.douseFire((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
|
// this.world.douseFire((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
|
||||||
|
// CraftBukkit start
|
||||||
|
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
|
||||||
|
|
||||||
if (this.b()) {
|
if (this.b()) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.c(i, j, k);
|
this.c(i, j, k);
|
||||||
} else {
|
} else {
|
||||||
this.lastDigTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
this.lastDigTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||||
int i1 = this.world.getTypeId(i, j, k);
|
int i1 = this.world.getTypeId(i, j, k);
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
// Swings at air do *NOT* exist.
|
// Swings at air do *NOT* exist.
|
||||||
if (i1 <= 0) {
|
if (i1 <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
|
|
||||||
|
|
||||||
if (event.useInteractedBlock() == Event.Result.DENY) {
|
if (event.useInteractedBlock() == Event.Result.DENY) {
|
||||||
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
||||||
if (i1 == Block.WOODEN_DOOR.id) {
|
if (i1 == Block.WOODEN_DOOR.id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user