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

Solved How player run command when tap on an item in virtual chest

Discussion in 'Development' started by armagadon159753, Sep 9, 2017.

  1. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    Plugin using:
    https://pastebin.com/rvUiTCWY

    Thx frago ^~^
    I want when player tap on item in virtual chest, that run command such ass:
    -1vs1( other plugins)
    -gamemode s
    -status
    -About
     
  2. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Run as player:
    PHP:
    /*
     * @var Player $player
     */
    $this->getServer()->dispatchCommand($player"<command>"); // no slash "/" in <command> needed
    Run as console:
    PHP:
    /*
     * @var Player $player
     */
    $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "<command>"); // no slash "/" in <command> needed
     
    Last edited: Sep 9, 2017
  3. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    Thx vert much for you help
     
  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.