Join process cleanup, change some default settings (should improve performance and security with default settings)

This commit is contained in:
Gabriele C
2016-11-15 18:41:27 +01:00
parent 15ff9ae442
commit b53f71706a
8 changed files with 13 additions and 42 deletions
@@ -22,9 +22,7 @@ import fr.xephi.authme.settings.properties.RestrictionSettings;
import fr.xephi.authme.task.LimboPlayerTaskManager;
import fr.xephi.authme.service.BukkitService;
import fr.xephi.authme.util.PlayerUtils;
import org.apache.commons.lang.reflect.MethodUtils;
import org.bukkit.GameMode;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@@ -39,9 +37,6 @@ import static fr.xephi.authme.service.BukkitService.TICKS_PER_SECOND;
*/
public class AsynchronousJoin implements AsynchronousProcess {
private static final boolean DISABLE_COLLISIONS = MethodUtils
.getAccessibleMethod(LivingEntity.class, "setCollidable", new Class[]{}) != null;
@Inject
private AuthMe plugin;
@@ -75,20 +70,14 @@ public class AsynchronousJoin implements AsynchronousProcess {
AsynchronousJoin() {
}
public void processJoin(final Player player) {
final String name = player.getName().toLowerCase();
final String ip = PlayerUtils.getPlayerIp(player);
if (isPlayerUnrestricted(name)) {
if (service.getProperty(RestrictionSettings.UNRESTRICTED_NAMES).contains(name)) {
return;
}
// Prevent player collisions in 1.9
if (DISABLE_COLLISIONS) {
player.setCollidable(false);
}
if (service.getProperty(RestrictionSettings.FORCE_SURVIVAL_MODE)
&& !service.hasPermission(player, PlayerStatePermission.BYPASS_FORCE_SURVIVAL)) {
bukkitService.runTask(() -> player.setGameMode(GameMode.SURVIVAL));
@@ -115,7 +104,6 @@ public class AsynchronousJoin implements AsynchronousProcess {
return;
}
final boolean isAuthAvailable = database.isAuthAvailable(name);
if (isAuthAvailable) {
@@ -189,10 +177,6 @@ public class AsynchronousJoin implements AsynchronousProcess {
limboPlayerTaskManager.registerMessageTask(name, isAuthAvailable);
}
private boolean isPlayerUnrestricted(String name) {
return service.getProperty(RestrictionSettings.UNRESTRICTED_NAMES).contains(name);
}
/**
* Returns whether the name is restricted based on the restriction settings.
*