1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

I want to ban specific command

Discussion in 'Facepalm' started by chansol, Jun 6, 2017.

  1. chansol

    chansol Spider Jockey

    Messages:
    32
    GitHub:
    ParkChanSol
    I want to ban "/me" command

    public function onPlayerCommandProcessEvent (PlayerCommandPreprocessEvent $ev) {

    $player = $ev->getPlayer();
    $message = $ev->getMessage();
    $words = explode(" ", $message);
    $cmd = strtolower(substr(array_shift($words), 1));

    if ($cmd === "me") {
    $player->sendMessage("§b§o[ Notice ] §7You can't use this command");
    }

    }

    This source doesn't work. What is wrong?
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    The PlayerCommandPreprocessEvent message contains the slash.
     
  3. chansol

    chansol Spider Jockey

    Messages:
    32
    GitHub:
    ParkChanSol
    I solved already this problem. Thank you to answer
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.