Run command as operator

Discussion in 'Plugin Development' started by mussonking, Sep 17, 2015.

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

    mussonking

    I know there is alot of thread about this but my request is different.
    I am using dispatchCommand(), but my problem is I cannot run the command as the console.
    The reason is simple, it is to run a worldedit command and it cant be run by console, it absolutely need a player.

    Is there a way to bypass this? If I give them worldedit permission they will be able to use //commands, which you can understand is not what I want!

    Thanks for the help..

    mussonking
     
  2. Offline

    Xtreme727

    Ignore this, it was a misunderstood reply.
     
  3. Offline

    mine-care

    @mussonking so you want to execute a command from console that can only be executed by a player?
     
    Xtreme727 likes this.
  4. Offline

    Oxyorum

    @mussonking I don't believe that's possible, at least for any WE command that requires a player to select a region to work, which is most of them. Why don't you use the WorldEdit API to try to do what you want instead?
     
  5. Offline

    adam753

    I don't understand what you want to do... You want to dispatch a command, but you don't want it to have a sender? I smell an X-Y problem. If you want to do worldedit things without a player invoking them, use its API rather than dispatching commands.
     
  6. Offline

    567legodude

    @mussonking There may be a couple things you can do.
    1. If you can do it from console, run it from console.
    2. If you are using a permissions plugin, give them the "*" permission, execute the command, then take it away.
    3. Set them to OP, run the command, then take it away [if they weren't OP before].
     
  7. Offline

    mussonking

    Thanks all for the reply, actually here is what I am trying to do. I'm creating a plugin that will add a timer to worldedit, so depending on the rank they will have a delay before they can use any worldedit command. Thas why I dont want to give them worledit permission otherelse they will be able to bypass the timer.

    567legodude, I thought about giving op and removing it, but I was scared something bad could happen, if someone would try to take advantage of it or what ever. I, by far, prefer your idea to give them the permission and remove it afterward, my next question is, performance side, won't it be a bit heavy to give and remove a permission each time? otherelse I think im going to use that way.

    Thanks again everyone for your answer!
     
  8. What makes you think it would be performance heavy?
     
  9. Offline

    boomboompower

    Simple answer: No.
     
Thread Status:
Not open for further replies.

Share This Page