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

Void Teleportation

Comments in 'Plugin Development' started by MiguelBad9, Apr 1, 2015.

  1. MiguelBad9
    Offline

    MiguelBad9 New Member

    Joined:
    Sep 26, 2013
    Posts:
    4
    PHP:
    public function onVoidLoop(PlayerMoveEvent $event){
            if(
    $event->getTo()->getFloorY() < 2){
                
    $event->getPlayer()->teleport($this->getServer()->getDefaultLevel()->getSpawnLocation());
            }
        }
    }
    How do you get it to not teleport to the DefaultLevel? What can you put instead of getDefaultLevel. So, the problem is that every time someone falls down a void, they get teleported to the DEFAULT WORLD/LEVEL. But I want it to teleport to the current level/world that he/she is in. I don't know a lot about PHP.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,230
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why still keep the last meaningful line?
  3. MiguelBad9
    Offline

    MiguelBad9 New Member

    Joined:
    Sep 26, 2013
    Posts:
    4
    Yes, yes it is but it's just for personal use. Its not like I'm going to upload it. And thanks :)
  4. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,084
    Plugins:
    17
    PHP:
    public function onVoidLoop(PlayerMoveEvent $event){
            if(
    $event->getTo()->getFloorY() < 2){
                
    $event->getPlayer()->teleport($event->getPlayer()->getLevel()->getSpawnLocation());
            }
        }
    }
    I would do this instead.
    PEMapModder likes this.

Share This Page

Advertisement