mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-31 03:07:34 +02:00
Use path directly for loading the proxy uuid
This commit is contained in:
@ -152,12 +152,12 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadOrGenerateProxyId() {
|
private void loadOrGenerateProxyId() {
|
||||||
File idFile = new File(dataDirectory.toFile(), PROXY_ID_fILE);
|
Path idFile = dataDirectory.resolve(PROXY_ID_fILE);
|
||||||
boolean shouldGenerate = false;
|
boolean shouldGenerate = false;
|
||||||
|
|
||||||
if (idFile.exists()) {
|
if (Files.exists(idFile)) {
|
||||||
try {
|
try {
|
||||||
List<String> lines = Files.readAllLines(idFile.toPath(), StandardCharsets.UTF_8);
|
List<String> lines = Files.readAllLines(idFile, StandardCharsets.UTF_8);
|
||||||
if (lines.isEmpty()) {
|
if (lines.isEmpty()) {
|
||||||
shouldGenerate = true;
|
shouldGenerate = true;
|
||||||
} else {
|
} else {
|
||||||
@ -165,10 +165,10 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
|||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error("Unable to load proxy id from '{}'", idFile.getAbsolutePath());
|
logger.error("Unable to load proxy id from '{}'", idFile.toAbsolutePath());
|
||||||
logger.error("Detailed exception:", e);
|
logger.error("Detailed exception:", e);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
logger.error("'{}' contains an invalid uuid! FastLogin will not work without a valid id.", idFile.getAbsolutePath());
|
logger.error("'{}' contains an invalid uuid! FastLogin will not work without a valid id.", idFile.toAbsolutePath());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
shouldGenerate = true;
|
shouldGenerate = true;
|
||||||
@ -177,10 +177,10 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
|||||||
if (shouldGenerate) {
|
if (shouldGenerate) {
|
||||||
proxyId = UUID.randomUUID();
|
proxyId = UUID.randomUUID();
|
||||||
try {
|
try {
|
||||||
Files.write(idFile.toPath(), Collections.singletonList(proxyId.toString()),
|
Files.write(idFile, Collections.singletonList(proxyId.toString()),
|
||||||
StandardCharsets.UTF_8, StandardOpenOption.CREATE);
|
StandardCharsets.UTF_8, StandardOpenOption.CREATE);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("Unable to save proxy id to '{}'", idFile.getAbsolutePath());
|
logger.error("Unable to save proxy id to '{}'", idFile.toAbsolutePath());
|
||||||
logger.error("Detailed exception:", e);
|
logger.error("Detailed exception:", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user