Solved HashMaps

Discussion in 'Plugin Development' started by johnny_boy, Jul 21, 2019.

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

    CraftCreeper6

    @johnny_boy
    Just out of interest, are you storing the time they have played as the key and their UUID as the value?

    Also, your problem is that HashMap#remove() takes a key, not a value.
     
  2. Yes i am. Should i reverse that.. ? OHHH it just hit me i should store UUID as key correct?

    edit: just tested what you said and it indeed is the case and now works as intended. Thank you :)
     
  3. Offline

    CraftCreeper6

  4. Works great thank you. As for how im doing it (code wise) is it good ?
     
  5. Offline

    CraftCreeper6

    @johnny_boy
    Only criticism is that you're using a capital letter for a HashMap. But that's it.
     
  6. Hahaha like the actual class! Okay thanks a lot ! (I'm surprised i got it right first time as i haven't coded with java or in general for ages, anyway tysm) :)
     
  7. @johnny_boy Read this. It tells you about the Java naming conventions.
     
  8. i guess going by that then it should be Hashmap. (Eclipse > PlaytimeHashMap > Refractor > Rename) :p
     
  9. Offline

    CraftCreeper6

    @johnny_boy
    I meant your PlayerPlaytime hashmap, it should be called playerPlaytime
     
  10. @johnny_boy No, going by that, you should change your variable map from 'PlayerPlaytime' to 'playerPlaytime'.
    EDIT: Ah, @CraftCreeper6 posted before me. :p
    I see you also have some variables in your 'Main' class called 'PlaytimeConfig' and 'Playtime', they should be renamed to 'playtimeConfig' and 'playtime'. Change all your variable names like that.
     
  11. o h i see now yes, thanks... (btw the plugin im making rn isn't going well haha).
     
Thread Status:
Not open for further replies.

Share This Page