Check for valid file access first

This commit is contained in:
games647
2021-02-14 17:06:44 +01:00
parent a15de80c7d
commit 303c064416
4 changed files with 8 additions and 9 deletions

View File

@ -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)

View File

@ -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

View File

@ -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;
}

View File

@ -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)) {