How to execute a server command with a plugin

Discussion in 'Plugin Development' started by Chrisor, Apr 6, 2012.

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

    Chrisor

    Hey Guys,

    I would like to know, how to execute any server command with a Bukkit plugin.
    I've already tryed to use
    Code:
    org.bukkit.command.Command.execute
    but it didn't work for me! The command should work as I would type it myself. (into the server console)
    I'm confidently, that somebody knows how to solve that issue. :)

    Very best regards,

    Chris
     
  2. I would expect it to do something whit the server, so I searsch at the Server interface, there I will find an methode called boolean dispatchCommand(CommandSender sender, java.lang.String commandLine), I asume that is the methode your searching.
     
  3. Offline

    Tzeentchful

    PHP:
    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "COMMAND HERE");
     
  4. Offline

    Kyorax

    Would you need to use a "/" there?
     
  5. Offline

    Dinosaurs

    No, but you gravedigged an thread from 2012 :eek: .

    Code:
    String command = "give dinosawrs 1 1";
    [COLOR=#000000] Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);[/COLOR]
    
     
  6. Offline

    AXCoding

Thread Status:
Not open for further replies.

Share This Page