Search in sources :

Example 26 with StoredProfile

use of com.github.games647.fastlogin.core.StoredProfile in project FastLogin by games647.

the class SQLStorage method parseResult.

private Optional<StoredProfile> parseResult(ResultSet resultSet) throws SQLException {
    if (resultSet.next()) {
        long userId = resultSet.getInt(1);
        UUID uuid = Optional.ofNullable(resultSet.getString(2)).map(UUIDAdapter::parseId).orElse(null);
        String name = resultSet.getString(3);
        boolean premium = resultSet.getBoolean(4);
        String lastIp = resultSet.getString(5);
        Instant lastLogin = resultSet.getTimestamp(6).toInstant();
        return Optional.of(new StoredProfile(userId, uuid, name, premium, lastIp, lastLogin));
    }
    return Optional.empty();
}
Also used : StoredProfile(com.github.games647.fastlogin.core.StoredProfile) Instant(java.time.Instant) UUID(java.util.UUID)

Aggregations

StoredProfile (com.github.games647.fastlogin.core.StoredProfile)17 BukkitLoginSession (com.github.games647.fastlogin.bukkit.BukkitLoginSession)4 BukkitFastLoginPremiumToggleEvent (com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPremiumToggleEvent)4 PremiumToggleReason (com.github.games647.fastlogin.core.shared.event.FastLoginPremiumToggleEvent.PremiumToggleReason)4 UUID (java.util.UUID)4 BungeeLoginSession (com.github.games647.fastlogin.bungee.BungeeLoginSession)3 VelocityLoginSession (com.github.games647.fastlogin.velocity.VelocityLoginSession)3 Profile (com.github.games647.craftapi.model.Profile)2 RateLimitException (com.github.games647.craftapi.resolver.RateLimitException)2 BukkitFastLoginPreLoginEvent (com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPreLoginEvent)2 BungeeFastLoginPremiumToggleEvent (com.github.games647.fastlogin.bungee.event.BungeeFastLoginPremiumToggleEvent)2 LoginSession (com.github.games647.fastlogin.core.shared.LoginSession)2 VelocityFastLoginPremiumToggleEvent (com.github.games647.fastlogin.velocity.event.VelocityFastLoginPremiumToggleEvent)2 BukkitFastLoginAutoLoginEvent (com.github.games647.fastlogin.bukkit.event.BukkitFastLoginAutoLoginEvent)1 FloodgateService (com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService)1 SQLStorage (com.github.games647.fastlogin.core.storage.SQLStorage)1 Subscribe (com.velocitypowered.api.event.Subscribe)1 IOException (java.io.IOException)1 Instant (java.time.Instant)1 PendingConnection (net.md_5.bungee.api.connection.PendingConnection)1