Program: 45022
Project: 45022
Buggy source:
@Override public void onPlayerInteractEntity(PlayerInteractEntityEvent event){
  if (!event.isCancelled()) {
    Player player=event.getPlayer();
    Entity entity=event.getRightClicked();
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (wolf.isTamed() && wolf.getOwner().equals(player)) {
        Material item=player.getItemInHand().getType();
        if (item.equals(Material.BONE)) {
          if (plugin.hasPermissions(player,"String_Node_Str")) {
            if (!wolfManager.hasWolf(wolf.getUniqueId())) {
              wolfManager.addWolf(wolf);
              player.sendMessage(ChatColor.GREEN + "String_Node_Str" + ChatColor.YELLOW+ wolfManager.getName(wolf.getUniqueId()));
              player.sendMessage("String_Node_Str" + wolf.getUniqueId() + "String_Node_Str"+ wolfManager.getWolfTable(wolf.getUniqueId()).getId());
            }
            selectedWolfManager.addSelectedWolf(player.getName(),wolf);
            player.sendMessage(ChatColor.GREEN + "String_Node_Str");
          }
        }
 else         if (item.equals(Material.CHEST)) {
          if (plugin.hasPermissions(player,"String_Node_Str")) {
            if (wolfManager.hasWolf(wolf.getUniqueId())) {
              if (wolfManager.hasInventory(wolf.getUniqueId())) {
                EntityPlayer entityPlayer=((CraftPlayer)player).getHandle();
                entityPlayer.a(plugin.getWolfInventoryManager().getWolfInventory(wolf.getUniqueId()).getInventory());
              }
 else {
                wolfManager.addInventory(wolf.getUniqueId());
                player.getInventory().remove(new ItemStack(Material.CHEST,1));
              }
            }
 else {
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onPlayerInteractEntity(PlayerInteractEntityEvent event){
  if (!event.isCancelled()) {
    Player player=event.getPlayer();
    Entity entity=event.getRightClicked();
    if (entity instanceof Wolf) {
      Wolf wolf=(Wolf)entity;
      if (wolf.isTamed() && wolf.getOwner().equals(player)) {
        Material item=player.getItemInHand().getType();
        if (item.equals(Material.BONE)) {
          if (plugin.hasPermissions(player,"String_Node_Str")) {
            if (!wolfManager.hasWolf(wolf.getUniqueId())) {
              wolfManager.addWolf(wolf);
              player.sendMessage(ChatColor.GREEN + "String_Node_Str" + ChatColor.YELLOW+ wolfManager.getName(wolf.getUniqueId()));
              player.sendMessage("String_Node_Str" + wolf.getUniqueId() + "String_Node_Str"+ wolfManager.getWolfTable(wolf.getUniqueId()).getId());
            }
            selectedWolfManager.addSelectedWolf(player.getName(),wolf);
            player.sendMessage(ChatColor.GREEN + "String_Node_Str");
          }
        }
 else         if (item.equals(Material.CHEST)) {
          if (plugin.hasPermissions(player,"String_Node_Str")) {
            if (wolfManager.hasWolf(wolf.getUniqueId())) {
              if (wolfManager.hasInventory(wolf.getUniqueId())) {
                EntityPlayer entityPlayer=((CraftPlayer)player).getHandle();
                entityPlayer.a(plugin.getWolfInventoryManager().getWolfInventory(wolf.getUniqueId()).getInventory());
              }
 else {
                wolfManager.addInventory(wolf.getUniqueId());
                if (player.getItemInHand().getType() == Material.CHEST) {
                  player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1);
                }
              }
            }
 else {
            }
          }
        }
      }
    }
  }
}