mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
Clear proxies file name
This commit is contained in:
@ -107,7 +107,7 @@ This plugin performs network requests to:
|
|||||||
|
|
||||||
1. Activate BungeeCord in the Spigot configuration
|
1. Activate BungeeCord in the Spigot configuration
|
||||||
2. Restart your server
|
2. Restart your server
|
||||||
3. Now there is proxy-whitelist file in the FastLogin folder
|
3. Now there is `allowed-proxies.txt` file in the FastLogin folder
|
||||||
Put your stats id from the BungeeCord config into this file
|
Put your stats id from the BungeeCord config into this file
|
||||||
4. Activate ipForward in your BungeeCord config
|
4. Activate ipForward in your BungeeCord config
|
||||||
5. Download and Install FastLogin (or FastLoginBungee in newer versions) on BungeeCord AND Spigot
|
5. Download and Install FastLogin (or FastLoginBungee in newer versions) on BungeeCord AND Spigot
|
||||||
|
@ -27,9 +27,10 @@ import static java.util.stream.Collectors.toSet;
|
|||||||
|
|
||||||
public class BungeeManager {
|
public class BungeeManager {
|
||||||
|
|
||||||
private static final String FILE_NAME = "proxy-whitelist.txt";
|
private static final String LEGACY_FILE_NAME = "proxy-whitelist.txt";
|
||||||
|
private static final String FILE_NAME = "allowed-proxies.txt";
|
||||||
|
|
||||||
//null if whitelist is empty so bungeecord support is disabled
|
//null if proxies allowed list is empty so bungeecord support is disabled
|
||||||
private Set<UUID> proxyIds;
|
private Set<UUID> proxyIds;
|
||||||
|
|
||||||
private final FastLoginBukkit plugin;
|
private final FastLoginBukkit plugin;
|
||||||
@ -42,7 +43,7 @@ public class BungeeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
//remove old blacklists
|
//remove old blocked status
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> player.removeMetadata(plugin.getName(), plugin));
|
Bukkit.getOnlinePlayers().forEach(player -> player.removeMetadata(plugin.getName(), plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,19 +102,27 @@ public class BungeeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Set<UUID> loadBungeeCordIds() {
|
private Set<UUID> loadBungeeCordIds() {
|
||||||
Path whitelistFile = plugin.getPluginFolder().resolve(FILE_NAME);
|
Path proxiesFile = plugin.getPluginFolder().resolve(FILE_NAME);
|
||||||
|
Path legacyFile = plugin.getPluginFolder().resolve(LEGACY_FILE_NAME);
|
||||||
try {
|
try {
|
||||||
if (Files.notExists(whitelistFile)) {
|
Path readFile = proxiesFile;
|
||||||
Files.createFile(whitelistFile);
|
if (Files.notExists(proxiesFile)) {
|
||||||
|
if (Files.exists(legacyFile)) {
|
||||||
|
readFile = legacyFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Files.notExists(legacyFile)) {
|
||||||
|
Files.createFile(proxiesFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Stream<String> lines = Files.lines(whitelistFile)) {
|
try (Stream<String> lines = Files.lines(readFile)) {
|
||||||
return lines.map(String::trim)
|
return lines.map(String::trim)
|
||||||
.map(UUID::fromString)
|
.map(UUID::fromString)
|
||||||
.collect(toSet());
|
.collect(toSet());
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
plugin.getLog().error("Failed to read proxy whitelist", ex);
|
plugin.getLog().error("Failed to read proxies", ex);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
plugin.getLog().error("Failed to retrieve proxy Id. Disabling BungeeCord support", ex);
|
plugin.getLog().error("Failed to retrieve proxy Id. Disabling BungeeCord support", ex);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* Let users activate fast login by command. This only be accessible if
|
* Let users activate fast login by command. This only be accessible if
|
||||||
* the user has access to it's account. So we can make sure that not another
|
* the user has access to it's account. So we can make sure that not another
|
||||||
* person with a paid account and the same username can steal his account.
|
* person with a paid account and the same username can steal their account.
|
||||||
*/
|
*/
|
||||||
public class PremiumCommand extends ToggleCommand {
|
public class PremiumCommand extends ToggleCommand {
|
||||||
|
|
||||||
|
@ -50,15 +50,15 @@ public class BungeeListener implements PluginMessageListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fail if target player is blacklisted because already authenticated or wrong bungeecord id
|
// fail if target player is blocked because already authenticated or wrong bungeecord id
|
||||||
if (targetPlayer.hasMetadata(plugin.getName())) {
|
if (targetPlayer.hasMetadata(plugin.getName())) {
|
||||||
plugin.getLog().warn("Received message {} from a blacklisted player {}", loginMessage, targetPlayer);
|
plugin.getLog().warn("Received message {} from a blocked player {}", loginMessage, targetPlayer);
|
||||||
} else {
|
} else {
|
||||||
UUID sourceId = loginMessage.getProxyId();
|
UUID sourceId = loginMessage.getProxyId();
|
||||||
if (plugin.getBungeeManager().isProxyAllowed(sourceId)) {
|
if (plugin.getBungeeManager().isProxyAllowed(sourceId)) {
|
||||||
readMessage(targetPlayer, loginMessage);
|
readMessage(targetPlayer, loginMessage);
|
||||||
} else {
|
} else {
|
||||||
plugin.getLog().warn("Received proxy id: {} that doesn't exist in the proxy whitelist file", sourceId);
|
plugin.getLog().warn("Received proxy id: {} that doesn't exist in the proxy file", sourceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public class ConnectionListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerLogin(PlayerLoginEvent loginEvent) {
|
public void onPlayerLogin(PlayerLoginEvent loginEvent) {
|
||||||
removeBlacklistStatus(loginEvent.getPlayer());
|
removeBlockedStatus(loginEvent.getPlayer());
|
||||||
if (loginEvent.getResult() == Result.ALLOWED && !plugin.isServerFullyStarted()) {
|
if (loginEvent.getResult() == Result.ALLOWED && !plugin.isServerFullyStarted()) {
|
||||||
loginEvent.disallow(Result.KICK_OTHER, plugin.getCore().getMessage("not-started"));
|
loginEvent.disallow(Result.KICK_OTHER, plugin.getCore().getMessage("not-started"));
|
||||||
}
|
}
|
||||||
@ -63,13 +63,13 @@ public class ConnectionListener implements Listener {
|
|||||||
public void onPlayerQuit(PlayerQuitEvent quitEvent) {
|
public void onPlayerQuit(PlayerQuitEvent quitEvent) {
|
||||||
Player player = quitEvent.getPlayer();
|
Player player = quitEvent.getPlayer();
|
||||||
|
|
||||||
removeBlacklistStatus(player);
|
removeBlockedStatus(player);
|
||||||
plugin.getCore().getPendingConfirms().remove(player.getUniqueId());
|
plugin.getCore().getPendingConfirms().remove(player.getUniqueId());
|
||||||
plugin.getPremiumPlayers().remove(player.getUniqueId());
|
plugin.getPremiumPlayers().remove(player.getUniqueId());
|
||||||
plugin.getBungeeManager().cleanup(player);
|
plugin.getBungeeManager().cleanup(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeBlacklistStatus(Player player) {
|
private void removeBlockedStatus(Player player) {
|
||||||
player.removeMetadata(plugin.getName(), plugin);
|
player.removeMetadata(plugin.getName(), plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ 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
|
// block 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));
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ commands:
|
|||||||
permission: ${project.artifactId}.command.premium
|
permission: ${project.artifactId}.command.premium
|
||||||
|
|
||||||
cracked:
|
cracked:
|
||||||
description: 'Label the invoker or the player specified as cracked if he was marked premium before'
|
description: 'Label the invoker or the player specified as cracked if marked premium before'
|
||||||
aliases: [unpremium]
|
aliases: [unpremium]
|
||||||
usage: /<command> [player]
|
usage: /<command> [player]
|
||||||
permission: ${project.artifactId}.command.cracked
|
permission: ${project.artifactId}.command.cracked
|
||||||
|
@ -47,7 +47,8 @@ secondAttemptCracked: false
|
|||||||
# New cracked players will be kicked from server. Good if you want switch from offline-mode to online-mode without
|
# New cracked players will be kicked from server. Good if you want switch from offline-mode to online-mode without
|
||||||
# losing players!
|
# losing players!
|
||||||
#
|
#
|
||||||
# Existing cracked and premium players could still join your server. Moreover you could add playernames to a whitelist.
|
# Existing cracked and premium players could still join your server. Moreover you could add playernames to a
|
||||||
|
# allowlist.
|
||||||
# So that these cracked players could join too although they are new players.
|
# So that these cracked players could join too although they are new players.
|
||||||
switchMode: false
|
switchMode: false
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
# ========= Shared (BungeeCord and Bukkit) ============
|
# ========= Shared (BungeeCord and Bukkit) ============
|
||||||
|
|
||||||
# Switch mode is activated and a new (non-whitelist) cracked player tries to join
|
# Switch mode is activated and a new cracked player tries to join, who is not namely allowed
|
||||||
switch-kick-message: '&4Only paid Minecraft whitelisted accounts are allowed to join this server'
|
switch-kick-message: '&4Only paid Minecraft allowed accounts are allowed to join this server'
|
||||||
|
|
||||||
# GameProfile activated premium login in order to skip offline authentication
|
# GameProfile activated premium login in order to skip offline authentication
|
||||||
add-premium: '&2Added to the list of premium players'
|
add-premium: '&2Added to the list of premium players'
|
||||||
|
Reference in New Issue
Block a user