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);
}
}
}
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);
}
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);
}
}
}
}
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);
}
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);
}
Aggregations