Packet based movement freeze (#1879)

* Remove unused files
* Remove walk/fly speed from limbo player
* Implement packet based movement freeze
This commit is contained in:
Gabriele C
2019-08-07 06:47:00 +02:00
committed by ljacqu
parent fadda43d13
commit db3acce70c
26 changed files with 234 additions and 1145 deletions
@@ -6,6 +6,7 @@ import fr.xephi.authme.data.limbo.LimboService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.LoginEvent;
import fr.xephi.authme.events.RestoreInventoryEvent;
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.permission.PlayerStatePermission;
import fr.xephi.authme.process.SynchronousProcess;
@@ -23,6 +24,7 @@ import org.bukkit.potion.PotionEffectType;
import javax.inject.Inject;
import java.util.List;
import static fr.xephi.authme.settings.properties.RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT;
import static fr.xephi.authme.settings.properties.RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN;
public class ProcessSyncPlayerLogin implements SynchronousProcess {
@@ -57,6 +59,9 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
@Inject
private PermissionsManager permissionsManager;
@Inject
private ProtocolLibService protocolLibService;
ProcessSyncPlayerLogin() {
}
@@ -87,6 +92,9 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
if (commonService.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) {
restoreInventory(player);
}
if (!commonService.getProperty(ALLOW_UNAUTHED_MOVEMENT)) {
protocolLibService.sendUnFreezePacket(player);
}
final PlayerAuth auth = dataSource.getAuth(name);
teleportationService.teleportOnLogin(player, auth, limbo);
@@ -56,6 +56,9 @@ public class ProcessSyncPlayerLogout implements SynchronousProcess {
if (service.getProperty(RestrictionSettings.PROTECT_INVENTORY_BEFORE_LOGIN)) {
protocolLibService.sendBlankInventoryPacket(player);
}
if (!service.getProperty(RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT)){
protocolLibService.sendFreezePacket(player);
}
applyLogoutEffect(player);
commandManager.runCommandsOnLogout(player);