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

Solved Compass Command

Discussion in 'Development' started by _XHazardX_, Oct 9, 2017.

  1. _XHazardX_

    _XHazardX_ Spider Jockey

    Messages:
    33
    GitHub:
    XHazardX420
    Hello, so I wanted to make this plugin where if you interact with a compass it opens a test ui, but the code isn't working when I interact with the compass it loads theres no errors just doesn't work. Code:

    public function onTap (PlayerInteractEvent $event) {
    $player = $event->getPlayer();
    $item = $player->getInventory()->getItemInHand()->getId();
    if ($item == 345);
    $this->getServer()->dispatchCommand(new ConsoleCommandSender(), 'cui testsimple');
    }
    }
     
  2. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    Player
    PHP:
    $this->getServer()->dispatchCommand($player"<say hello>");
    console:
    PHP:
    $this->getServer()->dispatchCommand(new ConsoleCommandSender(), "<boradcast this is a simple test>");
     
  3. _XHazardX_

    _XHazardX_ Spider Jockey

    Messages:
    33
    GitHub:
    XHazardX420
    Thanks for the help!
     
  4. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    ^~^
     
  5. _XHazardX_

    _XHazardX_ Spider Jockey

    Messages:
    33
    GitHub:
    XHazardX420
    $this->getServer()->dispatchCommand($player, "<say this is a simpletest>"); Nothing happens when I interact with the compass still? theres no errors either "[Server thread/INFO]: Enabling Compass_ui v1"
     
  6. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    :facepalm:
    use this:
    PHP:
    $this->getServer()->dispatchCommand($player"cui testsimple");
     
    Last edited: Oct 10, 2017
    Kyd and Muqsit like this.
  7. _XHazardX_

    _XHazardX_ Spider Jockey

    Messages:
    33
    GitHub:
    XHazardX420
    ParseError: "syntax error, unexpected ''cui testsimple'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')'"
     
    Levi likes this.
  8. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Read the error. You obviously forgot the comma. PHP is already giving very readable syntax error messages; what else could one ask for?
     
    OnTheVerge, Levi, Muqsit and 3 others like this.
  9. _XHazardX_

    _XHazardX_ Spider Jockey

    Messages:
    33
    GitHub:
    XHazardX420
    So i fixed this issue but it doesn't send the ui to the player, but when I put other commands it works.
     
  10. _XHazardX_

    _XHazardX_ Spider Jockey

    Messages:
    33
    GitHub:
    XHazardX420
    Anyone know how to fix?
     
  11. Abdallah Omar

    Abdallah Omar Creeper

    Messages:
    4
    GitHub:
    taqialsaeed
    What uses are used؟
     
  12. OnTheVerge

    OnTheVerge Spider Jockey

    Messages:
    46
    Sorry to break the bad news to ya bud ;) but the Original Poster of this thread probably won't ever reply. He quit developing and minecraft overall months ago:(
    Good luck searching!:)
     
    xXNiceAssassinlo YT likes this.
  13. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    (off topic) you probably will be warned xd
     
    OnTheVerge likes this.
  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.