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

Navigator

Discussion in 'Development' started by b3st_Thunder78, Jul 10, 2019.

  1. b3st_Thunder78

    b3st_Thunder78 Spider Jockey

    Messages:
    38
    Hi,
    How can you make such a navigator for a lobby system?
    So I know partly how to do that but how do you find out if it has been read and that it is a compass at all?
    So I only think of the PlayInteractEvent but how do you do that in general?
     
  2. VirdSeater

    VirdSeater Spider

    Messages:
    7
    You have to check, if item has the name of you're item. If it has, you can set new items in Players inventory or whatever.
     
  3. b3st_Thunder78

    b3st_Thunder78 Spider Jockey

    Messages:
    38
    maybe
    PHP:
    public function onInteract(PlayerInteractEvent $event) {
            
    $item $event->getItem();
            
    $player $event->getPlayer();
            if (
    $item instanceof Compass) {
                
    $player->sendMessage("has worked");
            }
        }
     
  4. VirdSeater

    VirdSeater Spider

    Messages:
    7
    no, you can't check, if $item instanceof Compass, I think. Try this out:
    PHP:
        public function onInteract (PlayerInteractEvent $event)
        {
            
    $item $event->getItem();
            
    $player $event->getPlayer();
            if (
    $item->getCustomName() == "NameOfItem") {
                
    $player->sendMessage("has worked");
            }
        }
     
  5. b3st_Thunder78

    b3st_Thunder78 Spider Jockey

    Messages:
    38
    ok... thanks
     
  6. Marabou

    Marabou Baby Zombie

    Messages:
    137
    GitHub:
    wiligangster
    You can check
    this code work too.
     
  7. VirdSeater

    VirdSeater Spider

    Messages:
    7
    oof, i never used 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.