mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-09-07 12:48:03 +02:00
Cleanup + fix some teleport behaviour
This commit is contained in:
parent
4b81e3b7dc
commit
5d6f3e1f06
@ -193,10 +193,9 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
teleportationService.teleportNewPlayerToFirstSpawn(player);
|
||||
management.performJoin(player);
|
||||
}
|
||||
|
||||
@ -206,7 +205,7 @@ public class PlayerListener implements Listener {
|
||||
// event caused by "logged in from another location". The nicer way, but only for Spigot, would be
|
||||
// to check in the AsyncPlayerPreLoginEvent. To support all servers, we use the less nice way.
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
final String name = player.getName();
|
||||
@ -239,6 +238,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
antiBot.handlePlayerJoin(player);
|
||||
teleportationService.teleportNewPlayerToFirstSpawn(player);
|
||||
teleportationService.teleportOnJoin(player);
|
||||
}
|
||||
|
||||
@ -261,10 +261,12 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerKick(PlayerKickEvent event) {
|
||||
// Note #831: Especially for offline CraftBukkit, we need to catch players being kicked because of
|
||||
// "logged in from another location" and to cancel their kick
|
||||
if (settings.getProperty(RestrictionSettings.FORCE_SINGLE_SESSION)
|
||||
&& event.getReason().contains("You logged in from another location")) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
if(settings.getProperty(RestrictionSettings.FORCE_SINGLE_SESSION)) {
|
||||
String reason = event.getReason();
|
||||
if (reason.contains("You logged in from another location")) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
|
@ -72,7 +72,7 @@ public class TeleportationService implements Reloadable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN) || mustForceSpawnAfterLogin(player.getWorld().getName())) {
|
||||
if (settings.getProperty(TELEPORT_UNAUTHED_TO_SPAWN)) {
|
||||
teleportToSpawn(player, playerCache.isAuthenticated(player.getName()));
|
||||
}
|
||||
}
|
||||
@ -160,15 +160,10 @@ public class TeleportationService implements Reloadable {
|
||||
* @param event the event to emit and according to which to teleport
|
||||
*/
|
||||
private void performTeleportation(final Player player, final AbstractTeleportEvent event) {
|
||||
bukkitService.scheduleSyncDelayedTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
bukkitService.callEvent(event);
|
||||
if (player.isOnline() && isEventValid(event)) {
|
||||
player.teleport(event.getTo());
|
||||
}
|
||||
}
|
||||
});
|
||||
bukkitService.callEvent(event);
|
||||
if (player.isOnline() && isEventValid(event)) {
|
||||
player.teleport(event.getTo());
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isEventValid(AbstractTeleportEvent event) {
|
||||
|
Loading…
Reference in New Issue
Block a user