Hi, Sometimes, when I call Player#teleport(), it teleports the user to the spawnpoint in 'world', and not the specified location. There are no errors in console. This sometimes happens in a PlayerJoinEvent, where the console prints: Code (Text): logged in with entity id 3922 at ([SkyHub]0.4726654769699049, 50.0, 0.4810457954751853) My code: Code (Java): World w = Bukkit.getWorld(LocalDataHandler.getInstance().getConfig().getString("lobby.world_name")); double x = Double.parseDouble(String.valueOf(LocalDataHandler.getInstance().getConfig().getDouble("lobby.x"))); double y = Double.parseDouble(String.valueOf(LocalDataHandler.getInstance().getConfig().getDouble("lobby.y"))); double z = Double.parseDouble(String.valueOf(LocalDataHandler.getInstance().getConfig().getDouble("lobby.z"))); float yaw = (float) Float.parseFloat(String.valueOf(LocalDataHandler.getInstance().getConfig().getDouble("lobby.yaw"))); float pitch = (float) Float.parseFloat(String.valueOf(LocalDataHandler.getInstance().getConfig().getDouble("lobby.pitch"))); e.getPlayer().teleport(new Location(w, x, y, z, yaw, pitch)); This also sometimes happens in a joinGame() method. (I've checked if the location is null.) Code (Java): p.teleport(new Location(Bukkit.getWorld(arena.getWaitingLobby().getWorld().getUID()), arena.getWaitingLobby().getX(), arena.getWaitingLobby().getY(), arena.getWaitingLobby().getZ(), arena.getWaitingLobby().getYaw(), arena.getWaitingLobby().getPitch())); Any help would be appreciated.
On the player join event, make a runnable that is executed a bit later. Since it’s a hub I guess that every time a player joins they are teleported to spawn point so if you teleport them a bit after that you should be fine
I had the same issue, surprisingly it was happening with 1.8 clients only, when I updated my server out of 1.8 it was still happening for those who used 1.8 (with protocol hack), but not for other version players, so it looks like a 1.8 bug
Then show the full joinGame() method Also what object does arena.getWaitingLobby().getWorld() return? A world? Why use Bukkit.getWorld()?
@Maxx_Qc I just used Bukkit.getWorld() as a debugging process just to see if that could be causing the problem. Full method: https://pastie.io/dvngcb.ino
Code (Java): for (Arena a : Main.arenas) { if ([B]!a.isActive()[/B]) { if (!a.isDoubles()) { usableArenas.add(a); } } } Can I ask why are you using a non-active arena as an usable arena? Also why don't you put both of your if on the same line? Code (Java): p.teleport(finalArena.getWaitingLobby()); It seems like getWaitingLobby() returns a location so why not just use it like that?
'active' returns true if a game has begun. That's the problem - when I use that to teleport, it teleports me to 'world' instead of the specified world in the waiting lobby location.
Use system.out.println(finalArena.getWaitingLobby().toString()); to see the actual world of that location