Search in sources :

Example 1 with LoginSession

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

the class PluginMessageListener method onSuccessMessage.

private void onSuccessMessage(Player forPlayer) {
    if (forPlayer.isOnlineMode()) {
        // bukkit module successfully received and force logged in the user
        // update only on success to prevent corrupt data
        VelocityLoginSession loginSession = plugin.getSession().get(forPlayer.getRemoteAddress());
        StoredProfile playerProfile = loginSession.getProfile();
        loginSession.setRegistered(true);
        if (!loginSession.isAlreadySaved()) {
            playerProfile.setPremium(true);
            plugin.getCore().getStorage().save(playerProfile);
            loginSession.setAlreadySaved(true);
        }
    }
}
Also used : StoredProfile(com.github.games647.fastlogin.core.StoredProfile) VelocityLoginSession(com.github.games647.fastlogin.velocity.VelocityLoginSession)

Example 2 with LoginSession

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

the class ForceLoginTask method onForceActionSuccess.

@Override
public void onForceActionSuccess(LoginSession session) {
    // sub channel name
    Type type = Type.LOGIN;
    if (session.needsRegistration()) {
        type = Type.REGISTER;
    }
    UUID proxyId = core.getPlugin().getProxyId();
    ChannelMessage loginMessage = new LoginActionMessage(type, player.getUsername(), proxyId);
    core.getPlugin().sendPluginMessage(server, loginMessage);
}
Also used : Type(com.github.games647.fastlogin.core.message.LoginActionMessage.Type) LoginActionMessage(com.github.games647.fastlogin.core.message.LoginActionMessage) UUID(java.util.UUID) ChannelMessage(com.github.games647.fastlogin.core.message.ChannelMessage)

Example 3 with LoginSession

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

the class ConnectListener method onLogin.

@EventHandler(priority = EventPriority.LOWEST)
public void onLogin(LoginEvent loginEvent) {
    if (loginEvent.isCancelled()) {
        return;
    }
    // use the login event instead of the post login event in order to send the login success packet to the client
    // with the offline uuid this makes it possible to set the skin then
    PendingConnection connection = loginEvent.getConnection();
    if (connection.isOnlineMode()) {
        LoginSession session = plugin.getSession().get(connection);
        UUID verifiedUUID = connection.getUniqueId();
        String verifiedUsername = connection.getName();
        session.setUuid(verifiedUUID);
        session.setVerifiedUsername(verifiedUsername);
        StoredProfile playerProfile = session.getProfile();
        playerProfile.setId(verifiedUUID);
        // bungeecord will do this automatically so override it on disabled option
        if (uniqueIdSetter != null) {
            InitialHandler initialHandler = (InitialHandler) connection;
            if (!plugin.getCore().getConfig().get("premiumUuid", true)) {
                setOfflineId(initialHandler, verifiedUsername);
            }
            if (!plugin.getCore().getConfig().get("forwardSkin", true)) {
                // this is null on offline mode
                LoginResult loginProfile = initialHandler.getLoginProfile();
                loginProfile.setProperties(emptyProperties);
            }
        }
    }
}
Also used : BungeeLoginSession(com.github.games647.fastlogin.bungee.BungeeLoginSession) LoginSession(com.github.games647.fastlogin.core.shared.LoginSession) StoredProfile(com.github.games647.fastlogin.core.StoredProfile) LoginResult(net.md_5.bungee.connection.LoginResult) PendingConnection(net.md_5.bungee.api.connection.PendingConnection) UUID(java.util.UUID) InitialHandler(net.md_5.bungee.connection.InitialHandler) EventHandler(net.md_5.bungee.event.EventHandler)

Example 4 with LoginSession

use of com.github.games647.fastlogin.core.shared.LoginSession 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 5 with LoginSession

use of com.github.games647.fastlogin.core.shared.LoginSession 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)4 UUID (java.util.UUID)4 BukkitLoginSession (com.github.games647.fastlogin.bukkit.BukkitLoginSession)2 BungeeLoginSession (com.github.games647.fastlogin.bungee.BungeeLoginSession)2 ChannelMessage (com.github.games647.fastlogin.core.message.ChannelMessage)2 LoginActionMessage (com.github.games647.fastlogin.core.message.LoginActionMessage)2 Type (com.github.games647.fastlogin.core.message.LoginActionMessage.Type)2 LoginSession (com.github.games647.fastlogin.core.shared.LoginSession)2 VelocityLoginSession (com.github.games647.fastlogin.velocity.VelocityLoginSession)2 CrackedCommand (com.github.games647.fastlogin.bukkit.command.CrackedCommand)1 PremiumCommand (com.github.games647.fastlogin.bukkit.command.PremiumCommand)1 BukkitFastLoginAutoLoginEvent (com.github.games647.fastlogin.bukkit.event.BukkitFastLoginAutoLoginEvent)1 ConnectionListener (com.github.games647.fastlogin.bukkit.listener.ConnectionListener)1 PaperCacheListener (com.github.games647.fastlogin.bukkit.listener.PaperCacheListener)1 SkinApplyListener (com.github.games647.fastlogin.bukkit.listener.protocollib.SkinApplyListener)1 ProtocolSupportListener (com.github.games647.fastlogin.bukkit.listener.protocolsupport.ProtocolSupportListener)1 DelayedAuthHook (com.github.games647.fastlogin.bukkit.task.DelayedAuthHook)1 FloodgateService (com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService)1 Subscribe (com.velocitypowered.api.event.Subscribe)1 PendingConnection (net.md_5.bungee.api.connection.PendingConnection)1