dispatch command

Discussion in 'Plugin Development' started by BasicGamer911, Dec 14, 2012.

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

    BasicGamer911

    i have made a plugin that uses "Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "rank " + player.getName() + " Survivor");" but it only works for op's
     
  2. Offline

    Tirelessly

  3. Offline

    fireblast709

    you let the console execute the command
     
  4. Offline

    xGhOsTkiLLeRx

    Either use

    player.performCommand(yourCommand);
    -> Uses the normal "hasPermission" check
    or use
    getServer().dispatchCommand(getServer().getConsoleSender(), yourCommand);
    -> This one perfoms the command as the console -> all permissions permission check still applies

    Cheers
     
  5. Offline

    fireblast709

    • Bukkit.dispatchCommand(player, command) would work the same as player.performCommand(command) (just saying)
    • console should not have the commands that check for permissions with defined "default: false" in the plugin.yml
     
  6. Offline

    xGhOsTkiLLeRx


    Yeah, but why should you use the getServer() (or even the static access) to achieve the same when it's easier to call the player method ;D
    Corrected my statement, nearly 2am here, of course you are right, but console does have access to the command if the default is set to op.

    Greetings
     
  7. Offline

    fireblast709

    hehe 2 AM is no reason, same time here :p
     
Thread Status:
Not open for further replies.

Share This Page