idk what is null in pl...

Discussion in 'Spigot Plugin Development' started by dogboy60, Feb 14, 2016.

  1. so when i use 1 of my commands i get an error in the console i see there's something null, and i can figure out thats null exactly.
    Code (Text):
     if(args.length == 4 && args[0].equalsIgnoreCase("loan")) {
                String playerName = args[1];
                Player player = Bukkit.getPlayer(playerName);
                int loan=0;
                try {
                    loan = Integer.valueOf ( args[2]);
                } catch (NumberFormatException e) {
                    Util.sendMsg ( sender ," You must enter a number for loan" );
                    return true;
    Code (Text):
    [18:29:55 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'cred
    itcard' in plugin CreditCard v0.1
  2. Check if the player is null,
    Code (Java):
    if(p != null){
    do stuff...
    //it's null!
    if that's not it, send full stacktrace please.
  3. actually... the player being null won't cause the NullPointer Exception because the player object is never used... i would say something like sender is null :/

    but to the OP: we need to know the full stack trace along with what line the error occurs on ;) (if you need help understanding stack traces to find out what line it is, google can help)

    EDIT: its not actually a NullPinterException... unless the full stack trace has NullPointerException in there... please post the full tack trace .-.