Buggy code:
public class RealShopInventoryListener extends RealInventoryListener { private final RealShop2Plugin plugin ; public RealShopInventoryListener ( RealShop2Plugin plugin ) { } @ Override public void onInventoryClick ( InventoryClickEvent event ) { plugin . getLog ( ) . debug ( ( ( ( ( ( ( "onInventoryClick<seq2seq4repair_space>=<seq2seq4repair_space>" + "<seq2seq4repair_space>cursor<seq2seq4repair_space>[<seq2seq4repair_space>" ) + ( RealItemStack . create ( event . getCursor ( ) ) ) ) + "]" ) + "<seq2seq4repair_space>item<seq2seq4repair_space>[<seq2seq4repair_space>" ) + ( RealItemStack . create ( event . getItem ( ) ) ) ) + "]" ) ) ; Player player = event . getPlayer ( ) ; Shop shop = plugin . getPlayerShopList ( ) . insideShop ( player ) ; if ( ( ( shop != null ) && ( ( event . getSlot ( ) ) > ( - 999 ) ) ) && ( ! ( shop . getPlayerName ( ) . equals ( player . getName ( ) ) ) ) ) { RealInventoryMove move = whatWillReallyBeDone ( event ) ; plugin . getLog ( ) . debug ( ( ( ( ( ( ( "whatWillReallyBeDone<seq2seq4repair_space>=<seq2seq4repair_space>" + "<seq2seq4repair_space>cursor<seq2seq4repair_space>[<seq2seq4repair_space>" ) + ( RealItemStack . create ( move . getCursor ( ) ) ) ) + "]" ) + "<seq2seq4repair_space>item<seq2seq4repair_space>[<seq2seq4repair_space>" ) + ( RealItemStack . create ( move . getItem ( ) ) ) ) + "]" ) ) ; boolean clickIntoChest = event . getInventory ( ) . getName ( ) . toLowerCase ( ) . contains ( "chest" ) ; TransactionAction transactionAction = new TransactionAction ( plugin ) ; if ( clickIntoChest ) { if ( ( event . isShiftClick ( ) ) && ( shop . getInfiniteBuy ( ) ) ) { plugin . getLog ( ) . debug ( "infinite<seq2seq4repair_space>buy<seq2seq4repair_space>not<seq2seq4repair_space>allowed<seq2seq4repair_space>with<seq2seq4repair_space>shift-click<seq2seq4repair_space>:<seq2seq4repair_space>cancel" ) ; event . setCancelled ( true ) ; } else if ( ( ( shop . getInfiniteBuy ( ) ) && ( ( event . getCursor ( ) ) != null ) ) && ( ( event . getItem ( ) ) != null ) ) { plugin . getLog ( ) . debug ( "infinite<seq2seq4repair_space>buy<seq2seq4repair_space>not<seq2seq4repair_space>allowed<seq2seq4repair_space>with<seq2seq4repair_space>cursor<seq2seq4repair_space>+<seq2seq4repair_space>item<seq2seq4repair_space>slots<seq2seq4repair_space>filled<seq2seq4repair_space>:<seq2seq4repair_space>cancel" ) ; event . setCancelled ( true ) ; } else { if ( transactionAction . canPay ( player , shop , move . getItem ( ) , move . getCursor ( ) ) ) { if ( ( move . getCursor ( ) ) != null ) { if ( ( transactionAction . sell ( player , shop , move . getCursor ( ) ) ) > 0 ) { <START_BUG> if ( shop . getInfiniteSell ( ) ) { <END_BUG> plugin . getLog ( ) . debug ( "infinite<seq2seq4repair_space>sell<seq2seq4repair_space>action<seq2seq4repair_space>:<seq2seq4repair_space>null<seq2seq4repair_space>cursor" ) ; event . setResult ( ALLOW ) ; event . setCursor ( null ) ; } } } if ( ( move . getItem ( ) ) != null ) { if ( ( transactionAction . buy ( player , shop , move . getItem ( ) ) ) > 0 ) { if ( shop . getInfiniteBuy ( ) ) { plugin . getLog ( ) . debug ( "infinite<seq2seq4repair_space>buy<seq2seq4repair_space>action<seq2seq4repair_space>:<seq2seq4repair_space>clone<seq2seq4repair_space>item<seq2seq4repair_space>and<seq2seq4repair_space>cancel" ) ; event . setResult ( ALLOW ) ; event . setCursor ( move . getItem ( ) . clone ( ) ) ; event . setCancelled ( true ) ; } } } } else { plugin . getLog ( ) . debug ( "Can't<seq2seq4repair_space>pay<seq2seq4repair_space>:<seq2seq4repair_space>cancel" ) ; event . setCancelled ( true ) ; } } } else if ( ( event . isShiftClick ( ) ) && ( ( move . getItem ( ) ) != null ) ) { if ( shop . getInfiniteSell ( ) ) { plugin . getLog ( ) . debug ( "infinite-sell<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>allowed<seq2seq4repair_space>with<seq2seq4repair_space>shift-click<seq2seq4repair_space>:<seq2seq4repair_space>cancel" ) ; event . setCancelled ( true ) ; } else if ( ( transactionAction . sell ( player , shop , move . getItem ( ) ) ) == 0 ) { plugin . getLog ( ) . debug ( "shift-click<seq2seq4repair_space>on<seq2seq4repair_space>player's<seq2seq4repair_space>slot<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>allowed<seq2seq4repair_space>:<seq2seq4repair_space>cancel" ) ; event . setCancelled ( true ) ; } } } } @ Override public void onInventoryClose ( InventoryCloseEvent event ) { } }

Fix:
if ( ( shop . getInfiniteSell ( ) ) && ( event . isLeftClick ( ) ) ) {