Update premium status for non-bungeecord setups (Related #200)

This commit is contained in:
games647
2018-03-27 20:43:53 +02:00
parent 6d207d62ba
commit 82ec71e8d0
3 changed files with 9 additions and 6 deletions

View File

@ -89,16 +89,12 @@ public class BungeeListener implements PluginMessageListener {
InetSocketAddress address = player.getAddress();
String id = '/' + address.getAddress().getHostAddress() + ':' + address.getPort();
if (type == Type.LOGIN) {
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.PREMIUM);
BukkitLoginSession playerSession = new BukkitLoginSession(playerName, true);
playerSession.setVerified(true);
plugin.getLoginSessions().put(id, playerSession);
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new ForceLoginTask(plugin.getCore(), player), 20L);
} else if (type == Type.REGISTER) {
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.PREMIUM);
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> {
AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
try {
@ -114,6 +110,7 @@ public class BungeeListener implements PluginMessageListener {
}
}, 20L);
} else if (type == Type.CRACKED) {
//we don't start a forcelogin task here so update it manually
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.CRACKED);
}
}

View File

@ -2,6 +2,7 @@ package com.github.games647.fastlogin.bukkit.tasks;
import com.github.games647.fastlogin.bukkit.BukkitLoginSession;
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
import com.github.games647.fastlogin.core.PremiumStatus;
import com.github.games647.fastlogin.core.messages.SuccessMessage;
import com.github.games647.fastlogin.core.shared.FastLoginCore;
import com.github.games647.fastlogin.core.shared.ForceLoginManagement;
@ -28,10 +29,16 @@ public class ForceLoginTask extends ForceLoginManagement<Player, CommandSender,
@Override
public void run() {
//blacklist this target player for BungeeCord Id brute force attacks
//blacklist this target player for BungeeCord ID brute force attacks
FastLoginBukkit plugin = core.getPlugin();
player.setMetadata(core.getPlugin().getName(), new FixedMetadataValue(plugin, true));
if (isOnlineMode()) {
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.PREMIUM);
} else {
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.CRACKED);
}
super.run();
}

View File

@ -24,7 +24,6 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
}
AuthStorage storage = core.getStorage();
StoredProfile playerProfile = session.getProfile();
try {
if (isOnlineMode()) {