So far I have this plugin where when players join they get teleported to the default world: public function onJoin(PlayerJoinEvent $joinEvent) { $joinEvent->getPlayer()->teleport($joinEvent>getPlayer()->getServer()->getDefaultLevel()->getSafeSpawn()); } - How would make it so instead of a default level they get teleported to a level of my choice?
PHP: $p->teleport($this->plugin->getServer()->getLevelByName( 'levelnamehere')->getSpawnLocation()); $p = $ev->getPlayer(); btw ALSO MAKE SURE THE WORLD IS LOADED
public function onJoin(PlayerJoinEvent $joinEvent) { $p = $joinEvent->getPlayer(); $p->teleport($this->plugin->getServer()->getLevelByName( 'Hub')->getSpawnLocation());
change $p->teleport($this->plugin->getServer()->getLevelByName( 'Hub')->getSpawnLocation());[/QUOTE] to $p->teleport($this->getServer()->getLevelByName( 'Hub')->getSpawnLocation());[/QUOTE]
to $p->teleport($this->getServer()->getLevelByName( 'Hub')->getSpawnLocation());[/QUOTE][/QUOTE] Whoops my bad lol im so used to $this->plugin-> Lol