Getting a level

Discussion in 'Plugin Development' started by Phishy, Apr 7, 2015.

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

    Phishy

    I'm wondering how I would go about getting something about a player from somewhere.

    For example

    Let's say a Levels plugin, and the player is level 13 in a skill, and they could bring up a Gui which tells them their levels, on the lore of it would get the level, where would I save the players level to?
     
  2. Offline

    mine-care

    that is up to you :) Do you want bulk saving and loading with unreadable by human eyes data? use Java serialization.
    Do you want per player files readable by humans? do you want to save to a large file (unrecomended)
     
  3. Offline

    Phishy

    I'd like it so they could be readable by human eyes, and that each player has their own file
    @mine-care
     
  4. Offline

    RuthlessRage

    Save it to a hasmap(UUID, Int) the uuid as the player , int as they're level. now your going to have to put a different hashmap for each player interact event. for example if a player hold a fishing rod and fishes, listen for the interact event of fishing rod and use the hashmap "fishing(uuid, Int) " and add to the players int whenever they catch a fish or someting.
     
  5. Offline

    Phishy

    But a hashmap resets every time a server restarts?
     
  6. Offline

    RuthlessRage

    @Phishy you can then save it to a config.yml as .getConfig().set("player.getname", level); where you may see the players name or you can use the players uuid, and for level you put the players level integer. OR you just save and load the hashmap. personally id rather the config with ("playername", level) as you can further this and set peoples levels in game and sutff, it makes impleemnting things into your plugin more open
     
  7. You have to save the map when the player quit and load it when the player join, and ondisable save all players inside the map.
     
  8. Offline

    Phishy

    How do you save a hashmap?
     
  9. Offline

    mine-care

  10. Offline

    Phishy

    Still need help on this
     
  11. Offline

    Zombie_Striker

    getConfig().set(A String that will be the path, Your data (you can store the int/String here, or the hasmap))
     
  12. Offline

    RuthlessRage

    @Phishy @Phishy i already told you

    you can then save it to a config.yml as .getConfig().set("player.getname", level); where you may see the players name or you can use the players uuid, and for level you put the players level integer. OR you just save and load the hashmap. personally id rather the config with ("playername", level) as you can further this and set peoples levels in game and sutff, it makes impleemnting things into your plugin more open
     
Thread Status:
Not open for further replies.

Share This Page