Program: 51675
Project: 51675
Buggy source:
@Override public void managerMode(InventoryClickEvent event){
  boolean top=event.getView().convertSlot(event.getRawSlot()) == event.getRawSlot();
  Player p=(Player)event.getWhoClicked();
  DecimalFormat f=new DecimalFormat("String_Node_Str");
  if (top) {
    setInventoryClicked(true);
    if (isManagementSlot(event.getSlot(),3)) {
      if (isWool(event.getCurrentItem(),(byte)0) && event.getSlot() == getInventory().getSize() - 2) {
        setTraderStatus(TraderStatus.PLAYER_MANAGE_PRICE);
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)15));
        getInventory().setItem(getInventory().getSize() - 3,new ItemStack(Material.AIR));
      }
 else       if (isWool(event.getCurrentItem(),(byte)15)) {
        if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3))         setTraderStatus(TraderStatus.PLAYER_MANAGE_BUY);
        if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))         setTraderStatus(TraderStatus.PLAYER_MANAGE_SELL);
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)0));
        getInventory().setItem(getInventory().getSize() - 3,new ItemStack(Material.WOOL,1,(short)0,(byte)0));
      }
 else       if (isWool(event.getCurrentItem(),(byte)0) && event.getSlot() == getInventory().getSize() - 3) {
        setTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_GLOBAL);
        getInventory().setItem(getInventory().getSize() - 3,new ItemStack(Material.WOOL,1,(short)0,(byte)13));
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)12));
      }
 else       if (isWool(event.getCurrentItem(),(byte)12)) {
        setTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_PLAYER);
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)11));
      }
 else       if (isWool(event.getCurrentItem(),(byte)11)) {
        setTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_GLOBAL);
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)12));
      }
 else       if (isWool(event.getCurrentItem(),(byte)13)) {
        if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3))         setTraderStatus(TraderStatus.PLAYER_MANAGE_BUY);
        if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))         setTraderStatus(TraderStatus.PLAYER_MANAGE_SELL);
        getInventory().setItem(getInventory().getSize() - 3,new ItemStack(Material.WOOL,1,(short)0,(byte)0));
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)0));
      }
 else       if (isWool(event.getCurrentItem(),(byte)5)) {
        switchInventory(TraderStatus.PLAYER_MANAGE_BUY);
      }
 else       if (isWool(event.getCurrentItem(),(byte)3)) {
        switchInventory(TraderStatus.PLAYER_MANAGE_SELL);
      }
 else       if (isWool(event.getCurrentItem(),(byte)14)) {
        saveManagedAmouts();
        switchInventory(TraderStatus.PLAYER_MANAGE_SELL);
      }
      event.setCancelled(true);
    }
 else {
      if (event.isShiftClick()) {
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_GLOBAL)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isBuyModeByWool()) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalTimeout());
            }
 else             if (isSellModeByWool())             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalTimeout());
          }
 else {
            if (isBuyModeByWool()) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().getLimitSystem().changeGlobalTimeout(-calculateTimeout(event.getCursor()));
 else                 getSelectedItem().getLimitSystem().changeGlobalTimeout(calculateTimeout(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalTimeout());
              }
            }
 else             if (isSellModeByWool())             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().getLimitSystem().changeGlobalTimeout(-calculateTimeout(event.getCursor()));
 else               getSelectedItem().getLimitSystem().changeGlobalTimeout(calculateTimeout(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalTimeout());
            }
          }
          event.setCancelled(true);
          return;
        }
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_PLAYER)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isBuyModeByWool()) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerTimeout());
            }
 else             if (isSellModeByWool())             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerTimeout());
          }
 else {
            if (isBuyModeByWool()) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().getLimitSystem().changePlayerTimeout(-calculateTimeout(event.getCursor()));
 else                 getSelectedItem().getLimitSystem().changePlayerTimeout(calculateTimeout(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerTimeout());
              }
            }
 else             if (isSellModeByWool())             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().getLimitSystem().changePlayerTimeout(-calculateTimeout(event.getCursor()));
 else               getSelectedItem().getLimitSystem().changePlayerTimeout(calculateTimeout(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerTimeout());
            }
          }
          event.setCancelled(true);
          return;
        }
        if (event.isLeftClick()) {
          if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL)) {
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              switchInventory(getSelectedItem());
              setTraderStatus(TraderStatus.PLAYER_MANAGE_SELL_AMOUNT);
            }
          }
        }
 else {
        }
        event.setCancelled(true);
      }
 else {
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL)) {
          if (event.isRightClick()) {
            if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
                if (getSelectedItem().hasStackPrice()) {
                  getSelectedItem().setStackPrice(true);
                  p.sendMessage(ChatColor.GOLD + "String_Node_Str");
                }
 else {
                  getSelectedItem().setStackPrice(true);
                  p.sendMessage(ChatColor.GOLD + "String_Node_Str");
                }
              }
            }
            event.setCancelled(true);
            return;
          }
          if (hasSelectedItem()) {
            StockItem item=getSelectedItem();
            if (item.getSlot() == -1) {
              item.resetAmounts(event.getCursor().getAmount());
              getTraderStock().addItem(true,item);
            }
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             getSelectedItem().setSlot(-2);
            item.setSlot(event.getSlot());
          }
 else {
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             getSelectedItem().setSlot(-2);
          }
          return;
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL_AMOUNT)) {
          if (!equalsSelected(event.getCursor(),true,false) && !event.getCursor().getType().equals(Material.AIR)) {
            p.sendMessage(ChatColor.GOLD + "String_Node_Str");
            event.setCancelled(true);
          }
          return;
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_BUY)) {
          if (event.isRightClick()) {
            if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_BUY)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (getSelectedItem().hasStackPrice()) {
                  getSelectedItem().setStackPrice(true);
                  p.sendMessage(ChatColor.GOLD + "String_Node_Str");
                }
 else {
                  getSelectedItem().setStackPrice(true);
                  p.sendMessage(ChatColor.GOLD + "String_Node_Str");
                }
              }
            }
            event.setCancelled(true);
            return;
          }
          if (hasSelectedItem()) {
            StockItem item=getSelectedItem();
            if (item.getSlot() == -1) {
              item.resetAmounts(event.getCursor().getAmount());
              getTraderStock().addItem(false,item);
            }
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())             getSelectedItem().setSlot(-2);
            item.setSlot(event.getSlot());
          }
 else {
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())             ;
            getSelectedItem().setSlot(-2);
          }
          return;
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_PRICE)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + f.format(getSelectedItem().getRawPrice()));
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + f.format(getSelectedItem().getRawPrice()));
          }
 else {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().lowerPrice(calculatePrice(event.getCursor()));
 else                 getSelectedItem().increasePrice(calculatePrice(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + f.format(getSelectedItem().getRawPrice()));
              }
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().lowerPrice(calculatePrice(event.getCursor()));
 else               getSelectedItem().increasePrice(calculatePrice(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + f.format(getSelectedItem().getRawPrice()));
            }
          }
          event.setCancelled(true);
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_GLOBAL)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalLimit());
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalLimit());
          }
 else {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().getLimitSystem().changeGlobalLimit(-calculateLimit(event.getCursor()));
 else                 getSelectedItem().getLimitSystem().changeGlobalLimit(calculateLimit(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalLimit());
              }
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().getLimitSystem().changeGlobalLimit(-calculateLimit(event.getCursor()));
 else               getSelectedItem().getLimitSystem().changeGlobalLimit(calculateLimit(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalLimit());
            }
          }
          event.setCancelled(true);
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_PLAYER)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerLimit());
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerLimit());
          }
 else {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().getLimitSystem().changePlayerLimit(-calculateLimit(event.getCursor()));
 else                 getSelectedItem().getLimitSystem().changePlayerLimit(calculateLimit(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerLimit());
              }
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().getLimitSystem().changePlayerLimit(-calculateLimit(event.getCursor()));
 else               getSelectedItem().getLimitSystem().changePlayerLimit(calculateLimit(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerLimit());
            }
          }
          event.setCancelled(true);
        }
      }
    }
  }
 else {
    if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL) || equalsTraderStatus(TraderStatus.PLAYER_MANAGE_BUY)) {
      if (getInventoryClicked() && hasSelectedItem()) {
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL))         getTraderStock().removeItem(true,getSelectedItem().getSlot());
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_BUY))         getTraderStock().removeItem(false,getSelectedItem().getSlot());
        selectItem(null);
      }
 else {
        selectItem(toStockItem(event.getCurrentItem()));
      }
    }
    event.setCancelled(true);
    setInventoryClicked(false);
  }
}

Fixed version (ground truth):
@Override public void managerMode(InventoryClickEvent event){
  boolean top=event.getView().convertSlot(event.getRawSlot()) == event.getRawSlot();
  Player p=(Player)event.getWhoClicked();
  DecimalFormat f=new DecimalFormat("String_Node_Str");
  if (top) {
    setInventoryClicked(true);
    if (isManagementSlot(event.getSlot(),3)) {
      if (isWool(event.getCurrentItem(),(byte)0) && event.getSlot() == getInventory().getSize() - 2) {
        setTraderStatus(TraderStatus.PLAYER_MANAGE_PRICE);
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)15));
        getInventory().setItem(getInventory().getSize() - 3,new ItemStack(Material.AIR));
      }
 else       if (isWool(event.getCurrentItem(),(byte)15)) {
        if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3))         setTraderStatus(TraderStatus.PLAYER_MANAGE_BUY);
        if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))         setTraderStatus(TraderStatus.PLAYER_MANAGE_SELL);
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)0));
        getInventory().setItem(getInventory().getSize() - 3,new ItemStack(Material.WOOL,1,(short)0,(byte)0));
      }
 else       if (isWool(event.getCurrentItem(),(byte)0) && event.getSlot() == getInventory().getSize() - 3) {
        setTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_GLOBAL);
        getInventory().setItem(getInventory().getSize() - 3,new ItemStack(Material.WOOL,1,(short)0,(byte)13));
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)12));
      }
 else       if (isWool(event.getCurrentItem(),(byte)12)) {
        setTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_PLAYER);
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)11));
      }
 else       if (isWool(event.getCurrentItem(),(byte)11)) {
        setTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_GLOBAL);
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)12));
      }
 else       if (isWool(event.getCurrentItem(),(byte)13)) {
        if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3))         setTraderStatus(TraderStatus.PLAYER_MANAGE_BUY);
        if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))         setTraderStatus(TraderStatus.PLAYER_MANAGE_SELL);
        getInventory().setItem(getInventory().getSize() - 3,new ItemStack(Material.WOOL,1,(short)0,(byte)0));
        getInventory().setItem(getInventory().getSize() - 2,new ItemStack(Material.WOOL,1,(short)0,(byte)0));
      }
 else       if (isWool(event.getCurrentItem(),(byte)5)) {
        switchInventory(TraderStatus.PLAYER_MANAGE_BUY);
      }
 else       if (isWool(event.getCurrentItem(),(byte)3)) {
        switchInventory(TraderStatus.PLAYER_MANAGE_SELL);
      }
 else       if (isWool(event.getCurrentItem(),(byte)14)) {
        saveManagedAmouts();
        switchInventory(TraderStatus.PLAYER_MANAGE_SELL);
      }
      event.setCancelled(true);
    }
 else {
      if (event.isShiftClick()) {
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_GLOBAL)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isBuyModeByWool()) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalTimeout());
            }
 else             if (isSellModeByWool())             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalTimeout());
          }
 else {
            if (isBuyModeByWool()) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().getLimitSystem().changeGlobalTimeout(-calculateTimeout(event.getCursor()));
 else                 getSelectedItem().getLimitSystem().changeGlobalTimeout(calculateTimeout(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalTimeout());
              }
            }
 else             if (isSellModeByWool())             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().getLimitSystem().changeGlobalTimeout(-calculateTimeout(event.getCursor()));
 else               getSelectedItem().getLimitSystem().changeGlobalTimeout(calculateTimeout(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalTimeout());
            }
          }
          event.setCancelled(true);
          return;
        }
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_PLAYER)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isBuyModeByWool()) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerTimeout());
            }
 else             if (isSellModeByWool())             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerTimeout());
          }
 else {
            if (isBuyModeByWool()) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().getLimitSystem().changePlayerTimeout(-calculateTimeout(event.getCursor()));
 else                 getSelectedItem().getLimitSystem().changePlayerTimeout(calculateTimeout(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerTimeout());
              }
            }
 else             if (isSellModeByWool())             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().getLimitSystem().changePlayerTimeout(-calculateTimeout(event.getCursor()));
 else               getSelectedItem().getLimitSystem().changePlayerTimeout(calculateTimeout(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerTimeout());
            }
          }
          event.setCancelled(true);
          return;
        }
        if (event.isLeftClick()) {
          if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL)) {
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              switchInventory(getSelectedItem());
              setTraderStatus(TraderStatus.PLAYER_MANAGE_SELL_AMOUNT);
            }
          }
        }
 else {
        }
        event.setCancelled(true);
      }
 else {
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL)) {
          if (event.isRightClick()) {
            if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
                if (getSelectedItem().hasStackPrice()) {
                  getSelectedItem().setStackPrice(true);
                  p.sendMessage(ChatColor.GOLD + "String_Node_Str");
                }
 else {
                  getSelectedItem().setStackPrice(true);
                  p.sendMessage(ChatColor.GOLD + "String_Node_Str");
                }
              }
            }
            event.setCancelled(true);
            return;
          }
          if (hasSelectedItem()) {
            StockItem item=getSelectedItem();
            if (item.getSlot() == -1) {
              item.resetAmounts(event.getCursor().getAmount());
              getTraderStock().addItem(true,item);
            }
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             getSelectedItem().setSlot(-2);
            item.setSlot(event.getSlot());
          }
 else {
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             getSelectedItem().setSlot(-2);
          }
          return;
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL_AMOUNT)) {
          if (!equalsSelected(event.getCursor(),true,false) && !event.getCursor().getType().equals(Material.AIR)) {
            p.sendMessage(ChatColor.GOLD + "String_Node_Str");
            event.setCancelled(true);
          }
          return;
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_BUY)) {
          if (event.isRightClick()) {
            if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_BUY)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (getSelectedItem().hasStackPrice()) {
                  getSelectedItem().setStackPrice(true);
                  p.sendMessage(ChatColor.GOLD + "String_Node_Str");
                }
 else {
                  getSelectedItem().setStackPrice(true);
                  p.sendMessage(ChatColor.GOLD + "String_Node_Str");
                }
              }
            }
            event.setCancelled(true);
            return;
          }
          if (hasSelectedItem()) {
            StockItem item=getSelectedItem();
            if (item.getSlot() == -1) {
              item.resetAmounts(event.getCursor().getAmount());
              getTraderStock().addItem(false,item);
            }
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())             getSelectedItem().setSlot(-2);
            item.setSlot(event.getSlot());
          }
 else {
            if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())             getSelectedItem().setSlot(-2);
          }
          return;
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_PRICE)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + f.format(getSelectedItem().getRawPrice()));
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + f.format(getSelectedItem().getRawPrice()));
          }
 else {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().lowerPrice(calculatePrice(event.getCursor()));
 else                 getSelectedItem().increasePrice(calculatePrice(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + f.format(getSelectedItem().getRawPrice()));
              }
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().lowerPrice(calculatePrice(event.getCursor()));
 else               getSelectedItem().increasePrice(calculatePrice(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + f.format(getSelectedItem().getRawPrice()));
            }
          }
          event.setCancelled(true);
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_GLOBAL)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalLimit());
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalLimit());
          }
 else {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().getLimitSystem().changeGlobalLimit(-calculateLimit(event.getCursor()));
 else                 getSelectedItem().getLimitSystem().changeGlobalLimit(calculateLimit(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalLimit());
              }
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().getLimitSystem().changeGlobalLimit(-calculateLimit(event.getCursor()));
 else               getSelectedItem().getLimitSystem().changeGlobalLimit(calculateLimit(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getGlobalLimit());
            }
          }
          event.setCancelled(true);
        }
 else         if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_LIMIT_PLAYER)) {
          if (event.getCursor().getType().equals(Material.AIR)) {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem())               p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerLimit());
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem())             p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerLimit());
          }
 else {
            if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)3)) {
              if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_BUY).hasSelectedItem()) {
                if (event.isRightClick())                 getSelectedItem().getLimitSystem().changePlayerLimit(-calculateLimit(event.getCursor()));
 else                 getSelectedItem().getLimitSystem().changePlayerLimit(calculateLimit(event.getCursor()));
                p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerLimit());
              }
            }
 else             if (isWool(getInventory().getItem(getInventory().getSize() - 1),(byte)5))             if (selectItem(event.getSlot(),TraderStatus.PLAYER_MANAGE_SELL).hasSelectedItem()) {
              if (event.isRightClick())               getSelectedItem().getLimitSystem().changePlayerLimit(-calculateLimit(event.getCursor()));
 else               getSelectedItem().getLimitSystem().changePlayerLimit(calculateLimit(event.getCursor()));
              p.sendMessage(ChatColor.GOLD + "String_Node_Str" + getSelectedItem().getLimitSystem().getPlayerLimit());
            }
          }
          event.setCancelled(true);
        }
      }
    }
  }
 else {
    if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL) || equalsTraderStatus(TraderStatus.PLAYER_MANAGE_BUY)) {
      if (getInventoryClicked() && hasSelectedItem()) {
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_SELL))         getTraderStock().removeItem(true,getSelectedItem().getSlot());
        if (equalsTraderStatus(TraderStatus.PLAYER_MANAGE_BUY))         getTraderStock().removeItem(false,getSelectedItem().getSlot());
        selectItem(null);
      }
 else {
        selectItem(toStockItem(event.getCurrentItem()));
      }
    }
    setInventoryClicked(false);
  }
}