mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-29 18:27:36 +02:00
Check for valid file access first
This commit is contained in:
@ -106,15 +106,16 @@ public class BungeeManager {
|
||||
Path legacyFile = plugin.getPluginFolder().resolve(LEGACY_FILE_NAME);
|
||||
try {
|
||||
if (Files.notExists(proxiesFile)) {
|
||||
if (Files.notExists(legacyFile)) {
|
||||
Files.createFile(proxiesFile);
|
||||
}
|
||||
|
||||
if (Files.exists(legacyFile)) {
|
||||
Files.move(legacyFile, proxiesFile);
|
||||
}
|
||||
|
||||
if (Files.notExists(legacyFile)) {
|
||||
Files.createFile(proxiesFile);
|
||||
}
|
||||
}
|
||||
|
||||
Files.deleteIfExists(legacyFile);
|
||||
try (Stream<String> lines = Files.lines(proxiesFile)) {
|
||||
return lines.map(String::trim)
|
||||
.map(UUID::fromString)
|
||||
|
@ -85,7 +85,7 @@ public class EncryptionUtil {
|
||||
/**
|
||||
* Decrypts the content and extracts the key spec.
|
||||
*
|
||||
* @param privateKey decryption cipher initialized with the private key
|
||||
* @param cipher decryption cipher initialized with the private key
|
||||
* @param sharedKey the encrypted shared key
|
||||
* @return shared secret key
|
||||
* @throws GeneralSecurityException if it fails to decrypt the data
|
||||
|
@ -47,7 +47,7 @@ public class PluginMessageListener implements Listener {
|
||||
pluginMessageEvent.setCancelled(true);
|
||||
|
||||
if (!(pluginMessageEvent.getSender() instanceof Server)) {
|
||||
//check if the message is sent really from the server and not a malicious client
|
||||
//check if the message is sent from the server
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -242,9 +242,7 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
|
||||
Path dataFolder = plugin.getPluginFolder();
|
||||
|
||||
try {
|
||||
if (Files.notExists(dataFolder)) {
|
||||
Files.createDirectories(dataFolder);
|
||||
}
|
||||
Files.createDirectories(dataFolder);
|
||||
|
||||
Path configFile = dataFolder.resolve(fileName);
|
||||
if (Files.notExists(configFile)) {
|
||||
|
Reference in New Issue
Block a user