Need to Change Commands in Config. What about plugin.yml

Discussion in 'Plugin Development' started by kyledag500, Aug 14, 2012.

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

    kyledag500

    Ok, just before you read this, know this is only my seconds bukkit plugin. I am making a plugin that will send them the message associated with a command. However, the command that needs to be entered needs to be able to be changed in the config. For example:

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] arg){
    if(commandLabel.equalsIgnoreCase(getConfig().getString("1a")));
    Player player = (Player) sender;
    player.sendMessage(getConfig().getString("1b"));

    and the config looks like this:
    1a: test
    1b: This is a test!
    How do I make this work. I am like 99.99% sure I did it all right, except for the problem that all the commands have 2 be in the plugin.yml
    How do I make it so that it does this? Please help!
     
  2. Offline

    sd5

    Hmm, as far as I know you can't register commands manually.
    The only way which comes to mind would be to register a PlayerCommandPreprocessEvent
    and check whether the command is named as one of yours...
     
    theplayerjooo likes this.
  3. Offline

    Blabba

    I don't know, but maybe you could get the string from a player chat event and not the command, then check if the string is what people have chosen in the config.
     
  4. Offline

    kyledag500

    Thanks! It worked
     
Thread Status:
Not open for further replies.

Share This Page