Program: 151878
Project: 151878
Buggy source:
private void handlePacket() throws IOException {
  Byte packetId=in.readByte();
  int x;
  byte y;
  int z;
  byte dimension;
  Coordinate coordinate;
switch (packetId) {
case 0x00:
    write(packetId);
  break;
case 0x01:
write(packetId);
if (isServerTunnel) {
player.setEntityId(in.readInt());
write(player.getEntityId());
}
 else {
write(in.readInt());
}
write(readUTF16());
write(in.readLong());
dimension=in.readByte();
if (isServerTunnel) {
player.setDimension(Dimension.get(dimension));
}
write(dimension);
break;
case 0x02:
String name=readUTF16();
if (isServerTunnel || player.setName(name)) {
tunneler.setName(streamType + "String_Node_Str" + player.getName());
write(packetId);
write(name);
}
break;
case 0x03:
String message=readUTF16();
Matcher joinMatcher=JOIN_PATTERN.matcher(message);
if (isServerTunnel && joinMatcher.find()) {
if (server.bots.ninja(joinMatcher.group(1))) {
break;
}
}
 else if (isServerTunnel && server.options.getBoolean("String_Node_Str")) {
Matcher colorMatcher=COLOR_PATTERN.matcher(message);
String cleanMessage=colorMatcher.replaceAll("String_Node_Str");
Matcher messageMatcher=MESSAGE_PATTERN.matcher(cleanMessage);
if (messageMatcher.find()) {
Player friend=server.findPlayerExact(messageMatcher.group(1));
if (friend != null) {
String color="String_Node_Str";
String title="String_Node_Str";
String format=server.options.get("String_Node_Str");
Group group=friend.getGroup();
if (group != null) {
color=group.getColor();
if (group.showTitle()) {
title=group.getName();
format=server.options.get("String_Node_Str");
}
}
try {
message=String.format(format,friend.getName(),title,color) + messageMatcher.group(2);
}
 catch (IllegalFormatException e) {
System.out.println("String_Node_Str");
}
}
}
 else if (cleanMessage.matches(CONSOLE_CHAT_PATTERN) && !server.options.getBoolean("String_Node_Str")) {
break;
}
if (server.options.getBoolean("String_Node_Str")) {
sendMessage(message);
}
 else {
if (message.length() > MAXIMUM_MESSAGE_SIZE) {
message=message.substring(0,MAXIMUM_MESSAGE_SIZE);
}
write(packetId);
write(message);
}
}
 else if (!isServerTunnel) {
if (player.isMuted() && !message.startsWith("String_Node_Str") && !message.startsWith("String_Node_Str")) {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
if (player.parseCommand(message)) {
break;
}
if (player.localChat() && !message.startsWith("String_Node_Str") && !message.startsWith("String_Node_Str")) {
player.execute(LocalSayCommand.class,message);
break;
}
if (message.length() > MAXIMUM_MESSAGE_SIZE) {
message=message.substring(0,MAXIMUM_MESSAGE_SIZE);
}
write(packetId);
write(message);
}
break;
case 0x04:
write(packetId);
long time=in.readLong();
server.setTime(time);
write(time);
break;
case 0x05:
write(packetId);
write(in.readInt());
write(in.readShort());
write(in.readShort());
write(in.readShort());
break;
case 0x06:
write(packetId);
copyNBytes(12);
break;
case 0x07:
int user=in.readInt();
int target=in.readInt();
Player targetPlayer=server.playerList.findPlayer(target);
if (targetPlayer != null) {
if (targetPlayer.godModeEnabled()) {
in.readBoolean();
break;
}
}
write(packetId);
write(user);
write(target);
write(in.readBoolean());
break;
case 0x08:
write(packetId);
copyNBytes(2);
break;
case 0x09:
write(packetId);
dimension=in.readByte();
write(dimension);
player.setDimension(Dimension.get(dimension));
break;
case 0x0a:
write(packetId);
copyNBytes(1);
if (!inGame && !isServerTunnel) {
player.sendMOTD();
if (server.options.getBoolean("String_Node_Str")) {
player.execute(PlayerListCommand.class);
}
inGame=true;
}
break;
case 0x0b:
write(packetId);
copyPlayerLocation();
copyNBytes(1);
break;
case 0x0c:
write(packetId);
copyPlayerLook();
copyNBytes(1);
break;
case 0x0d:
write(packetId);
copyPlayerLocation();
copyPlayerLook();
copyNBytes(1);
break;
case 0x0e:
if (!isServerTunnel) {
byte status=in.readByte();
x=in.readInt();
y=in.readByte();
z=in.readInt();
byte face=in.readByte();
coordinate=new Coordinate(x,y,z,player);
boolean[] perms=server.permissions.getPlayerBlockPermissions(player,coordinate,0);
if (!perms[2] && status == 0) {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
if (!perms[1] && status == 2) {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
boolean locked=server.data.chests.isLocked(coordinate);
if (!locked || player.isAdmin()) {
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:
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;
if (dropItem != -1) {
itemCount=in.readByte();
uses=in.readShort();
}
boolean writePacket=true;
boolean drop=false;
boolean[] perms=server.permissions.getPlayerBlockPermissions(player,coordinate,dropItem);
if (isServerTunnel || server.data.chests.isChest(coordinate)) {
}
 else if ((dropItem != -1 && !perms[0]) || (dropItem == -1 && !perms[2])) {
if (dropItem == -1) {
player.addTMessage(Color.RED,"String_Node_Str");
}
 else {
player.addTMessage(Color.RED,"String_Node_Str");
}
writePacket=false;
drop=true;
}
 else if (dropItem == 54) {
int xPosition=x;
byte yPosition=y;
int zPosition=z;
switch (direction) {
case 0:
--yPosition;
break;
case 1:
++yPosition;
break;
case 2:
--zPosition;
break;
case 3:
++zPosition;
break;
case 4:
--xPosition;
break;
case 5:
++xPosition;
break;
}
Coordinate targetBlock=new Coordinate(xPosition,yPosition,zPosition,player);
Chest adjacentChest=server.data.chests.adjacentChest(targetBlock);
if (adjacentChest != null && !adjacentChest.isOpen() && !adjacentChest.ownedBy(player)) {
player.addTMessage(Color.RED,"String_Node_Str");
writePacket=false;
drop=true;
}
 else {
player.placingChest(targetBlock);
}
}
if (writePacket) {
write(packetId);
write(x);
write(y);
write(z);
write(direction);
write(dropItem);
if (dropItem != -1) {
write(itemCount);
write(uses);
if (dropItem <= 94 && direction >= 0) {
player.placedBlock();
}
}
player.openingChest(coordinate);
}
 else if (drop) {
write((byte)0x0e);
write((byte)0x04);
write(x);
write(y);
write(z);
write(direction);
}
break;
case 0x10:
write(packetId);
copyNBytes(2);
break;
case 0x11:
write(packetId);
copyNBytes(14);
break;
case 0x12:
write(packetId);
copyNBytes(5);
break;
case 0x13:
write(packetId);
write(in.readInt());
write(in.readByte());
break;
case 0x14:
int eid=in.readInt();
name=readUTF16();
if (!server.bots.ninja(name)) {
write(packetId);
write(eid);
write(name);
copyNBytes(16);
}
 else {
skipNBytes(16);
}
break;
case 0x15:
write(packetId);
copyNBytes(24);
break;
case 0x16:
write(packetId);
copyNBytes(8);
break;
case 0x17:
write(packetId);
write(in.readInt());
write(in.readByte());
write(in.readInt());
write(in.readInt());
write(in.readInt());
int flag=in.readInt();
write(flag);
if (flag > 0) {
write(in.readShort());
write(in.readShort());
write(in.readShort());
}
break;
case 0x18:
write(packetId);
write(in.readInt());
write(in.readByte());
write(in.readInt());
write(in.readInt());
write(in.readInt());
write(in.readByte());
write(in.readByte());
copyUnknownBlob();
break;
case 0x19:
write(packetId);
write(in.readInt());
write(readUTF16());
write(in.readInt());
write(in.readInt());
write(in.readInt());
write(in.readInt());
break;
case 0x1b:
write(packetId);
copyNBytes(18);
break;
case 0x1c:
write(packetId);
copyNBytes(10);
break;
case 0x1d:
write(packetId);
copyNBytes(4);
break;
case 0x1e:
write(packetId);
copyNBytes(4);
break;
case 0x1f:
write(packetId);
copyNBytes(7);
break;
case 0x20:
write(packetId);
copyNBytes(6);
break;
case 0x21:
write(packetId);
copyNBytes(9);
break;
case 0x22:
write(packetId);
copyNBytes(18);
break;
case 0x26:
write(packetId);
copyNBytes(5);
break;
case 0x27:
write(packetId);
copyNBytes(8);
break;
case 0x28:
write(packetId);
write(in.readInt());
copyUnknownBlob();
break;
case 0x32:
write(packetId);
copyNBytes(9);
break;
case 0x33:
write(packetId);
copyNBytes(13);
int chunkSize=in.readInt();
write(chunkSize);
copyNBytes(chunkSize);
break;
case 0x34:
write(packetId);
copyNBytes(8);
short arraySize=in.readShort();
write(arraySize);
copyNBytes(arraySize * 4);
break;
case 0x35:
write(packetId);
x=in.readInt();
y=in.readByte();
z=in.readInt();
byte blockType=in.readByte();
byte metadata=in.readByte();
coordinate=new Coordinate(x,y,z,player);
if (blockType == 54 && player.placedChest(coordinate)) {
lockChest(coordinate);
player.placingChest(null);
}
write(x);
write(y);
write(z);
write(blockType);
write(metadata);
break;
case 0x36:
write(packetId);
copyNBytes(12);
break;
case 0x3c:
write(packetId);
copyNBytes(28);
int recordCount=in.readInt();
write(recordCount);
copyNBytes(recordCount * 3);
break;
case 0x3d:
write(packetId);
write(in.readInt());
write(in.readInt());
write(in.readByte());
write(in.readInt());
write(in.readInt());
break;
case 0x46:
write(packetId);
copyNBytes(1);
break;
case 0x47:
write(packetId);
copyNBytes(17);
break;
case 0x64:
byte id=in.readByte();
byte invtype=in.readByte();
String typeString=in.readUTF();
byte unknownByte=in.readByte();
if (invtype == 0) {
if (!server.permissions.canOpenChests(player,player.openedChest())) {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
 else if (server.data.chests.canOpen(player,player.openedChest()) || player.isAdmin()) {
if (server.data.chests.isLocked(player.openedChest())) {
if (player.isAttemptingUnlock()) {
server.data.chests.unlock(player.openedChest());
server.data.save();
player.setAttemptedAction(null);
player.addTMessage(Color.RED,"String_Node_Str");
typeString=t("String_Node_Str");
}
 else {
typeString=server.data.chests.chestName(player.openedChest());
}
}
 else {
typeString=t("String_Node_Str");
if (player.isAttemptLock()) {
lockChest(player.openedChest());
typeString=player.nextChestName();
}
}
}
 else {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
}
write(packetId);
write(id);
write(invtype);
write8(typeString);
write(unknownByte);
break;
case 0x65:
write(packetId);
write(in.readByte());
break;
case 0x66:
byte typeFrom=in.readByte();
short slotFrom=in.readShort();
byte typeTo=in.readByte();
short slotTo=in.readShort();
write(packetId);
write(typeFrom);
write(slotFrom);
write(typeTo);
write(slotTo);
write(in.readBoolean());
short moveItem=in.readShort();
write(moveItem);
if (moveItem != -1) {
write(in.readByte());
write(in.readShort());
}
break;
case 0x67:
byte type67=in.readByte();
short slot=in.readShort();
short setItem=in.readShort();
write(packetId);
write(type67);
write(slot);
write(setItem);
if (setItem != -1) {
write(in.readByte());
write(in.readShort());
}
break;
case 0x68:
byte type=in.readByte();
write(packetId);
write(type);
short count=in.readShort();
write(count);
for (int c=0; c < count; ++c) {
short item=in.readShort();
write(item);
if (item != -1) {
write(in.readByte());
write(in.readShort());
}
}
break;
case 0x69:
write(packetId);
write(in.readByte());
write(in.readShort());
write(in.readShort());
break;
case 0x6a:
write(packetId);
write(in.readByte());
write(in.readShort());
write(in.readByte());
break;
case (byte)0x82:
write(packetId);
write(in.readInt());
write(in.readShort());
write(in.readInt());
write(readUTF16());
write(readUTF16());
write(readUTF16());
write(readUTF16());
break;
case (byte)0x83:
write(packetId);
write(in.readShort());
write(in.readShort());
byte length=in.readByte();
write(length);
copyNBytes(0xff & length);
break;
case (byte)0xc8:
write(packetId);
copyNBytes(5);
break;
case (byte)0xe6:
write(packetId);
write(in.readInt());
write(in.readInt());
copyNBytes(write(in.readInt()) * 4);
copyNBytes(write(in.readInt()) * 4);
int sizeString=write(in.readInt());
for (int i=0; i < sizeString; i++) {
copyNBytes(write(in.readInt()));
}
break;
case (byte)0xff:
write(packetId);
String reason=readUTF16();
write(reason);
if (reason.startsWith("String_Node_Str")) {
server.addRobot(player);
}
player.close();
break;
default :
if (EXPENSIVE_DEBUG_LOGGING) {
while (true) {
skipNBytes(1);
flushAll();
}
}
 else {
throw new IOException("String_Node_Str" + streamType + "String_Node_Str"+ Integer.toHexString(packetId)+ "String_Node_Str"+ player.getName()+ "String_Node_Str"+ Integer.toHexString(lastPacket));
}
}
packetFinished();
lastPacket=packetId;
}

Fixed version (ground truth):
private void handlePacket() throws IOException {
  Byte packetId=in.readByte();
  int x;
  byte y;
  int z;
  byte dimension;
  Coordinate coordinate;
switch (packetId) {
case 0x00:
    write(packetId);
  break;
case 0x01:
write(packetId);
if (isServerTunnel) {
player.setEntityId(in.readInt());
write(player.getEntityId());
}
 else {
write(in.readInt());
}
write(readUTF16());
write(in.readLong());
dimension=in.readByte();
if (isServerTunnel) {
player.setDimension(Dimension.get(dimension));
}
write(dimension);
break;
case 0x02:
String name=readUTF16();
if (isServerTunnel || player.setName(name)) {
tunneler.setName(streamType + "String_Node_Str" + player.getName());
write(packetId);
write(name);
}
break;
case 0x03:
String message=readUTF16();
Matcher joinMatcher=JOIN_PATTERN.matcher(message);
if (isServerTunnel && joinMatcher.find()) {
if (server.bots.ninja(joinMatcher.group(1))) {
break;
}
}
if (isServerTunnel && server.options.getBoolean("String_Node_Str")) {
Matcher colorMatcher=COLOR_PATTERN.matcher(message);
String cleanMessage=colorMatcher.replaceAll("String_Node_Str");
Matcher messageMatcher=MESSAGE_PATTERN.matcher(cleanMessage);
if (messageMatcher.find()) {
Player friend=server.findPlayerExact(messageMatcher.group(1));
if (friend != null) {
String color="String_Node_Str";
String title="String_Node_Str";
String format=server.options.get("String_Node_Str");
Group group=friend.getGroup();
if (group != null) {
color=group.getColor();
if (group.showTitle()) {
title=group.getName();
format=server.options.get("String_Node_Str");
}
}
try {
message=String.format(format,friend.getName(),title,color) + messageMatcher.group(2);
}
 catch (IllegalFormatException e) {
System.out.println("String_Node_Str");
}
}
}
 else if (cleanMessage.matches(CONSOLE_CHAT_PATTERN) && !server.options.getBoolean("String_Node_Str")) {
break;
}
if (server.options.getBoolean("String_Node_Str")) {
sendMessage(message);
}
 else {
if (message.length() > MAXIMUM_MESSAGE_SIZE) {
message=message.substring(0,MAXIMUM_MESSAGE_SIZE);
}
write(packetId);
write(message);
}
}
 else if (!isServerTunnel) {
if (player.isMuted() && !message.startsWith("String_Node_Str") && !message.startsWith("String_Node_Str")) {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
if (player.parseCommand(message)) {
break;
}
if (player.localChat() && !message.startsWith("String_Node_Str") && !message.startsWith("String_Node_Str")) {
player.execute(LocalSayCommand.class,message);
break;
}
if (message.length() > MAXIMUM_MESSAGE_SIZE) {
message=message.substring(0,MAXIMUM_MESSAGE_SIZE);
}
write(packetId);
write(message);
}
break;
case 0x04:
write(packetId);
long time=in.readLong();
server.setTime(time);
write(time);
break;
case 0x05:
write(packetId);
write(in.readInt());
write(in.readShort());
write(in.readShort());
write(in.readShort());
break;
case 0x06:
write(packetId);
copyNBytes(12);
break;
case 0x07:
int user=in.readInt();
int target=in.readInt();
Player targetPlayer=server.playerList.findPlayer(target);
if (targetPlayer != null) {
if (targetPlayer.godModeEnabled()) {
in.readBoolean();
break;
}
}
write(packetId);
write(user);
write(target);
write(in.readBoolean());
break;
case 0x08:
write(packetId);
copyNBytes(2);
break;
case 0x09:
write(packetId);
dimension=in.readByte();
write(dimension);
player.setDimension(Dimension.get(dimension));
break;
case 0x0a:
write(packetId);
copyNBytes(1);
if (!inGame && !isServerTunnel) {
player.sendMOTD();
if (server.options.getBoolean("String_Node_Str")) {
player.execute(PlayerListCommand.class);
}
inGame=true;
}
break;
case 0x0b:
write(packetId);
copyPlayerLocation();
copyNBytes(1);
break;
case 0x0c:
write(packetId);
copyPlayerLook();
copyNBytes(1);
break;
case 0x0d:
write(packetId);
copyPlayerLocation();
copyPlayerLook();
copyNBytes(1);
break;
case 0x0e:
if (!isServerTunnel) {
byte status=in.readByte();
x=in.readInt();
y=in.readByte();
z=in.readInt();
byte face=in.readByte();
coordinate=new Coordinate(x,y,z,player);
boolean[] perms=server.permissions.getPlayerBlockPermissions(player,coordinate,0);
if (!perms[2] && status == 0) {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
if (!perms[1] && status == 2) {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
boolean locked=server.data.chests.isLocked(coordinate);
if (!locked || player.isAdmin()) {
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:
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;
if (dropItem != -1) {
itemCount=in.readByte();
uses=in.readShort();
}
boolean writePacket=true;
boolean drop=false;
boolean[] perms=server.permissions.getPlayerBlockPermissions(player,coordinate,dropItem);
if (isServerTunnel || server.data.chests.isChest(coordinate)) {
}
 else if ((dropItem != -1 && !perms[0]) || (dropItem == -1 && !perms[2])) {
if (dropItem == -1) {
player.addTMessage(Color.RED,"String_Node_Str");
}
 else {
player.addTMessage(Color.RED,"String_Node_Str");
}
writePacket=false;
drop=true;
}
 else if (dropItem == 54) {
int xPosition=x;
byte yPosition=y;
int zPosition=z;
switch (direction) {
case 0:
--yPosition;
break;
case 1:
++yPosition;
break;
case 2:
--zPosition;
break;
case 3:
++zPosition;
break;
case 4:
--xPosition;
break;
case 5:
++xPosition;
break;
}
Coordinate targetBlock=new Coordinate(xPosition,yPosition,zPosition,player);
Chest adjacentChest=server.data.chests.adjacentChest(targetBlock);
if (adjacentChest != null && !adjacentChest.isOpen() && !adjacentChest.ownedBy(player)) {
player.addTMessage(Color.RED,"String_Node_Str");
writePacket=false;
drop=true;
}
 else {
player.placingChest(targetBlock);
}
}
if (writePacket) {
write(packetId);
write(x);
write(y);
write(z);
write(direction);
write(dropItem);
if (dropItem != -1) {
write(itemCount);
write(uses);
if (dropItem <= 94 && direction >= 0) {
player.placedBlock();
}
}
player.openingChest(coordinate);
}
 else if (drop) {
write((byte)0x0e);
write((byte)0x04);
write(x);
write(y);
write(z);
write(direction);
}
break;
case 0x10:
write(packetId);
copyNBytes(2);
break;
case 0x11:
write(packetId);
copyNBytes(14);
break;
case 0x12:
write(packetId);
copyNBytes(5);
break;
case 0x13:
write(packetId);
write(in.readInt());
write(in.readByte());
break;
case 0x14:
int eid=in.readInt();
name=readUTF16();
if (!server.bots.ninja(name)) {
write(packetId);
write(eid);
write(name);
copyNBytes(16);
}
 else {
skipNBytes(16);
}
break;
case 0x15:
write(packetId);
copyNBytes(24);
break;
case 0x16:
write(packetId);
copyNBytes(8);
break;
case 0x17:
write(packetId);
write(in.readInt());
write(in.readByte());
write(in.readInt());
write(in.readInt());
write(in.readInt());
int flag=in.readInt();
write(flag);
if (flag > 0) {
write(in.readShort());
write(in.readShort());
write(in.readShort());
}
break;
case 0x18:
write(packetId);
write(in.readInt());
write(in.readByte());
write(in.readInt());
write(in.readInt());
write(in.readInt());
write(in.readByte());
write(in.readByte());
copyUnknownBlob();
break;
case 0x19:
write(packetId);
write(in.readInt());
write(readUTF16());
write(in.readInt());
write(in.readInt());
write(in.readInt());
write(in.readInt());
break;
case 0x1b:
write(packetId);
copyNBytes(18);
break;
case 0x1c:
write(packetId);
copyNBytes(10);
break;
case 0x1d:
write(packetId);
copyNBytes(4);
break;
case 0x1e:
write(packetId);
copyNBytes(4);
break;
case 0x1f:
write(packetId);
copyNBytes(7);
break;
case 0x20:
write(packetId);
copyNBytes(6);
break;
case 0x21:
write(packetId);
copyNBytes(9);
break;
case 0x22:
write(packetId);
copyNBytes(18);
break;
case 0x26:
write(packetId);
copyNBytes(5);
break;
case 0x27:
write(packetId);
copyNBytes(8);
break;
case 0x28:
write(packetId);
write(in.readInt());
copyUnknownBlob();
break;
case 0x32:
write(packetId);
copyNBytes(9);
break;
case 0x33:
write(packetId);
copyNBytes(13);
int chunkSize=in.readInt();
write(chunkSize);
copyNBytes(chunkSize);
break;
case 0x34:
write(packetId);
copyNBytes(8);
short arraySize=in.readShort();
write(arraySize);
copyNBytes(arraySize * 4);
break;
case 0x35:
write(packetId);
x=in.readInt();
y=in.readByte();
z=in.readInt();
byte blockType=in.readByte();
byte metadata=in.readByte();
coordinate=new Coordinate(x,y,z,player);
if (blockType == 54 && player.placedChest(coordinate)) {
lockChest(coordinate);
player.placingChest(null);
}
write(x);
write(y);
write(z);
write(blockType);
write(metadata);
break;
case 0x36:
write(packetId);
copyNBytes(12);
break;
case 0x3c:
write(packetId);
copyNBytes(28);
int recordCount=in.readInt();
write(recordCount);
copyNBytes(recordCount * 3);
break;
case 0x3d:
write(packetId);
write(in.readInt());
write(in.readInt());
write(in.readByte());
write(in.readInt());
write(in.readInt());
break;
case 0x46:
write(packetId);
copyNBytes(1);
break;
case 0x47:
write(packetId);
copyNBytes(17);
break;
case 0x64:
byte id=in.readByte();
byte invtype=in.readByte();
String typeString=in.readUTF();
byte unknownByte=in.readByte();
if (invtype == 0) {
if (!server.permissions.canOpenChests(player,player.openedChest())) {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
 else if (server.data.chests.canOpen(player,player.openedChest()) || player.isAdmin()) {
if (server.data.chests.isLocked(player.openedChest())) {
if (player.isAttemptingUnlock()) {
server.data.chests.unlock(player.openedChest());
server.data.save();
player.setAttemptedAction(null);
player.addTMessage(Color.RED,"String_Node_Str");
typeString=t("String_Node_Str");
}
 else {
typeString=server.data.chests.chestName(player.openedChest());
}
}
 else {
typeString=t("String_Node_Str");
if (player.isAttemptLock()) {
lockChest(player.openedChest());
typeString=player.nextChestName();
}
}
}
 else {
player.addTMessage(Color.RED,"String_Node_Str");
break;
}
}
write(packetId);
write(id);
write(invtype);
write8(typeString);
write(unknownByte);
break;
case 0x65:
write(packetId);
write(in.readByte());
break;
case 0x66:
byte typeFrom=in.readByte();
short slotFrom=in.readShort();
byte typeTo=in.readByte();
short slotTo=in.readShort();
write(packetId);
write(typeFrom);
write(slotFrom);
write(typeTo);
write(slotTo);
write(in.readBoolean());
short moveItem=in.readShort();
write(moveItem);
if (moveItem != -1) {
write(in.readByte());
write(in.readShort());
}
break;
case 0x67:
byte type67=in.readByte();
short slot=in.readShort();
short setItem=in.readShort();
write(packetId);
write(type67);
write(slot);
write(setItem);
if (setItem != -1) {
write(in.readByte());
write(in.readShort());
}
break;
case 0x68:
byte type=in.readByte();
write(packetId);
write(type);
short count=in.readShort();
write(count);
for (int c=0; c < count; ++c) {
short item=in.readShort();
write(item);
if (item != -1) {
write(in.readByte());
write(in.readShort());
}
}
break;
case 0x69:
write(packetId);
write(in.readByte());
write(in.readShort());
write(in.readShort());
break;
case 0x6a:
write(packetId);
write(in.readByte());
write(in.readShort());
write(in.readByte());
break;
case (byte)0x82:
write(packetId);
write(in.readInt());
write(in.readShort());
write(in.readInt());
write(readUTF16());
write(readUTF16());
write(readUTF16());
write(readUTF16());
break;
case (byte)0x83:
write(packetId);
write(in.readShort());
write(in.readShort());
byte length=in.readByte();
write(length);
copyNBytes(0xff & length);
break;
case (byte)0xc8:
write(packetId);
copyNBytes(5);
break;
case (byte)0xe6:
write(packetId);
write(in.readInt());
write(in.readInt());
copyNBytes(write(in.readInt()) * 4);
copyNBytes(write(in.readInt()) * 4);
int sizeString=write(in.readInt());
for (int i=0; i < sizeString; i++) {
copyNBytes(write(in.readInt()));
}
break;
case (byte)0xff:
write(packetId);
String reason=readUTF16();
write(reason);
if (reason.startsWith("String_Node_Str")) {
server.addRobot(player);
}
player.close();
break;
default :
if (EXPENSIVE_DEBUG_LOGGING) {
while (true) {
skipNBytes(1);
flushAll();
}
}
 else {
throw new IOException("String_Node_Str" + streamType + "String_Node_Str"+ Integer.toHexString(packetId)+ "String_Node_Str"+ player.getName()+ "String_Node_Str"+ Integer.toHexString(lastPacket));
}
}
packetFinished();
lastPacket=packetId;
}