Running console as player

Discussion in 'Plugin Requests' started by GreenFanta, Jun 25, 2012.

  1. Offline

    GreenFanta

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hi there

    I have so many plugins that I need to run console commands through yet do not allow for console to run the commands, is there a way I can somehow make it seem as though the console commands are actually running as a player? (I do not want to use a sudo command as it is an op command that runs and there may not be an op online at the time that the command runs)

    Regards

    Matthew
  2. Offline

    Rakaesa

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    ..I don't quite understand what you mean by needing to run console commands through....But not letting the console use the commands? Wat?
  3. Offline

    GreenFanta

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hi

    I'm sorry if I was not specific, what I meant was; I have some plugins installed on my server, I am wanting to run the commands that come with these plugins on my server as console and not as an in-game player, but it would seem there is a restriction on the plugins that do not allow console to run these commands, my question is to try and work-around that. Please tell me if I am still not being specific.

    Regards

    Matthew
  4. Offline

    np98765 43210 Moderator BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I think you'd have to talk to each individual plugin developer and have them add that to their plugin...
  5. Offline

    Rakaesa

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yeah, nobody can really make a plugin that adds onto other plugins. That wouldn't be possible, or very easy.
  6. Offline

    GreenFanta

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    What I was thinking of, is a plugin that allowed for the console to execute the commands as though it were a player.
    Is that possible?
  7. Offline

    Codex Arcanum

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This should be possible to do. Here is a link to a possibly outdated plugin that seems to do exactly what you need.
  8. Offline

    GreenFanta

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I need to do the opposite of that, execute commands as a player through console.
  9. Offline

    np98765 43210 Moderator BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yeah, I was just going to say that. :p

    Still, I don't think it's possible >.< Any experts out there who can prove me right or wrong?
  10. Offline

    Codex Arcanum

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hold on just a minute folks, I shall copy-paste something from the above plugin's description.
    *Ahem*

    /sudo <command> - Run a command as console

    That sure *sounds* like exactly what you are asking for. If the above plugin does/did what is advertised, I think it is reasonable to say the request is possible.
  11. Offline

    Codex Arcanum

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    ...and to back up this assertion allow me to paste in a line of source code from the plugin
    Code:
    Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd)
    
    Which, for any of you non-programming types out there means that, yes, this is both possible, and has been done before.

    This post has been edited 1 time. It was last edited by Codex Arcanum Jun 25, 2012.
  12. Offline

    GreenFanta

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Should that then allow me to execute console commands through that function and appear as though they are player issued commands?
  13. Offline

    Codex Arcanum

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Apologies for the somewhat snippy response, I somehow didn't understand your post the first time I read it. Just to get this straight, you want to be able to run commands that are not executable by the console as the console by somehow running them as a player?
  14. Offline

    np98765 43210 Moderator BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I think he wants a console command to run through a player. For example, if '/bukkit' wasn't executable by the console, he would type '/player bukkit' (or similar) and have '/bukkit' execute as if it was a player with op permissions.

    I think. >.< :p
  15. Offline

    Codex Arcanum

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Huh. First of all, that is rather bad coding practice for the developer of the command in question, but so far as a solution goes, there is a kind of hack-y solution. When the console types /player bukkit, set the player to OP, execute the command as the player, then de-OP the player immediately afterwards.
    Caveats:
    1. Only works if a player is online.
    2. May or may not spam the player's chat with "You are now OP" and "You are no longer OP" depending on how player.setOP() works.
  16. Online

    evilmidget38 BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    You could probably make a fake CommandSender. Of course, there still are issues if you try using a command that needs the player's location, etc. I believe it is also possible to make all messages sent to player re-routed to the console, as well.

    Maybe I'll look into doing this.
  17. Offline

    GreenFanta

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'd really appreciate you doing this Evilmidget, the commands I want to run do not require co-ordinates, just simply to be run as though it is a player, I did consider the /op /deop feature, but it is quite risky in my opinion and also requires the user to be online at the time which is not necessarily what I want.

    Regards

    Matthew
  18. Offline

    PatPeter

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Essentials has a /sudo command.
  19. Offline

    MrBluebear3

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    You do know this thread was from June last year :p

    I do that all the time xD

    This post has been edited 1 time. It was last edited by MrBluebear3 Jan 2, 2013.
  20. Offline

    necrodoom

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    also that he requested the opposite thing.
    the main issue with this request is that some commands require player data, such as location, what would this plugin output to them?

Share This Page