#NoobAlert help :(

Discussion in 'Plugin Development' started by _Die, Mar 14, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    _Die

    Hey, I am new to the bukkit api (like 2 months) and I am working on a big project but am having trouble adding. I do this:
    Code:
    getConfig().set(p.getName() + " Points", getConfig().getString(p.getName() + " Points") + args[1]);
    But I get things like 1 + 1 = 11...
    I know I am a noob but if someone could help that would be great. Thanks!
     
  2. Offline

    timtower Administrator Administrator Moderator

    Moved to plugin development.
    @_Die use getInt instead of getString, java is looking at the types
     
  3. Offline

    _Die

    Ok, but the adding is still not working it is just giving me a error
     
  4. @_Die Could you post the full class, any realavent classes, and the error please? :)
     
  5. Offline

    pie_flavor

    @_Die If you didn't know how to do this already, I'm guessing that you didn't use Integer.parseInt(args[0]) instead of just typing args[0].
     
    Regablith likes this.
  6. Offline

    Monkey_Swag

    It's ".Points" not "Points". Many other things you should fix too. Will post when I get on my computer
     
  7. Offline

    _Die

    There is no error. It's just the adding. For example,
    Code:
    p.sendMessage(ChatColor.RED + getConfig().getInt(p.getName()  + " Points") + args[1]);
    I would get something like 10 + 10 = 1010
     
  8. Offline

    Monkey_Swag

    @_Die
     
  9. Offline

    _Die

    Wait, the . is adding?
     
  10. Offline

    Kilorbine

    int totalPont = getConfig().getInt(p.getName() + " Points") + Integer.parseInt(args[0]);

    p.sendMessage(ChatColor.RED + Integer.toString(totalPoint));
     
  11. Offline

    Monkey_Swag

Thread Status:
Not open for further replies.

Share This Page