1. We are planning scheduled maintenance on this website on Friday 5 March (tomorrow) at 4:00 am UTC. It is estimated that this maintenance will last 15 minutes. You can view this time in your local timezone here. Thanks.
    Dismiss Notice

PlayerConfigAPI 1.0.1

Creates a config per-player.

  1. DanyBv
    An easy to use API to get per-player configs.

    Methods
    Code (Java):

    PlayerConfigAPI pca = new PlayerConfigAPI(this);
    pca.exists(player);//Returns true if player config exists, else returns false
    pca.createConfig(player);//Creates a config for the player
    pca.set(player, configPath, value);//Sets a configPath to a value
    pca.getString(player, configPath);////Returns String from configPath
    pca.getInteger(player, configPath);//Returns int from configPath
    pca.getBoolean(player, configPath);//Returns boolean from configPath
     
    Plugin example
    Code (Java):

    //This plugin example creates a config for each player upon joining

    PlayerConfigAPI pca = new PlayerConfigAPI(this);

    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        if (!pca.exists(p))
        {
            pca.createConfig(e.getPlayer());
            pca.set(p, "lastName", p.getName());
        }
    }
     
    To do:
    • Add more methods (for more variable types)
    foxi69 likes this.

Recent Updates

  1. Changed mehod names

Recent Reviews

  1. Muricans
    Muricans
    4/5,
    Version: 1.0.1
    good, but i'd like java 7 support, my server hosting company only has that for now, and i'd like to have this api in my plugin.