Most elegant way to call another plugins command

Discussion in 'Plugin Development' started by mxE333xm, Jun 9, 2011.

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

    mxE333xm

    Hi,

    I'm trying to execute a command from another plugin. (So, for expamle Essentials's jail from my plugin). But I found no way that looks acceptable. At the moment I'm hooking into Essentials, but thats not good, as the other stuff that is made in essentials.onCommand or wherever isn't executed. So I'm looking for a way to let the plugin execute a command as it would have been executed from console.

    I heard about using the dispatchCommand, but that doesn't work for me.
     
  2. Offline

    Shamebot

    I think there's a Server.dispatchCommand(...).
     
  3. Offline

    mxE333xm

    Ok, then I didn't managed to use it in the right way.

    m_pPlugin.getServer().dispatchCommand(Console.getCommandSender(m_pPlugin.getServer()) ,"kick");

    Thats my code. But that isn't working. And also I want to specify additional arguments, what isn't possible with that function.

    EDIT: Oh, my fail. Now it works -.- Thank you ;)
     
  4. Offline

    Shamebot

    You should be able to add the arguments with spaces between.
    What's Console.getCommandSender?
     
  5. Offline

    mxE333xm

    Yes, i forgot that.

    As I can see that, it returns the commandsender-instance of the console.
     
  6. Offline

    Shamebot

    I can't find the Console class, neither on github nor on the javadocs.
     
  7. Offline

    mxE333xm

    Mh, yes, I now found out that it went from essentials ;)

    But the method does basically nothing other than
    (See the essentials svn)
     
Thread Status:
Not open for further replies.

Share This Page