Added support of detecting name changes (Fixes #18)

This commit is contained in:
games647 committed 2016-06-01 14:42:48 +02:00
1 parent cb876a52bd
commit 51d0aefbf3
15 files changed
+186 -49

No files matched your search

@@ -38,6 +38,18 @@ public class AsyncPremiumCheck implements Runnable {
} else if (profile.getUserId() == -1) {
//user not exists in the db
BungeeAuthPlugin authPlugin = plugin.getBungeeAuthPlugin();
if (plugin.getConfiguration().getBoolean("nameChangeCheck")) {
UUID premiumUUID = plugin.getCore().getMojangApiConnector().getPremiumUUID(username);
if (premiumUUID != null) {
profile = plugin.getCore().getStorage().loadProfile(premiumUUID);
if (profile != null) {
plugin.getLogger().log(Level.FINER, "Player {0} changed it's username", premiumUUID);
connection.setOnlineMode(true);
plugin.getSession().put(connection, new LoginSession(username, false, profile));
}
}
}
if (plugin.getConfiguration().getBoolean("autoRegister")
&& (authPlugin == null || !authPlugin.isRegistered(username))) {
UUID premiumUUID = plugin.getCore().getMojangApiConnector().getPremiumUUID(username);
@@ -37,14 +37,9 @@ public class FastLoginBungee extends Plugin {
private final Random random = new Random();
private final ConcurrentMap<PendingConnection, Object> pendingAutoRegister = CacheBuilder
.newBuilder()
.expireAfterWrite(1, TimeUnit.MINUTES)
.<PendingConnection, Object>build().asMap();
private final ConcurrentMap<PendingConnection, LoginSession> session = CacheBuilder
.newBuilder()
.expireAfterWrite(1, TimeUnit.MINUTES)
.expireAfterWrite(5, TimeUnit.MINUTES)
.<PendingConnection, LoginSession>build().asMap();
@Override