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

Run Command in Console by code

Comments in 'Plugin Development' started by Marcelo234, Apr 2, 2016.

  1. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    Hey Guys..I want,that my Plugin runs a command in my console when something happens...
    Maybe with $this->getServer()->getLogger()->runCommand("/tell xer Helle..Test");
    How to do it correctly?
  2. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    Do you mean run a command by console? If yes...
    PHP:
    $server->dispatchCommand(new ConsoleCommandSender(), 'tell Marcelo hello');
    Marcelo234 likes this.
  3. Marcelo234
    Offline

    Marcelo234 New Member

    Joined:
    Oct 18, 2014
    Posts:
    204
    Yes I mean-- :D Thanks
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Avoid executing commands as a sender through dispatchCommand while you can do it with sendMessage directly.

Share This Page

Advertisement