mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-25 01:57:48 +01:00
Need to calcul position synchronously
This commit is contained in:
parent
d61a4dbf32
commit
505bda79f0
@ -153,6 +153,7 @@ public class AsyncronousJoin {
|
||||
if (!Settings.noTeleport)
|
||||
if (!needFirstspawn() && Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) {
|
||||
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, PlayerCache.getInstance().isAuthenticated(name));
|
||||
@ -259,7 +260,6 @@ public class AsyncronousJoin {
|
||||
|
||||
private void placePlayerSafely(final Player player,
|
||||
final Location spawnLoc) {
|
||||
Location loc = null;
|
||||
if (spawnLoc == null)
|
||||
return;
|
||||
if (!Settings.noTeleport)
|
||||
@ -268,6 +268,11 @@ public class AsyncronousJoin {
|
||||
return;
|
||||
if (!player.hasPlayedBefore())
|
||||
return;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Location loc = null;
|
||||
Block b = player.getLocation().getBlock();
|
||||
if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL) {
|
||||
m.send(player, "unsafe_spawn");
|
||||
@ -281,17 +286,11 @@ public class AsyncronousJoin {
|
||||
loc = spawnLoc;
|
||||
}
|
||||
}
|
||||
if (loc != null) {
|
||||
final Location floc = loc;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.teleport(floc);
|
||||
if (loc != null)
|
||||
player.teleport(loc);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user