Assigning players to personal string variable E.G. RPG Class

Discussion in 'Plugin Development' started by AaronL98, Jul 20, 2013.

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

    AaronL98

    So I'm creating an RPG plugin and I want players to choose their class and it will save their class but first i need some help. This requires me to store user data. I will be storing each user's data in a seperate yml file per player as I'm not experienced with databases and would rather use a yml.

    I Have never experimented with storing user data so i would like some help here (I'm new to bukkit)

    First , how would I create a yml file for every user that joins looking like this

    File name: 'Player'sname.yml'
    Contents: 'Race:'
    'Class:'
    'Level:'

    I would also like to know what would be the best place to store the variables and how it would be done? Like add the variables just before the onEnable and onDisable and how I would assign each player to that race/class. How would I get the senders yml file after
    if(commandLabel.equalsIgnoreCase("class")){
    if(args.length == 1){
    if(args[0] == "CLASSNAME"){
    then set the class string in the players config to args[0]

    Thanks

    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  2. Offline

    xTrollxDudex

  3. Offline

    AaronL98

    xTrollxDudex Thanks, but how would a hash map work in this situation? Don't they reset every time your server is reloaded or restarted
     
  4. Offline

    Compressions

    AaronL98 When the plugin disables, save the keys and values to the appropriate YML file. When the plugin enables, load data from the YML file to the HashMap.
     
  5. Offline

    AaronL98

    Compressions Thanks. P.S. just a quick question, when /reload is performed, does the server do the onDisable then onEnable method?
     
  6. Offline

    microgeek

    Serialization.
     
  7. Offline

    Compressions

  8. Offline

    xTrollxDudex

Thread Status:
Not open for further replies.

Share This Page