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

click mob to run a command

Comments in 'Plugin Development' started by GamesLoad, Apr 20, 2015.

  1. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    Hello guys I wanted to know if and when you can touch a mob run a command thanks.
  2. vlad46
    Offline

    vlad46 New Member

    Joined:
    Mar 21, 2014
    Posts:
    12
    EntityDamageEvent and $this->setCancelled(true);
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Hook to EntityDamageEvent, check if event is instanceof EntityDamageByEntityEvent, if yes, if damager instanceof Player, $event->getEntity() is the clicked entity. Use $server->dispatchCommand($commandLine, $player) to run a command.
    Samueljh1, xiaoq and GamesLoad like this.

Share This Page

Advertisement