Merge branch '777-Fast-Join-Handler' of https://github.com/AuthMe-Team/AuthMeReloaded
This commit is contained in:
commit
e38c1ea447
@ -192,31 +192,28 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (player != null) {
|
management.performJoin(player);
|
||||||
// Schedule login task so works after the prelogin
|
|
||||||
// (Fix found by Koolaid5000)
|
|
||||||
bukkitService.runTask(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
management.performJoin(player);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note ljacqu 20160528: AsyncPlayerPreLoginEvent is not fired by all servers in offline mode
|
// Note ljacqu 20160528: AsyncPlayerPreLoginEvent is not fired by all servers in offline mode
|
||||||
// e.g. CraftBukkit does not. So we need to run crucial things in onPlayerLogin, too
|
// e.g. CraftBukkit does not. So we need to run crucial things in onPlayerLogin, too
|
||||||
|
|
||||||
|
// Note sgdc3 20160619: No performance improvements if we do the same thing on the Sync method
|
||||||
|
// let's try to remove this, about the single session issue,
|
||||||
|
// i tried to use the low priority to the sync handler
|
||||||
|
|
||||||
|
/*
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
|
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
|
||||||
final String name = event.getName().toLowerCase();
|
final String name = event.getName().toLowerCase();
|
||||||
final boolean isAuthAvailable = dataSource.isAuthAvailable(event.getName());
|
//final boolean isAuthAvailable = dataSource.isAuthAvailable(event.getName());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Potential performance improvement: make checkAntiBot not require `isAuthAvailable` info and use
|
// Potential performance improvement: make checkAntiBot not require `isAuthAvailable` info and use
|
||||||
// "checkKickNonRegistered" as last -> no need to query the DB before checking antibot / name
|
// "checkKickNonRegistered" as last -> no need to query the DB before checking antibot / name
|
||||||
onJoinVerifier.checkAntibot(name, isAuthAvailable);
|
// onJoinVerifier.checkAntibot(name, isAuthAvailable);
|
||||||
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
// onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
||||||
onJoinVerifier.checkIsValidName(name);
|
// onJoinVerifier.checkIsValidName(name);
|
||||||
// Note #760: Single session must be checked here - checking with PlayerLoginEvent is too late and
|
// Note #760: Single session must be checked here - checking with PlayerLoginEvent is too late and
|
||||||
// the first connection will have been kicked. This means this feature doesn't work on CraftBukkit.
|
// the first connection will have been kicked. This means this feature doesn't work on CraftBukkit.
|
||||||
onJoinVerifier.checkSingleSession(name);
|
onJoinVerifier.checkSingleSession(name);
|
||||||
@ -225,8 +222,9 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
|
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (Utils.isUnrestricted(player)) {
|
if (Utils.isUnrestricted(player)) {
|
||||||
@ -237,12 +235,14 @@ public class AuthMePlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String name = player.getName().toLowerCase();
|
final String name = player.getName();
|
||||||
|
final String lowerName = name.toLowerCase();
|
||||||
final PlayerAuth auth = dataSource.getAuth(player.getName());
|
final PlayerAuth auth = dataSource.getAuth(player.getName());
|
||||||
final boolean isAuthAvailable = (auth != null);
|
final boolean isAuthAvailable = (auth != null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
onJoinVerifier.checkAntibot(name, isAuthAvailable);
|
onJoinVerifier.checkSingleSession(lowerName);
|
||||||
|
onJoinVerifier.checkAntibot(lowerName, isAuthAvailable);
|
||||||
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
onJoinVerifier.checkKickNonRegistered(isAuthAvailable);
|
||||||
onJoinVerifier.checkIsValidName(name);
|
onJoinVerifier.checkIsValidName(name);
|
||||||
onJoinVerifier.checkNameCasing(player, auth);
|
onJoinVerifier.checkNameCasing(player, auth);
|
||||||
|
|||||||
@ -49,9 +49,10 @@ public class ProcessSynchronousPlayerLogout implements SynchronousProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void restoreSpeedEffect(Player player) {
|
private void restoreSpeedEffect(Player player) {
|
||||||
if (service.getProperty(RestrictionSettings.REMOVE_SPEED)) {
|
if (!service.getProperty(RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT)
|
||||||
player.setWalkSpeed(0.0F);
|
&& service.getProperty(RestrictionSettings.REMOVE_SPEED)) {
|
||||||
player.setFlySpeed(0.0F);
|
player.setFlySpeed(0.0f);
|
||||||
|
player.setWalkSpeed(0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user