Program: 152192
Project: 152192
Buggy source:
public void handleMining(final GameObject object,Player owner,int click){
  if (owner.isBusy() && !owner.inCombat()) {
    return;
  }
  if (!owner.withinRange(object,1))   return;
  final GameObject newobject=Instance.getWorld().getTile(object.getX(),object.getY()).getGameObject();
  final ObjectMiningDef def=EntityHandler.getObjectMiningDef(newobject.getID());
  if (def == null || def.getRespawnTime() < 1) {
    owner.getActionSender().sendMessage("String_Node_Str");
    return;
  }
  final InvItem ore=new InvItem(def.getOreId());
  if (owner.getClick() == 1) {
    owner.getActionSender().sendMessage("String_Node_Str" + ore.getDef().getName() + "String_Node_Str");
    return;
  }
  if (owner.getCurStat(14) < def.getReqLevel()) {
    owner.getActionSender().sendMessage("String_Node_Str" + def.getReqLevel() + "String_Node_Str");
    return;
  }
  int axeId=getAxe(owner);
  if (axeId < 0) {
    owner.getActionSender().sendMessage("String_Node_Str");
    return;
  }
  final int axeID=axeId;
  int retrytimes=-1;
  final int swings=owner.getSkillLoops();
  final int mineLvl=owner.getCurStat(14);
  int reqlvl=1;
switch (axeID) {
case 1258:
    retrytimes=2;
  break;
case 1259:
retrytimes=4;
reqlvl=6;
break;
case 1260:
retrytimes=6;
reqlvl=21;
break;
case 1261:
retrytimes=8;
reqlvl=31;
break;
case 1262:
retrytimes=12;
reqlvl=41;
break;
}
if (reqlvl > mineLvl) {
owner.getActionSender().sendMessage("String_Node_Str" + reqlvl + "String_Node_Str");
return;
}
owner.setBusy(true);
owner.getActionSender().sendSound("String_Node_Str");
Bubble bubble=new Bubble(owner,axeId);
for (Player p : owner.getViewArea().getPlayersInView()) {
p.informOfBubble(bubble);
}
final int retrytime=retrytimes;
owner.setLastMineTimer(GameEngine.getTime());
owner.getActionSender().sendMessage("String_Node_Str");
Instance.getDelayedEventHandler().add(new ShortEvent(owner){
public void action(){
if (Formulae.getOre(def,owner.getCurStat(14),axeID)) {
if (DataConversions.random(0,200) == 0) {
InvItem gem=new InvItem(Formulae.getGem(),1);
owner.incExp(14,100,true);
owner.getInventory().add(gem);
owner.getActionSender().sendMessage("String_Node_Str");
}
 else {
owner.getInventory().add(ore);
owner.getActionSender().sendMessage("String_Node_Str" + ore.getDef().getName() + "String_Node_Str");
owner.incExp(14,def.getExp(),true);
owner.getActionSender().sendStat(14);
world.registerGameObject(new GameObject(object.getLocation(),98,object.getDirection(),object.getType()));
world.delayedSpawnObject(newobject.getLoc(),def.getRespawnTime() * 1000);
}
owner.isMining(false);
owner.setSkillLoops(0);
owner.getActionSender().sendInventory();
}
 else {
boolean retry=false;
if (retrytime - swings > 0) retry=true;
owner.getActionSender().sendMessage("String_Node_Str");
if (retry) {
world.getDelayedEventHandler().add(new SingleEvent(owner,500){
public void action(){
if (!owner.isMining() || owner.inCombat()) {
return;
}
owner.setSkillLoops(swings + 1);
handleMining(object,owner,owner.getClick());
}
}
);
}
if (!retry) {
owner.isMining(false);
owner.setSkillLoops(0);
}
}
owner.setBusy(false);
}
}
);
}

Fixed version (ground truth):
public void handleMining(final GameObject object,Player owner,int click){
  if (owner.isBusy() && !owner.inCombat()) {
    return;
  }
  if (!owner.withinRange(object,1))   return;
  final GameObject newobject=Instance.getWorld().getTile(object.getX(),object.getY()).getGameObject();
  final ObjectMiningDef def=EntityHandler.getObjectMiningDef(newobject.getID());
  if (def == null || def.getRespawnTime() < 1) {
    owner.getActionSender().sendMessage("String_Node_Str");
    return;
  }
  final InvItem ore=new InvItem(def.getOreId());
  if (owner.getClick() == 1) {
    owner.getActionSender().sendMessage("String_Node_Str" + ore.getDef().getName() + "String_Node_Str");
    return;
  }
  if (owner.getCurStat(14) < def.getReqLevel()) {
    owner.getActionSender().sendMessage("String_Node_Str" + def.getReqLevel() + "String_Node_Str");
    return;
  }
  int axeId=getAxe(owner);
  if (axeId < 0) {
    owner.getActionSender().sendMessage("String_Node_Str");
    return;
  }
  final int axeID=axeId;
  int retrytimes=-1;
  final int swings=owner.getSkillLoops();
  final int mineLvl=owner.getCurStat(14);
  int reqlvl=1;
switch (axeID) {
case 1258:
    retrytimes=2;
  break;
case 1259:
retrytimes=4;
reqlvl=6;
break;
case 1260:
retrytimes=6;
reqlvl=21;
break;
case 1261:
retrytimes=8;
reqlvl=31;
break;
case 1262:
retrytimes=12;
reqlvl=41;
break;
}
if (reqlvl > mineLvl) {
owner.getActionSender().sendMessage("String_Node_Str" + reqlvl + "String_Node_Str");
return;
}
owner.setBusy(true);
owner.isMining(true);
owner.getActionSender().sendSound("String_Node_Str");
Bubble bubble=new Bubble(owner,axeId);
for (Player p : owner.getViewArea().getPlayersInView()) {
p.informOfBubble(bubble);
}
final int retrytime=retrytimes;
owner.setLastMineTimer(GameEngine.getTime());
owner.getActionSender().sendMessage("String_Node_Str");
Instance.getDelayedEventHandler().add(new ShortEvent(owner){
public void action(){
if (!owner.isMining()) {
owner.setBusy(false);
return;
}
if (Formulae.getOre(def,owner.getCurStat(14),axeID)) {
if (DataConversions.random(0,200) == 0) {
InvItem gem=new InvItem(Formulae.getGem(),1);
owner.incExp(14,100,true);
owner.getInventory().add(gem);
owner.getActionSender().sendMessage("String_Node_Str");
}
 else {
owner.getInventory().add(ore);
owner.getActionSender().sendMessage("String_Node_Str" + ore.getDef().getName() + "String_Node_Str");
owner.incExp(14,def.getExp(),true);
owner.getActionSender().sendStat(14);
world.registerGameObject(new GameObject(object.getLocation(),98,object.getDirection(),object.getType()));
world.delayedSpawnObject(newobject.getLoc(),def.getRespawnTime() * 1000);
}
owner.isMining(false);
owner.setSkillLoops(0);
owner.getActionSender().sendInventory();
}
 else {
boolean retry=false;
if (retrytime - swings > 0) retry=true;
owner.getActionSender().sendMessage("String_Node_Str");
if (retry) {
world.getDelayedEventHandler().add(new SingleEvent(owner,500){
public void action(){
if (!owner.isMining() || owner.inCombat()) {
return;
}
owner.setSkillLoops(swings + 1);
handleMining(object,owner,owner.getClick());
}
}
);
}
if (!retry) {
owner.isMining(false);
owner.setSkillLoops(0);
}
}
owner.setBusy(false);
}
}
);
}