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
..I don't quite understand what you mean by needing to run console commands through....But not letting the console use the commands? Wat?
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
I think you'd have to talk to each individual plugin developer and have them add that to their plugin...
Yeah, nobody can really make a plugin that adds onto other plugins. That wouldn't be possible, or very easy.
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?
This should be possible to do. Here is a link to a possibly outdated plugin that seems to do exactly what you need.
Yeah, I was just going to say that. Still, I don't think it's possible >.< Any experts out there who can prove me right or wrong?
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.
...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.
Should that then allow me to execute console commands through that function and appear as though they are player issued commands?
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?
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. >.<
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.
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.
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
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?