forked from TuxCoding/FastLogin
[SwitchMode] Kick the player only if the player is unknown to us
This commit is contained in:
14
CHANGELOG.md
14
CHANGELOG.md
@ -1,21 +1,21 @@
|
|||||||
######1.9
|
######1.9
|
||||||
|
|
||||||
* Remove the nasty UltraAuth fakeplayer workaround by using a new api method. You should UltraAuth if you have it
|
|
||||||
* Upgrade to Java 8
|
|
||||||
* Drop support for LoginSecurity 1.X since 2.X seems to be stable
|
|
||||||
* Refactored/Cleaned up a lot of code
|
|
||||||
* [API] Deprecated platform specific authplugin. Please use AuthPlugin< platform specific player type >
|
|
||||||
* [API] Deprecated bukkit's password generator. Please use PasswordGenerator< platform specific player type >
|
|
||||||
* Added second attempt login -> cracked login
|
* Added second attempt login -> cracked login
|
||||||
* Added cracked whitelist (switch-mode -> switching to online-mode from offlinemode)
|
* Added cracked whitelist (switch-mode -> switching to online-mode from offlinemode)
|
||||||
* Added configuration to disable auto logins for 2Factor authentication
|
* Added configuration to disable auto logins for 2Factor authentication
|
||||||
* Add missing add-premium-other message
|
* Added missing add-premium-other message
|
||||||
|
* Upgrade to Java 8 -> Minimize file size
|
||||||
|
* Refactored/Cleaned up a lot of code
|
||||||
|
* [API] Deprecated platform specific authplugin. Please use AuthPlugin< platform specific player type >
|
||||||
|
* [API] Deprecated bukkit's password generator. Please use PasswordGenerator< platform specific player type >
|
||||||
* Fix ProtocolSupport autoRegister
|
* Fix ProtocolSupport autoRegister
|
||||||
* Fix update username in FastLogin database after nameChange
|
* Fix update username in FastLogin database after nameChange
|
||||||
* Fix logging exceptions on encryption enabling
|
* Fix logging exceptions on encryption enabling
|
||||||
* Fix compatibility with older ProtocolLib versions (for 1.7) because of the missing getMethodAcccessorOrNull method
|
* Fix compatibility with older ProtocolLib versions (for 1.7) because of the missing getMethodAcccessorOrNull method
|
||||||
* Fix correct cracked permission for bukkit
|
* Fix correct cracked permission for bukkit
|
||||||
* A try to fix SQLite timestamp parsing
|
* A try to fix SQLite timestamp parsing
|
||||||
|
* Drop support for LoginSecurity 1.X since 2.X seems to be stable
|
||||||
|
* Remove the nasty UltraAuth fakeplayer workaround by using a new api method. You should UltraAuth if you have it
|
||||||
|
|
||||||
######1.8
|
######1.8
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@ package com.github.games647.fastlogin.bukkit;
|
|||||||
import com.github.games647.fastlogin.core.PlayerProfile;
|
import com.github.games647.fastlogin.core.PlayerProfile;
|
||||||
import com.github.games647.fastlogin.core.shared.LoginSession;
|
import com.github.games647.fastlogin.core.shared.LoginSession;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,7 +15,6 @@ public class BukkitLoginSession extends LoginSession {
|
|||||||
private final String serverId;
|
private final String serverId;
|
||||||
private final byte[] verifyToken;
|
private final byte[] verifyToken;
|
||||||
|
|
||||||
private UUID uuid;
|
|
||||||
private boolean verified;
|
private boolean verified;
|
||||||
|
|
||||||
private String encodedSkinData;
|
private String encodedSkinData;
|
||||||
@ -93,24 +90,6 @@ public class BukkitLoginSession extends LoginSession {
|
|||||||
this.verified = verified;
|
this.verified = verified;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the premium UUID of this player
|
|
||||||
*
|
|
||||||
* @return the premium UUID or null if not fetched
|
|
||||||
*/
|
|
||||||
public synchronized UUID getUuid() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the online UUID if it's fetched
|
|
||||||
*
|
|
||||||
* @param uuid premium UUID
|
|
||||||
*/
|
|
||||||
public synchronized void setUuid(UUID uuid) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether the player has a premium (paid account) account and valid session
|
* Get whether the player has a premium (paid account) account and valid session
|
||||||
*
|
*
|
||||||
|
@ -66,6 +66,8 @@ public class PlayerConnectionListener implements Listener {
|
|||||||
plugin.getCore().getPendingLogins().remove(ip + username);
|
plugin.getCore().getPendingLogins().remove(ip + username);
|
||||||
|
|
||||||
LoginSession session = plugin.getSession().get(connection);
|
LoginSession session = plugin.getSession().get(connection);
|
||||||
|
session.setUuid(connection.getUniqueId());
|
||||||
|
|
||||||
PlayerProfile playerProfile = session.getProfile();
|
PlayerProfile playerProfile = session.getProfile();
|
||||||
playerProfile.setUuid(connection.getUniqueId());
|
playerProfile.setUuid(connection.getUniqueId());
|
||||||
|
|
||||||
|
@ -46,15 +46,16 @@ public abstract class JoinManagement<T, S extends LoginSource> {
|
|||||||
|| (!checkNameChange(source, username, premiumUUID)
|
|| (!checkNameChange(source, username, premiumUUID)
|
||||||
&& !checkPremiumName(source, username, profile))) {
|
&& !checkPremiumName(source, username, profile))) {
|
||||||
//nothing detected the player as premium -> start a cracked session
|
//nothing detected the player as premium -> start a cracked session
|
||||||
|
if (core.getConfig().get("switchMode", false)) {
|
||||||
|
source.kick(core.getMessage("switch-kick-message"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
startCrackedSession(source, profile, username);
|
startCrackedSession(source, profile, username);
|
||||||
}
|
}
|
||||||
} else if (profile.isPremium()) {
|
} else if (profile.isPremium()) {
|
||||||
requestPremiumLogin(source, profile, username, true);
|
requestPremiumLogin(source, profile, username, true);
|
||||||
} else {
|
} else {
|
||||||
if (core.getConfig().get("switchMode", false)) {
|
|
||||||
source.kick(core.getMessage("switch-kick-message"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
startCrackedSession(source, profile, username);
|
startCrackedSession(source, profile, username);
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,15 @@ package com.github.games647.fastlogin.core.shared;
|
|||||||
|
|
||||||
import com.github.games647.fastlogin.core.PlayerProfile;
|
import com.github.games647.fastlogin.core.PlayerProfile;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class LoginSession {
|
public abstract class LoginSession {
|
||||||
|
|
||||||
private final String username;
|
private final String username;
|
||||||
private final PlayerProfile profile;
|
private final PlayerProfile profile;
|
||||||
|
|
||||||
|
private UUID uuid;
|
||||||
|
|
||||||
protected boolean registered;
|
protected boolean registered;
|
||||||
|
|
||||||
public LoginSession(String username, boolean registered, PlayerProfile profile) {
|
public LoginSession(String username, boolean registered, PlayerProfile profile) {
|
||||||
@ -30,4 +35,22 @@ public abstract class LoginSession {
|
|||||||
public PlayerProfile getProfile() {
|
public PlayerProfile getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the premium UUID of this player
|
||||||
|
*
|
||||||
|
* @return the premium UUID or null if not fetched
|
||||||
|
*/
|
||||||
|
public synchronized UUID getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the online UUID if it's fetched
|
||||||
|
*
|
||||||
|
* @param uuid premium UUID
|
||||||
|
*/
|
||||||
|
public synchronized void setUuid(UUID uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user