Player config

Discussion in 'Plugin Development' started by JJSfluffyduck, Nov 7, 2012.

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

    JJSfluffyduck

    My plan is to get people to have password for account but how could I write the player then password in the config then be able to call unpon it when need. Thanks for any help
     
  2. Offline

    fireblast709

    use YAML:
    Code:
    user: pass
    then in Java:
    Code:java
    1. getConfig().set(player.getName(), password); // first join
    2. getConfig().saveConfig(); // dont forget this
    3. // Next time they join, make add them to a ArrayList<String> players
    4. // Block things like movement and chat, or whatever you want
    5. // to get the password:
    6. String pass = getConfig().getString("username", "");
    7. if(pass.equals("whatever they entered"))
    8. {
    9. // Password correct
    10. }
    11. else
    12. {
    13. player.sendMessage("Password incorrect");
    14. }
     
  3. Offline

    JJSfluffyduck

    Thanks so does it auto make the players inside the config for everyone? Also would it be possible to get them to set there on password
     
  4. Offline

    fireblast709

    JJSfluffyduck as I used it now is just an example, a mix of different parts of code. If they join for the first time, the String pass would probably default to "", which you can treat as 'no password set'
     
  5. Offline

    JJSfluffyduck

    THank you! You helped me out a lot, (pat your self on the back for me).
     
Thread Status:
Not open for further replies.

Share This Page