Search in sources :

Example 11 with StoredProfile

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

the class NameCheckTask method requestPremiumLogin.

// Minecraft server implementation
// https://github.com/bergerkiller/CraftSource/blob/master/net.minecraft.server/LoginListener.java#L161
@Override
public void requestPremiumLogin(ProtocolLibLoginSource source, StoredProfile profile, String username, boolean registered) {
    try {
        source.enableOnlinemode();
    } catch (Exception ex) {
        plugin.getLog().error("Cannot send encryption packet. Falling back to cracked login for: {}", profile, ex);
        return;
    }
    String ip = player.getAddress().getAddress().getHostAddress();
    core.getPendingLogin().put(ip + username, new Object());
    byte[] verify = source.getVerifyToken();
    BukkitLoginSession playerSession = new BukkitLoginSession(username, verify, registered, profile);
    plugin.putSession(player.getAddress(), playerSession);
    // cancel only if the player has a paid account otherwise login as normal offline player
    synchronized (packetEvent.getAsyncMarker().getProcessingLock()) {
        packetEvent.setCancelled(true);
    }
}
Also used : BukkitLoginSession(com.github.games647.fastlogin.bukkit.BukkitLoginSession)

Example 12 with StoredProfile

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

the class ProtocolSupportListener method requestPremiumLogin.

@Override
public void requestPremiumLogin(ProtocolLoginSource source, StoredProfile profile, String username, boolean registered) {
    source.enableOnlinemode();
    String ip = source.getAddress().getAddress().getHostAddress();
    plugin.getCore().getPendingLogin().put(ip + username, new Object());
    BukkitLoginSession playerSession = new BukkitLoginSession(username, registered, profile);
    plugin.putSession(source.getAddress(), playerSession);
}
Also used : BukkitLoginSession(com.github.games647.fastlogin.bukkit.BukkitLoginSession)

Example 13 with StoredProfile

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

the class NameCheckTask method startCrackedSession.

@Override
public void startCrackedSession(ProtocolLibLoginSource source, StoredProfile profile, String username) {
    BukkitLoginSession loginSession = new BukkitLoginSession(username, profile);
    plugin.putSession(player.getAddress(), loginSession);
}
Also used : BukkitLoginSession(com.github.games647.fastlogin.bukkit.BukkitLoginSession)

Example 14 with StoredProfile

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

the class ProtocolSupportListener method callFastLoginPreLoginEvent.

@Override
public FastLoginPreLoginEvent callFastLoginPreLoginEvent(String username, ProtocolLoginSource source, StoredProfile profile) {
    BukkitFastLoginPreLoginEvent event = new BukkitFastLoginPreLoginEvent(username, source, profile);
    plugin.getServer().getPluginManager().callEvent(event);
    return event;
}
Also used : BukkitFastLoginPreLoginEvent(com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPreLoginEvent)

Example 15 with StoredProfile

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

the class ProtocolSupportListener method startCrackedSession.

@Override
public void startCrackedSession(ProtocolLoginSource source, StoredProfile profile, String username) {
    BukkitLoginSession loginSession = new BukkitLoginSession(username, profile);
    plugin.putSession(source.getAddress(), loginSession);
}
Also used : BukkitLoginSession(com.github.games647.fastlogin.bukkit.BukkitLoginSession)

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