Make console send a command as a player

Discussion in 'Plugin Development' started by flyingtacoz, Jan 2, 2013.

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

    flyingtacoz

    Hello, What I am trying to do is give users worldguard abilities without them having perms.
    So if someone on my server typed a command, I want the console to send a command as a player and it will add a member to their worldguard region. But it isn't working correctly, can anyone give me some more information/help on this? Thanks.
    Code:
              Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "region addmember " + blahblahblah
     
  2. Offline

    Major_Derp

    flyingtacoz
    Try this, its slightly different than your code, havnt tested if it works, but it should:
    Code:
    Bukkit.getServer().dispatchCommand(player.getServer().getConsoleSender(), "region addmember " + blahblahblah
    and the player would be:
    sender.getName();
    and so on.
    And zXCaKeXz
    I think all that would do is output /builtcommand, where built command is the variable.
     
  3. Offline

    zXCaKeXz

    OH i thought you wanted the player to do a command with a console command :l
     
  4. Offline

    flyingtacoz

    It says "a player is expected" when it sends.
     
  5. Offline

    fireblast709

    Then fill in a playername as parameter
     
  6. Offline

    flyingtacoz

    I don't want only one specific person to be able to do it.
     
  7. Offline

    fireblast709

    I mean as "blahblahblah"
     
  8. Offline

    dark navi

    He means that the command is working, you're just using the command incorrectly.
     
  9. Offline

    flyingtacoz

    Oh I did that, I think this part is not working correctly: "player.getServer().getConsoleSender()"
     
  10. Offline

    fireblast709

    might be that it is a player-only command
     
  11. Offline

    flyingtacoz

    Oh.. right. I guess the only way to do this, is op the person, send the command, then deop. However this could probably be easily exploited. Do you happen to know another way to do this?
     
  12. Offline

    fireblast709

    not really
     
  13. Offline

    nugycal

    Try adding the permission node, then taking it away
     
Thread Status:
Not open for further replies.

Share This Page