Program: 109374
Project: 109374
Buggy source:
@EventHandler public void onPacketProcess(PacketProcessEvent event){
  Packet packet=event.getPacket();
switch (packet.getId()) {
case 0:
    connectionHandler.sendPacket(new Packet0KeepAlive(new Random().nextInt()));
  break;
case 3:
String message=((Packet3Chat)packet).message;
message=Util.stripColors(message);
System.out.println("String_Node_Str" + bot.getSession().getUsername() + "String_Node_Str"+ message);
String testMessage="String_Node_Str";
String testMessage2="String_Node_Str";
String testMessage3="String_Node_Str";
if (message.contains(testMessage)) {
try {
String captcha=message.split(Pattern.quote(testMessage))[1].split("String_Node_Str")[0];
ScriptEngineManager mgr=new ScriptEngineManager();
ScriptEngine engine=mgr.getEngineByName("String_Node_Str");
String solved=engine.eval(captcha).toString();
solved=solved.split("String_Node_Str")[0];
connectionHandler.sendPacket(new Packet3Chat(solved));
}
 catch (Exception exception) {
exception.printStackTrace();
}
}
 else if (message.contains(testMessage2) && message.contains(testMessage3)) {
try {
String captcha=message.split(Pattern.quote(testMessage2))[1].split(Pattern.quote(testMessage3))[0];
connectionHandler.sendPacket(new Packet3Chat(captcha));
}
 catch (Exception exception) {
exception.printStackTrace();
}
}
 else if (message.startsWith("String_Node_Str")) {
String password=Util.generateRandomString(10 + random.nextInt(6));
bot.say("String_Node_Str" + password + "String_Node_Str"+ password);
}
 else if (message.startsWith("String_Node_Str")) {
connectionHandler.sendPacket(new Packet3Chat(message));
}
 else if ((message.contains("String_Node_Str") && message.contains("String_Node_Str")) || message.contains("String_Node_Str")) {
connectionHandler.sendPacket(new Packet3Chat("String_Node_Str"));
}
 else if (message.contains(owner + "String_Node_Str")) {
connectionHandler.sendPacket(new Packet3Chat("String_Node_Str"));
}
 else if (message.contains(owner)) {
if (message.contains("String_Node_Str")) {
spamMessage=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length());
}
 else if (message.contains("String_Node_Str")) {
spamMessage=null;
bot.getTaskManager().stopAll();
bot.setActivity(null);
}
 else if (message.contains("String_Node_Str")) {
die=true;
bot.getTaskManager().stopAll();
bot.setActivity(null);
}
 else if (message.contains("String_Node_Str")) {
connectionHandler.sendPacket(new Packet3Chat(message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length())));
}
 else if (message.contains("String_Node_Str")) {
connectionHandler.sendPacket(new Packet255KickDisconnect("String_Node_Str"));
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
if (player == null) return;
PlayerInventory inventory=player.getInventory();
inventory.setCurrentHeldSlot(Integer.parseInt(message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str")[0]));
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
PlayerInventory inventory=player.getInventory();
String substring=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str")[0];
int id=Integer.parseInt(substring);
for (int slot=0; slot < 40; slot++) {
ItemStack item=inventory.getItemAt(slot);
if (item != null && item.getId() == id) {
inventory.selectItemAt(slot,true);
inventory.dropSelectedItem();
}
}
inventory.close();
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
PlayerInventory inventory=player.getInventory();
if (message.contains("String_Node_Str")) {
String substring=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str")[0];
try {
int slot=Integer.parseInt(substring);
if (slot < 0 || slot >= 40) return;
if (inventory.getItemAt(slot) != null) {
inventory.selectItemAt(slot,true);
inventory.dropSelectedItem();
}
return;
}
 catch (NumberFormatException e) {
}
}
for (int slot=0; slot < 40; slot++) {
if (inventory.getItemAt(slot) != null) {
inventory.selectItemAt(slot,true);
inventory.dropSelectedItem();
}
}
inventory.close();
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
PlayerInventory inventory=player.getInventory();
String substring=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length());
try {
int slot1=Integer.parseInt(substring.split("String_Node_Str")[0]);
int slot2=Integer.parseInt(substring.split("String_Node_Str")[1]);
if (slot1 < 0 || slot1 >= 45 || slot2 < 0 || slot2 >= 45) return;
inventory.selectItemAt(slot1);
inventory.selectItemAt(slot2);
inventory.selectItemAt(slot1);
}
 catch (NumberFormatException e) {
}
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
PlayerInventory inventory=player.getInventory();
boolean helmet=inventory.getArmorAt(0) != null;
boolean chestplate=inventory.getArmorAt(1) != null;
boolean leggings=inventory.getArmorAt(2) != null;
boolean boots=inventory.getArmorAt(3) != null;
boolean changed=false;
for (int i=0; i < 36; i++) {
ItemStack item=inventory.getItemAt(i);
if (item == null) continue;
int armorSlot;
int id=item.getId();
if (!helmet && (id == 86 || id == 298 || id == 302 || id == 306 || id == 310 || id == 314)) {
armorSlot=0;
helmet=true;
}
 else if (!chestplate && (id == 299 || id == 303 || id == 307 || id == 311 || id == 315)) {
armorSlot=1;
chestplate=true;
}
 else if (!leggings && (id == 300 || id == 304 || id == 308 || id == 312 || id == 316)) {
armorSlot=2;
leggings=true;
}
 else if (!boots && (id == 301 || id == 305 || id == 309 || id == 313 || id == 317)) {
armorSlot=3;
boots=true;
}
 else if (helmet && chestplate && leggings&& boots) break;
 else continue;
inventory.selectItemAt(i);
inventory.selectArmorAt(armorSlot);
changed=true;
}
if (!changed) {
for (int i=0; i < 36; i++) {
ItemStack item=inventory.getItemAt(i);
if (item != null) continue;
int armorSlot;
if (helmet) {
armorSlot=0;
helmet=false;
}
 else if (chestplate) {
armorSlot=1;
chestplate=false;
}
 else if (leggings) {
armorSlot=2;
leggings=false;
}
 else if (boots) {
armorSlot=3;
boots=false;
}
 else if (!helmet && !chestplate && !leggings&& !boots) break;
 else continue;
inventory.selectArmorAt(armorSlot);
inventory.selectItemAt(i);
}
}
inventory.close();
bot.say("String_Node_Str");
}
 else if (message.contains("String_Node_Str")) {
String name=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str")[0];
owner=name;
bot.say("String_Node_Str" + name);
}
 else if (message.contains("String_Node_Str")) {
String[] args=new String[0];
if (message.trim().contains("String_Node_Str")) args=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str");
String name=owner;
if (args.length > 0) {
name=args[0];
if (name.equalsIgnoreCase(owner)) {
name=owner;
args=new String[0];
}
}
FollowTask followTask=bot.getTaskManager().getTaskFor(FollowTask.class);
if (followTask.isActive()) followTask.stop();
for (Entity entity : bot.getWorld().getEntities()) {
if (entity instanceof PlayerEntity && Util.stripColors(((PlayerEntity)entity).getName()).equalsIgnoreCase(name)) {
followTask.follow(entity);
bot.say("String_Node_Str" + (args.length > 0 ? Util.stripColors(((PlayerEntity)entity).getName()) : "String_Node_Str") + "String_Node_Str");
return;
}
}
bot.say("String_Node_Str" + name + "String_Node_Str");
}
 else if (message.contains("String_Node_Str")) {
String[] args=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str");
String name=args[0];
AttackTask attackTask=bot.getTaskManager().getTaskFor(AttackTask.class);
for (Entity entity : bot.getWorld().getEntities()) {
if (entity instanceof PlayerEntity && Util.stripColors(((PlayerEntity)entity).getName()).equalsIgnoreCase(name)) {
attackTask.setAttackEntity(entity);
bot.say("String_Node_Str" + Util.stripColors(((PlayerEntity)entity).getName()) + "String_Node_Str");
return;
}
}
bot.say("String_Node_Str" + name + "String_Node_Str");
}
 else if (message.contains("String_Node_Str")) {
String[] args=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str");
MainPlayerEntity player=bot.getPlayer();
BlockLocation location=new BlockLocation(player.getLocation());
boolean relativeX=args[0].charAt(0) == '+', relativeZ=args[args.length - 1].charAt(0) == '+';
int x, y, z;
if (relativeX) x=location.getX() + Integer.parseInt(args[0].substring(1));
 else x=Integer.parseInt(args[0]);
if (relativeZ) z=location.getZ() + Integer.parseInt(args[args.length - 1].substring(1));
 else z=Integer.parseInt(args[args.length - 1]);
if (args.length < 3) {
World world=bot.getWorld();
for (y=256; y > 0; y--) {
int id=world.getBlockIdAt(x,y - 1,z);
if (BlockType.getById(id).isSolid()) break;
}
if (y <= 0) {
bot.say("String_Node_Str");
return;
}
}
 else y=Integer.parseInt(args[1]);
BlockLocation target=new BlockLocation(x,y,z);
bot.setActivity(new WalkActivity(bot,target));
bot.say("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ z+ "String_Node_Str");
}
 else if (message.contains("String_Node_Str")) {
HostileTask task=bot.getTaskManager().getTaskFor(HostileTask.class);
if (task.isActive()) {
task.stop();
bot.say("String_Node_Str");
}
 else {
task.start();
bot.say("String_Node_Str");
}
}
}
 else if (message.contains("String_Node_Str") && spamMessage != null && createFaction) {
String msg="String_Node_Str" + Util.generateRandomString(7 + random.nextInt(4));
bot.say(msg);
}
break;
case 8:
Packet8UpdateHealth updateHealth=(Packet8UpdateHealth)packet;
if (updateHealth.healthMP <= 0) connectionHandler.sendPacket(new Packet205ClientCommand(1));
break;
case 9:
TaskManager taskManager=bot.getTaskManager();
taskManager.stopAll();
bot.setActivity(null);
break;
}
}

Fixed version (ground truth):
@EventHandler public void onPacketProcess(PacketProcessEvent event){
  Packet packet=event.getPacket();
switch (packet.getId()) {
case 0:
    connectionHandler.sendPacket(new Packet0KeepAlive(new Random().nextInt()));
  break;
case 3:
String message=((Packet3Chat)packet).message;
message=Util.stripColors(message);
System.out.println("String_Node_Str" + bot.getSession().getUsername() + "String_Node_Str"+ message);
String testMessage="String_Node_Str";
String testMessage2="String_Node_Str";
String testMessage3="String_Node_Str";
if (message.contains(testMessage)) {
try {
String captcha=message.split(Pattern.quote(testMessage))[1].split("String_Node_Str")[0];
ScriptEngineManager mgr=new ScriptEngineManager();
ScriptEngine engine=mgr.getEngineByName("String_Node_Str");
String solved=engine.eval(captcha).toString();
solved=solved.split("String_Node_Str")[0];
connectionHandler.sendPacket(new Packet3Chat(solved));
}
 catch (Exception exception) {
exception.printStackTrace();
}
}
 else if (message.contains(testMessage2) && message.contains(testMessage3)) {
try {
String captcha=message.split(Pattern.quote(testMessage2))[1].split(Pattern.quote(testMessage3))[0];
connectionHandler.sendPacket(new Packet3Chat(captcha));
}
 catch (Exception exception) {
exception.printStackTrace();
}
}
 else if (message.startsWith("String_Node_Str")) {
String password=Util.generateRandomString(10 + random.nextInt(6));
bot.say("String_Node_Str" + password + "String_Node_Str"+ password);
}
 else if (message.startsWith("String_Node_Str")) {
connectionHandler.sendPacket(new Packet3Chat(message));
}
 else if ((message.contains("String_Node_Str") && message.contains("String_Node_Str")) || message.contains("String_Node_Str")) {
connectionHandler.sendPacket(new Packet3Chat("String_Node_Str"));
}
 else if (message.contains(owner + "String_Node_Str")) {
connectionHandler.sendPacket(new Packet3Chat("String_Node_Str"));
}
 else if (message.contains(owner)) {
if (message.contains("String_Node_Str")) {
spamMessage=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length());
}
 else if (message.contains("String_Node_Str")) {
spamMessage=null;
bot.getTaskManager().stopAll();
bot.setActivity(null);
}
 else if (message.contains("String_Node_Str")) {
die=true;
bot.getTaskManager().stopAll();
bot.setActivity(null);
}
 else if (message.contains("String_Node_Str")) {
connectionHandler.sendPacket(new Packet3Chat(message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length())));
}
 else if (message.contains("String_Node_Str")) {
connectionHandler.sendPacket(new Packet255KickDisconnect("String_Node_Str"));
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
if (player == null) return;
PlayerInventory inventory=player.getInventory();
inventory.setCurrentHeldSlot(Integer.parseInt(message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str")[0]));
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
PlayerInventory inventory=player.getInventory();
String substring=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str")[0];
int id=Integer.parseInt(substring);
for (int slot=0; slot < 40; slot++) {
ItemStack item=inventory.getItemAt(slot);
if (item != null && item.getId() == id) {
inventory.selectItemAt(slot,true);
inventory.dropSelectedItem();
}
}
inventory.close();
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
PlayerInventory inventory=player.getInventory();
if (message.contains("String_Node_Str")) {
String substring=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str")[0];
try {
int slot=Integer.parseInt(substring);
if (slot < 0 || slot >= 40) return;
if (inventory.getItemAt(slot) != null) {
inventory.selectItemAt(slot,true);
inventory.dropSelectedItem();
}
return;
}
 catch (NumberFormatException e) {
}
}
for (int slot=0; slot < 40; slot++) {
if (inventory.getItemAt(slot) != null) {
inventory.selectItemAt(slot,true);
inventory.dropSelectedItem();
}
}
inventory.close();
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
PlayerInventory inventory=player.getInventory();
String substring=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length());
try {
int slot1=Integer.parseInt(substring.split("String_Node_Str")[0]);
int slot2=Integer.parseInt(substring.split("String_Node_Str")[1]);
if (slot1 < 0 || slot1 >= 45 || slot2 < 0 || slot2 >= 45) return;
inventory.selectItemAt(slot1);
inventory.selectItemAt(slot2);
inventory.selectItemAt(slot1);
}
 catch (NumberFormatException e) {
}
}
 else if (message.contains("String_Node_Str")) {
MainPlayerEntity player=bot.getPlayer();
PlayerInventory inventory=player.getInventory();
boolean helmet=inventory.getArmorAt(0) != null;
boolean chestplate=inventory.getArmorAt(1) != null;
boolean leggings=inventory.getArmorAt(2) != null;
boolean boots=inventory.getArmorAt(3) != null;
boolean changed=false;
for (int i=0; i < 36; i++) {
ItemStack item=inventory.getItemAt(i);
if (item == null) continue;
int armorSlot;
int id=item.getId();
if (!helmet && (id == 86 || id == 298 || id == 302 || id == 306 || id == 310 || id == 314)) {
armorSlot=0;
helmet=true;
}
 else if (!chestplate && (id == 299 || id == 303 || id == 307 || id == 311 || id == 315)) {
armorSlot=1;
chestplate=true;
}
 else if (!leggings && (id == 300 || id == 304 || id == 308 || id == 312 || id == 316)) {
armorSlot=2;
leggings=true;
}
 else if (!boots && (id == 301 || id == 305 || id == 309 || id == 313 || id == 317)) {
armorSlot=3;
boots=true;
}
 else if (helmet && chestplate && leggings&& boots) break;
 else continue;
inventory.selectItemAt(i);
inventory.selectArmorAt(armorSlot);
changed=true;
}
if (!changed) {
for (int i=0; i < 36; i++) {
ItemStack item=inventory.getItemAt(i);
if (item != null) continue;
int armorSlot;
if (helmet) {
armorSlot=0;
helmet=false;
}
 else if (chestplate) {
armorSlot=1;
chestplate=false;
}
 else if (leggings) {
armorSlot=2;
leggings=false;
}
 else if (boots) {
armorSlot=3;
boots=false;
}
 else if (!helmet && !chestplate && !leggings&& !boots) break;
 else continue;
inventory.selectArmorAt(armorSlot);
inventory.selectItemAt(i);
}
}
inventory.close();
bot.say("String_Node_Str" + owner + "String_Node_Str");
}
 else if (message.contains("String_Node_Str")) {
String name=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str")[0];
owner=name;
bot.say("String_Node_Str" + owner + "String_Node_Str"+ name);
}
 else if (message.contains("String_Node_Str")) {
String[] args=new String[0];
if (message.trim().contains("String_Node_Str")) args=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str");
String name=owner;
if (args.length > 0) {
name=args[0];
if (name.equalsIgnoreCase(owner)) {
name=owner;
args=new String[0];
}
}
FollowTask followTask=bot.getTaskManager().getTaskFor(FollowTask.class);
if (followTask.isActive()) followTask.stop();
for (Entity entity : bot.getWorld().getEntities()) {
if (entity instanceof PlayerEntity && Util.stripColors(((PlayerEntity)entity).getName()).equalsIgnoreCase(name)) {
followTask.follow(entity);
bot.say("String_Node_Str" + owner + "String_Node_Str"+ (args.length > 0 ? Util.stripColors(((PlayerEntity)entity).getName()) : "String_Node_Str")+ "String_Node_Str");
return;
}
}
bot.say("String_Node_Str" + owner + "String_Node_Str"+ name+ "String_Node_Str");
}
 else if (message.contains("String_Node_Str")) {
String[] args=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str");
String name=args[0];
AttackTask attackTask=bot.getTaskManager().getTaskFor(AttackTask.class);
for (Entity entity : bot.getWorld().getEntities()) {
if (entity instanceof PlayerEntity && Util.stripColors(((PlayerEntity)entity).getName()).equalsIgnoreCase(name)) {
attackTask.setAttackEntity(entity);
bot.say("String_Node_Str" + owner + "String_Node_Str"+ Util.stripColors(((PlayerEntity)entity).getName())+ "String_Node_Str");
return;
}
}
bot.say("String_Node_Str" + owner + "String_Node_Str"+ name+ "String_Node_Str");
}
 else if (message.contains("String_Node_Str")) {
String[] args=message.substring(message.indexOf("String_Node_Str") + "String_Node_Str".length()).split("String_Node_Str");
MainPlayerEntity player=bot.getPlayer();
BlockLocation location=new BlockLocation(player.getLocation());
boolean relativeX=args[0].charAt(0) == '+', relativeZ=args[args.length - 1].charAt(0) == '+';
int x, y, z;
if (relativeX) x=location.getX() + Integer.parseInt(args[0].substring(1));
 else x=Integer.parseInt(args[0]);
if (relativeZ) z=location.getZ() + Integer.parseInt(args[args.length - 1].substring(1));
 else z=Integer.parseInt(args[args.length - 1]);
if (args.length < 3) {
World world=bot.getWorld();
for (y=256; y > 0; y--) {
int id=world.getBlockIdAt(x,y - 1,z);
if (BlockType.getById(id).isSolid()) break;
}
if (y <= 0) {
bot.say("String_Node_Str" + owner + "String_Node_Str");
return;
}
}
 else y=Integer.parseInt(args[1]);
BlockLocation target=new BlockLocation(x,y,z);
player.getLocation().getDistanceTo(new WorldLocation(target));
bot.setActivity(new WalkActivity(bot,target));
bot.say("String_Node_Str" + owner + "String_Node_Str"+ x+ "String_Node_Str"+ y+ "String_Node_Str"+ z+ "String_Node_Str");
}
 else if (message.contains("String_Node_Str")) {
HostileTask task=bot.getTaskManager().getTaskFor(HostileTask.class);
task.start();
bot.say("String_Node_Str" + owner + "String_Node_Str");
}
}
 else if (message.contains("String_Node_Str") && spamMessage != null && createFaction) {
String msg="String_Node_Str" + Util.generateRandomString(7 + random.nextInt(4));
bot.say(msg);
}
break;
case 8:
Packet8UpdateHealth updateHealth=(Packet8UpdateHealth)packet;
if (updateHealth.healthMP <= 0) connectionHandler.sendPacket(new Packet205ClientCommand(1));
break;
case 9:
TaskManager taskManager=bot.getTaskManager();
taskManager.stopAll();
bot.setActivity(null);
break;
}
}