Solved Getting HashMap Integer

Discussion in 'Plugin Development' started by Skify, Nov 11, 2015.

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

    Skify

    Hello, I'm trying to make killstreaks show on my scoreboard.
    Code:java
    1.  
    2. public Map<String,Integer>ks = new HashMap<String,Integer>();
    3. int streak = ks.get(p.getName());
    4. Score score6 = objective.getScore("§fStreak§8: §e" + streak);
    5. score6.setScore(2);
    6.  

    Console error: http://pastebin.com/udJKrwsX
    Killstreak code: http://pastebin.com/xYyqjwV3
     
  2. Offline

    mcdorli

    We need the section after the "Caused by" section (it needs to include the caused by text
     
  3. Offline

    Skify

  4. Offline

    BrickBoy55

    @Skify What is line 275 of Core.java?


    PS:

    Code:
    11.11 06:11:36 [Server] INFO java.lang.IllegalArgumentException: Entry cannot be longer than 16 characters!
    
     
    Last edited: Nov 11, 2015
  5. Offline

    Skify

  6. Offline

    mcdorli

  7. Offline

    Skify

  8. Offline

    mcdorli

    You should use BukkitRunnable instead of a Runnable

    Please create a pastebin with the whole class
     
    Last edited: Nov 11, 2015
  9. Offline

    Skify

    @mcdorli It's all fixed, but when I join, scoreboard does not appear, but after I kill a player, it shows up. I think it's because it starts off with killstreak of 0... not sure... here is console error. http://pastebin.com/eAFX0UE4
     
  10. Offline

    mcdorli

    It wont show up, because you don't specify it before the kill event. It is a null.
     
  11. Offline

    Skify

  12. @Skify
    Put a value when a player joins
     
  13. Offline

    Skify

    @megamichiel Can it be 0?
    Code:java
    1.  
    2. this.plugin.killstreak.put(killer.getName(), Integer.valueOf(0));
     
  14. Offline

    mcdorli

    Yeah, it can be.
     
  15. Offline

    Skify

  16. Offline

    mcdorli

  17. Offline

    Skify

    @mcdorli
    Code:
    plugin.killstreak.put(killer.getName(), Integer.valueOf(0));
     
  18. Offline

    mcdorli

    Either of these is null: plugin, killstreak, killer, killer.getName(), Integer.valueOf(0)
    BTW.: Why do you use Integer.valueOf(0) instead of simply 0?
     
  19. Offline

    Skify

    @mcdorli I changed it to just 0, still same.
     
  20. @Skify
    .-., plugin or killstreak is most definitely null
     
  21. Offline

    Skify

Thread Status:
Not open for further replies.

Share This Page