Solved How to run a command from a plugin

Discussion in 'Plugin Development' started by Blocky4Programs, Aug 17, 2014.

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

    Blocky4Programs

    Is it possible to run a command from my plugin? (eg: "tell player lol")
    And commands from other plugins? (eg: "bank create ...")
    And with all permissions?
    If yes, how?
     
  2. Offline

    AoH_Ruthless

    Blocky4Programs
    Bukkit.dispatchCommand(CommandSender, Command) (might be a string instead of Command).

    You shouldn't use Bukkit class outside main class, so instead use a reference to your main class + getServer() if possible.
     
    Blocky4Programs likes this.
  3. Offline

    St3venAU

    To execute a command as the console you can use this:

    Code:java
    1. getServer().dispatchCommand(getServer().getConsoleSender(), "your command here");


    *edit* Ninja'd :)
     
    Blocky4Programs likes this.
  4. Offline

    Blocky4Programs

Thread Status:
Not open for further replies.

Share This Page