Adding custom commands to the server console?

Discussion in 'Plugin Development' started by Slayer9x9, Dec 9, 2012.

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

    Slayer9x9

    I know how to register commands in a plugin, but I was wondering if there is a way to capture commands entered into the console.

    Is this possible?
     
  2. Offline

    Barinade

    if (!(sender instanceof Player)) {
    //omg console command
    }
     
  3. Offline

    gomeow

    Or if(sender instance of ConsoleCommandSender) {
    //Another cool console command
    //won't work for remote consoles
    //Another is "RemoteConsoleCommandSender"
    }
     
  4. Offline

    Woobie

    Slayer9x9

    Not exactly sure what you mean, but have a look at ServerCommandEvent.
    This event is fired when command is being executed from the console.

    And then there is
    Code:
    if(!(sender instanceof Player)) { 
    for onCommand methods, to check if the command sender is console.
    EDIT: Dang, double ninja'd :'(
     
  5. Offline

    Slayer9x9

    Lol thanks guys. It was so obvious..
    I accidentally my code.
     
Thread Status:
Not open for further replies.

Share This Page