New config help

Discussion in 'Plugin Development' started by Serubin323, Dec 15, 2011.

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

    Serubin323

    I'm working on a plugin that needs to get a yml list and 2 booleans from the config file. For what ever reason my plugin will not read the config and the first boolean (and the only thing I'm trying to get from the config right now) just displays its false. Even if i change in the config it will stay false.
    Code:
    	public static boolean rbAllow;
    ~~~~~
    if (commandLabel.equalsIgnoreCase("mycommand"){
                    if (checkPermissionBasic(player)) {
                        rbAllow = getConfig().getBoolean("restrict.enabled");
                        if(rbAllow != true){
                                player.sendMessage(ChatColor.RED + "Invalid item" + Boolean.toString(rbAllow));
                                return true;
                        }else{do stuff;
                         return true;}
    Code:
    restrict:
        enable: true
        allowed:
        - 1
        - 2
        - 3
        - 4
        - 5
        - 12
    
    Any ideas why it wont read the config?
     
  2. Offline

    ibhh

    Do you use this:

    PHP:
                this.getConfig().options().copyDefaults(true);
                
    saveConfig();
                
    reloadConfig();
                
    System.out.println("[xpShop] Config file found!");
    else there is no config installed.
     
  3. Offline

    coldandtired

    Your code says restrict.enabled but your config says restrict.enable.
     
Thread Status:
Not open for further replies.

Share This Page