It is not unnecessary if you want to debug to figure out what is going wrong — the parseInt method throws a NumberFormatException if the string does not contain a parsable integer.
@sistem21 you should be doing your own work. What's wrong with the current snippet you posted? Post the error if there is any.
Code (Text): public boolean isInt(String str) { try{ Integer.parseInt(str); }catch(NumberFormatException e){ e.printStackTrace(); return false; } return false; } Shouldn't it return true since it is a int. Currently it will always return false.
Code (Text): public static boolean isInteger(String s) { try { Integer.parseInt(s); } catch(NumberFormatException e) { return false; } catch(NullPointerException e) { return false; } // only got here if we didn't return false return true; }
It is about the return statements — his method always returns false, regardless whether the integer successfully parses or not.
I pointed that out in my first post I just didn't change I just pointed him/her in the correct direction.
in console there aren't errors but in game it doesn't works For example i made that if the player(that i want to give a banknote) isn't online it send a message to the sender that explain that the layer isn't online..and it doesn't work..and also if i make the command /bn give sistem21 50 in game it doesn't give the banknote