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

Solved Instance of Player in world

Discussion in 'Development' started by Amon28, Jun 11, 2017.

  1. Amon28

    Amon28 Slime

    Messages:
    76
    GitHub:
    amon28
    How do i get instance of player in a world ex. If player enters a command the code gets the player's world name if his in a world named spawn the command will work
     
  2. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    PHP:
    public function onCommand(CommandSender $senderCommand $cmd$label, array $args) {
        if(
    $sender->getLevel()->getName() === "spawn") {
            if(
    $cmd->getName() === "blablabla") {
                
    // code here
            
    }
        }
    }
     
    Amon28 likes this.
  3. Amon28

    Amon28 Slime

    Messages:
    76
    GitHub:
    amon28
    Thanks :)
     
  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.