[Solved] How to set player's world ?

Discussion in 'Plugin Development' started by lololmaker, Jul 13, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    lololmaker

    Hey !
    Once again I'm posting here, to ask you if there's any way to set player's world (Multiverse).
    I haven't found documentation with some explanation how to do it, only Javadocs.

    Anyone here knows how can I set player's world with Multiverse if I have world name ?
    For example I want to deny player's entry to the world or I want to teleport him to another world.

    Thanks in advance !
     
  2. Offline

    LucasEmanuel

    player.teleport(location)

    onTeleportEvent(PlayerTeleportEvent event) {
    event.setCanceled(true);
    }
     
    lololmaker likes this.
  3. Offline

    gjossep

    Well just get the Player and do teleport with a location, as a location has a world.
     
    lololmaker likes this.
  4. Offline

    SchmidtMathias

    entity.teleport(new Location(getServer().getWorld(WORLDNAME),x,y,z);
     
    lololmaker likes this.
  5. Offline

    lololmaker

    Ah, so I forgot location has world, thanks !
     
  6. Offline

    -_Husky_-

    Or.. p.getLocation().setWorld(world);
     
  7. Offline

    SchmidtMathias

    But I guess that doesn't change the World the Entity is in, it just changes the world the Location is allocated to, right?
     
  8. Offline

    lololmaker

    Didn't try, but since Location it self is more useful in my case I will stick to it ;)
    Thanks anyway.
     
  9. That won't work as the Location object is only read by the server... that's why there's a .teleport() method.
    So use that lololmaker if you want to change the player's actual position.
     
    lololmaker likes this.
Thread Status:
Not open for further replies.

Share This Page