Overriding another built-in command?

Discussion in 'Plugin Development' started by Razorcane, Oct 14, 2011.

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

    Razorcane

    So I have a custom reload command here, which is defined as /oreload. However, I want that command to also be cast whenever a user uses /reload, the built-in server reload command. How would I do this?
     
  2. Offline

    scranner

    try that it might work i think that it will pick it up from your plugin AND the bukkit, can i ask what you are doing here? as this code might not apply to what you are doing

    Code:
    if ((label.equalsIgnoreCase("oreload") || (label.equalsIgnoreCase("reload"))
    {
    do this
    }
    else
    {
    do this
    }
     
  3. Offline

    Razorcane

    Ah I wasn't sure what the syntax was for that. I was using & instead of ||. :p thanks.

    Do I have to call the command in my plugin.yml folder as well?

    Oh whoops, I didn't reply to what you were asking. I'm making a reload command that broadcasts a message whenever the server is reloaded. But I want to be able to use both commands for ease of access. I already have everything in place, I just need to override the built-in reload command.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 20, 2016
  4. Offline

    Taco

    There's a method that's called before the command itself. If I'm correct, it's onPlayerCommandPreprocess() or something like that.
     
  5. Offline

    Razorcane

    Yes I found that in the javadoc and am currently looking into it.
     
Thread Status:
Not open for further replies.

Share This Page