forked from TuxCoding/FastLogin
Update premium status for non-bungeecord setups (Related #200)
This commit is contained in:
@ -89,16 +89,12 @@ public class BungeeListener implements PluginMessageListener {
|
|||||||
InetSocketAddress address = player.getAddress();
|
InetSocketAddress address = player.getAddress();
|
||||||
String id = '/' + address.getAddress().getHostAddress() + ':' + address.getPort();
|
String id = '/' + address.getAddress().getHostAddress() + ':' + address.getPort();
|
||||||
if (type == Type.LOGIN) {
|
if (type == Type.LOGIN) {
|
||||||
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.PREMIUM);
|
|
||||||
|
|
||||||
BukkitLoginSession playerSession = new BukkitLoginSession(playerName, true);
|
BukkitLoginSession playerSession = new BukkitLoginSession(playerName, true);
|
||||||
playerSession.setVerified(true);
|
playerSession.setVerified(true);
|
||||||
plugin.getLoginSessions().put(id, playerSession);
|
plugin.getLoginSessions().put(id, playerSession);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new ForceLoginTask(plugin.getCore(), player), 20L);
|
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new ForceLoginTask(plugin.getCore(), player), 20L);
|
||||||
} else if (type == Type.REGISTER) {
|
} else if (type == Type.REGISTER) {
|
||||||
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.PREMIUM);
|
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> {
|
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> {
|
||||||
AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
|
AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
|
||||||
try {
|
try {
|
||||||
@ -114,6 +110,7 @@ public class BungeeListener implements PluginMessageListener {
|
|||||||
}
|
}
|
||||||
}, 20L);
|
}, 20L);
|
||||||
} else if (type == Type.CRACKED) {
|
} else if (type == Type.CRACKED) {
|
||||||
|
//we don't start a forcelogin task here so update it manually
|
||||||
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.CRACKED);
|
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.CRACKED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.github.games647.fastlogin.bukkit.tasks;
|
|||||||
|
|
||||||
import com.github.games647.fastlogin.bukkit.BukkitLoginSession;
|
import com.github.games647.fastlogin.bukkit.BukkitLoginSession;
|
||||||
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
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.messages.SuccessMessage;
|
||||||
import com.github.games647.fastlogin.core.shared.FastLoginCore;
|
import com.github.games647.fastlogin.core.shared.FastLoginCore;
|
||||||
import com.github.games647.fastlogin.core.shared.ForceLoginManagement;
|
import com.github.games647.fastlogin.core.shared.ForceLoginManagement;
|
||||||
@ -28,10 +29,16 @@ public class ForceLoginTask extends ForceLoginManagement<Player, CommandSender,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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();
|
FastLoginBukkit plugin = core.getPlugin();
|
||||||
player.setMetadata(core.getPlugin().getName(), new FixedMetadataValue(plugin, true));
|
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();
|
super.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
|
|||||||
}
|
}
|
||||||
|
|
||||||
AuthStorage storage = core.getStorage();
|
AuthStorage storage = core.getStorage();
|
||||||
|
|
||||||
StoredProfile playerProfile = session.getProfile();
|
StoredProfile playerProfile = session.getProfile();
|
||||||
try {
|
try {
|
||||||
if (isOnlineMode()) {
|
if (isOnlineMode()) {
|
||||||
|
Reference in New Issue
Block a user