Forwarding a CMD

Discussion in 'Plugin Development' started by Crud41, Nov 13, 2014.

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

    Crud41

    So say a server has essentials, I would like to forward a /ban command with arguments. How does one accomplish this without actually hooking onto the plugin?
     
  2. Offline

    Skionz

    Server.dispatchCommand();
     
  3. Offline

    Crud41


    How would I format that? I noticed it is a Boolean type.

    Server.dispatchCommand(arg0, arg1);
    getServer().dispatchCommand(getServer().getConsoleSender(), "ban" + args[0]);
    Something like that?
     
  4. Offline

    Skionz

    Crud41 Probably. I'm not 100% sure so I would check the javadocs.
     
  5. Your thinking is almost correct, you only need to add a space between ban and the argument, since the command is "/ban Crud41" and not "/banCrud41"
    boolean commandSucces = getServer().dispatchCommand(getServer().getConsoleSender(), "ban" + ' ' + args[0]);

    The command returns a boolean if the command was executed successfully.
     
  6. ferrybig You could just put a space in the ban string :p
     
Thread Status:
Not open for further replies.

Share This Page