Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 21:10:10 +01:00
possible fix for block breaking bug
Dieser Commit ist enthalten in:
Ursprung
13f55ce0c8
Commit
e53fd1367c
@ -112,7 +112,8 @@ public class ItemInWorldManager {
|
|||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
MinecraftServer.a.info("A plugin cancelled the block break event");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -328,7 +328,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
if (packet14blockdig.e == 0) {
|
if (packet14blockdig.e == 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (i1 > this.d.spawnProtection || flag) {
|
if (i1 > this.d.spawnProtection || flag) {
|
||||||
if (blockId > 0) {
|
// if (blockId > 0) {
|
||||||
BlockDamageEvent event;
|
BlockDamageEvent event;
|
||||||
// If the amount of damage that the player is going to do to the block
|
// If the amount of damage that the player is going to do to the block
|
||||||
// is >= 1, then the block is going to break (eg, flowers, torches)
|
// is >= 1, then the block is going to break (eg, flowers, torches)
|
||||||
@ -347,7 +347,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.e.c.a(i, j, k);
|
this.e.c.a(i, j, k);
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
|
MinecraftServer.a.info("A plugin cancelled the block start break event");
|
||||||
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else if (packet14blockdig.e == 2) {
|
} else if (packet14blockdig.e == 2) {
|
||||||
// CraftBukkit start - Get last block that the player hit
|
// CraftBukkit start - Get last block that the player hit
|
||||||
@ -357,31 +360,33 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.e.c.b(i, j, k);
|
this.e.c.b(i, j, k);
|
||||||
|
} else {
|
||||||
|
MinecraftServer.a.info("A plugin cancelled the block stop break event");
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
} else if (packet14blockdig.e == 1) {
|
// } else if (packet14blockdig.e == 1) {
|
||||||
// CraftBukkit start
|
// // CraftBukkit start
|
||||||
if (i1 > this.d.spawnProtection || flag) {
|
// if (i1 > this.d.spawnProtection || flag) {
|
||||||
BlockDamageEvent event;
|
// BlockDamageEvent event;
|
||||||
// If the amount of damage going to the block plus the current amount
|
// // If the amount of damage going to the block plus the current amount
|
||||||
// of damage is greater than 1, the block is going to break.
|
// // of damage is greater than 1, the block is going to break.
|
||||||
if (this.e.c.c + damage >= 1.0F) {
|
// if (this.e.c.c + damage >= 1.0F) {
|
||||||
// if we are destroying either a redstone wire with a current greater than 0 or
|
// // if we are destroying either a redstone wire with a current greater than 0 or
|
||||||
// a redstone torch that is on, then we should notify plugins that this block has
|
// // a redstone torch that is on, then we should notify plugins that this block has
|
||||||
// returned to a current value of 0 (since it will once the redstone is destroyed)
|
// // returned to a current value of 0 (since it will once the redstone is destroyed)
|
||||||
if ((blockId == Block.REDSTONE_WIRE.id && block.getRawData() > 0) || blockId == Block.REDSTONE_TORCH_ON.id) {
|
// if ((blockId == Block.REDSTONE_WIRE.id && block.getRawData() > 0) || blockId == Block.REDSTONE_TORCH_ON.id) {
|
||||||
server.getPluginManager().callEvent( new BlockRedstoneEvent(block, (blockId == Block.REDSTONE_WIRE.id ? block.getRawData() : 15), 0));
|
// server.getPluginManager().callEvent( new BlockRedstoneEvent(block, (blockId == Block.REDSTONE_WIRE.id ? block.getRawData() : 15), 0));
|
||||||
}
|
// }
|
||||||
event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.BROKEN, player);
|
// event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.BROKEN, player);
|
||||||
} else {
|
// } else {
|
||||||
event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.DIGGING, player);
|
// event = new BlockDamageEvent(Type.BLOCK_DAMAGED, block, BlockDamageLevel.DIGGING, player);
|
||||||
}
|
// }
|
||||||
server.getPluginManager().callEvent(event);
|
// server.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
// if (event.isCancelled()) {
|
||||||
this.e.c.c = 0; // Reset the amount of damage if stopping break.
|
// this.e.c.c = 0; // Reset the amount of damage if stopping break.
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// CraftBukkit end
|
// // CraftBukkit end
|
||||||
} else if (packet14blockdig.e == 3) {
|
} else if (packet14blockdig.e == 3) {
|
||||||
double d4 = this.e.locX - ((double) i + 0.5D);
|
double d4 = this.e.locX - ((double) i + 0.5D);
|
||||||
double d5 = this.e.locY - ((double) j + 0.5D);
|
double d5 = this.e.locY - ((double) j + 0.5D);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren