@@ -1380,7 +1380,13 @@ private void actionTrade(@NotNull Player p, Info info, @NotNull String message)
13801380 }
13811381 if (shop .isBuying ()) {
13821382 if (StringUtils .isNumeric (message )) {
1383- amount = Integer .parseInt (message );
1383+ try {
1384+ amount = Integer .parseInt (message );
1385+ } catch (NumberFormatException ex ) {
1386+ Util .debugLog (ex .getMessage ());
1387+ plugin .text ().of (p , "not-a-number" , message ).send ();
1388+ return ;
1389+ }
13841390 } else {
13851391 if (message .equalsIgnoreCase (
13861392 plugin .getConfig ().getString ("shop.word-for-trade-all-items" , "all" ))) {
@@ -1450,7 +1456,13 @@ private void actionTrade(@NotNull Player p, Info info, @NotNull String message)
14501456 actionBuy (p .getUniqueId (), p .getInventory (), eco , info , shop , amount );
14511457 } else if (shop .isSelling ()) {
14521458 if (StringUtils .isNumeric (message )) {
1453- amount = Integer .parseInt (message );
1459+ try {
1460+ amount = Integer .parseInt (message );
1461+ } catch (NumberFormatException ex ) {
1462+ Util .debugLog (ex .getMessage ());
1463+ plugin .text ().of (p , "not-a-number" , message ).send ();
1464+ return ;
1465+ }
14541466 } else {
14551467 if (message .equalsIgnoreCase (plugin .getConfig ().getString ("shop.word-for-trade-all-items" , "all" ))) {
14561468 int shopHaveItems = shop .getRemainingStock ();
0 commit comments