#630 Disable collisions for unlogged players

This commit is contained in:
Gabriele C
2016-04-01 18:21:05 +02:00
parent 997c31a03e
commit de89244e0e
5 changed files with 33 additions and 2 deletions
@@ -27,10 +27,14 @@ import fr.xephi.authme.util.Utils.GroupType;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask;
import com.comphenix.protocol.reflect.MethodUtils;
/**
*/
public class AsynchronousJoin implements Process {
@@ -42,6 +46,9 @@ public class AsynchronousJoin implements Process {
private final ProcessService service;
private final PlayerCache playerCache;
private final boolean disableCollisions = MethodUtils
.getAccessibleMethod(LivingEntity.class, "setCollidable", new Class[]{}) != null;
public AsynchronousJoin(Player player, AuthMe plugin, DataSource database, PlayerCache playerCache,
ProcessService service) {
this.player = player;
@@ -89,6 +96,10 @@ public class AsynchronousJoin implements Process {
});
return;
}
// Prevent player collisions in 1.9
if (disableCollisions) {
((LivingEntity) player).setCollidable(false);
}
final Location spawnLoc = service.getSpawnLoader().getSpawnLocation(player);
final boolean isAuthAvailable = database.isAuthAvailable(name);
if (isAuthAvailable) {