Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved First OP in ops.txt

Comments in 'Plugin Development' started by Goldish_Kirby, Jun 26, 2016.

  1. Goldish_Kirby
    Offline

    Goldish_Kirby New Member

    Joined:
    Jun 26, 2016
    Posts:
    2
    Minecraft User:
    Goldish_Kirby
    Haii,

    How do i let the first OP in the ops.txt to let ONLY him/her use a specific command?

    Like on a server host(I didn't put a name because it would count as advertising), there is a command that only the first OP can only use it.
  2. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    PHP:
    public function onPreprocess(PlayerCommandPreProcessEvent $event){ 
    if(
    $event->getMessage() == "/<command>"){
    if(
    file($this->getDataPath()."ops.txt")[0] != $event->getPlayer()->getName()){
    $event->setCancelled();
    }}}
    Survingo likes this.
  3. Jazzwhistle
    Offline

    Jazzwhistle Notable Member

    Joined:
    Dec 27, 2014
    Posts:
    364
    Minecraft User:
    Awzaw
    I'd add strtolower for the comparison too, but more importantly if you have more than one op they could deop the first person, unless you limit /deop too... or use "chattr +i ops.txt" to prevent anyone modifying it (Linux only, and you'd need access to the command line).

Share This Page

Advertisement