byte face = in.readByte();
coordinate = new Coordinate(x, y, z, player);
if (!player.getGroup().ignoreAreas) {
BlockPermission perm = server.config.blockPermission(player, coordinate);
if (!perm.use && status == 0) {
player.addTMessage(Color.RED, "You can not use this block here!");
break;
}
if (!perm.destroy && status == BLOCK_DESTROYED_STATUS) {
player.addTMessage(Color.RED, "You can not destroy this block!");
break;
}
}
boolean locked = server.data.chests.isLocked(coordinate);
if (!locked || player.ignoresChestLocks() || server.data.chests.canOpen(player, coordinate)) {
if (locked && status == BLOCK_DESTROYED_STATUS) {
server.data.chests.releaseLock(coordinate);
server.data.save();
}
write(packetId);
write(status);
write(x);
write(y);
write(z);
write(face);
if (player.instantDestroyEnabled()) {
packetFinished();
write(packetId);
write(BLOCK_DESTROYED_STATUS);
write(x);
write(y);
write(z);
write(face);
}
if (status == BLOCK_DESTROYED_STATUS) {
player.destroyedBlock();
}
}
} else {
write(packetId);
copyNBytes(11);
}
break;
case 0x0f: // Player Block Placement
x = in.readInt();
y = in.readByte();
z = in.readInt();
coordinate = new Coordinate(x, y, z, player);
final byte direction = in.readByte();
final short dropItem = in.readShort();
byte itemCount = 0;
short uses = 0;
byte[] data = null;
if (dropItem != -1) {
itemCount = in.readByte();
uses = in.readShort();
short dataLength = in.readShort();
if (dataLength != -1) {
data = new byte[dataLength];
in.readFully(data);
}
}
byte blockX = in.readByte();
byte blockY = in.readByte();
byte blockZ = in.readByte();
boolean writePacket = true;
boolean drop = false;
BlockPermission perm = server.config.blockPermission(player, coordinate, dropItem);
if (server.options.getBoolean("enableEvents")) {
player.checkButtonEvents(new Coordinate(x + (x < 0 ? 1 : 0), y + 1, z + (z < 0 ? 1 : 0)));
}