Trying to make a config to have people change a message

Discussion in 'Plugin Development' started by THXMINECRAFT, Aug 25, 2013.

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

    THXMINECRAFT

    This might be a noob question but how do I make it so users can edit the message that would pop up when you type in a command because I have this...

    Code:
    this.getConfig().options().copyDefaults(true);
    this.saveConfig();
    on the Enable(){ but I made a separate class for the command and I was wondering how I would change the message including the color codes in here...

    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String Commandlabel, String[] args){
        String command = cmd.getName();
        Player player = (Player) sender;
        if(command.equalsIgnoreCase("offduty") && (sender.hasPermission(this.plugin.duty) || sender.isOp())){
            player.getInventory().clear();
            sender.getServer().broadcastMessage(ChatColor.RED + "[Guard Notice] " + ChatColor.GREEN + "--- " + ChatColor.BLUE + sender.getName() + ChatColor.GREEN + " is no longer on Duty! ---");
            player.getInventory().setHelmet(null);
            player.getInventory().setChestplate(null);
            player.getInventory().setLeggings(null);
            player.getInventory().setBoots(null);
        }else{
            sender.sendMessage(ChatColor.DARK_RED + "You do not have access to that command.");
        }
        return false;
        }
    }
    because when I try to insert getConfig() into this it underlines it in red.
     
  2. Offline

    Trevor1134

    make a constructor in the class.

    First:

    Code:
    public <Plugin_Name> plugin;
    then:
    Code:
    public CLASSNAME(PLUGINNAME plugin){
        this.plugin = plugin;
    }
    Finally do:
    Code:
    plugin.getConfig().getString("String");
     
  3. Offline

    THXMINECRAFT

    Okay thank you I just figured the rest out.
     
Thread Status:
Not open for further replies.

Share This Page