Solved Creating a configuration file for each player?

Discussion in 'Plugin Development' started by OfficerDeveloper, Mar 20, 2015.

Thread Status:
Not open for further replies.
  1. Hello, I cannot test this at the moment, but what I am planning todo is with the getPlayerData() meathod check and create playerdata folders. I would appreciate if anyone could tell me if this would work!

    PS: I came up with this meathod :p.

    [​IMG]

    Edit: Usage in my Join Listener: http://prntscr.com/6jasg9
     
    Last edited by a moderator: Mar 20, 2015
  2. Offline

    tomudding

    MexMaster likes this.
  3. Offline

    MexMaster

    1. Look at the third line, you forgot a slash
    The foldername would be "plugins/AthenUHCuserdata/<player name>.yml

    2. You have an unnecessary argument in your method.
    You're never using the UUID argument, also you can obtain the UUID by using player.getUniqueId();

    3. Use uuids as tomudding mentioned

    4. You have more unnecessary code there:

    Instead of player.isOp == true etc.
    Just use playerdata.set("isOP", player.isOp());

    5. Why are you saving if he's op in your config? Why not just use player.isOp() instead of getting the value from the config?
    If you think about it, it doesn't makes sense, you need the player instance to get the config to get the op value from config. But when you have the player instance you can just use isOp.

    - Mex ;)

    @OfficerDeveloper
     
    tomudding likes this.
  4. I fixed everything you said before I even saw this. Lol. But thats for responding :p
     
  5. @OfficerDeveloper I think that you should make getters and setters for each line. (Example below.)
    Code:
    public void setBanned(boolean banned) {
    getConfig().set("Banned", banned);
    }
    
    public boolean getBanned() {
    return getConfig().getBoolean("Banned");
    }
     
  6. I added and removed things so its fine now.

    SOLVED.
     
Thread Status:
Not open for further replies.

Share This Page