Removed static login method

This commit is contained in:
huanghongxun
2018-10-08 21:23:01 +08:00
parent 0eb81c29df
commit daf659373f
5 changed files with 19 additions and 49 deletions

View File

@@ -47,7 +47,7 @@ public class AuthlibInjectorAccount extends YggdrasilAccount {
}
@Override
public AuthInfo logIn() throws AuthenticationException {
public synchronized AuthInfo logIn() throws AuthenticationException {
return inject(super::logIn);
}

View File

@@ -64,7 +64,7 @@ public class YggdrasilAccount extends Account {
}
@Override
public AuthInfo logIn() throws AuthenticationException {
public synchronized AuthInfo logIn() throws AuthenticationException {
if (!canPlayOnline()) {
if (service.validate(session.getAccessToken(), session.getClientToken())) {
isOnline = true;
@@ -84,7 +84,7 @@ public class YggdrasilAccount extends Account {
}
@Override
public AuthInfo logInWithPassword(String password) throws AuthenticationException {
public synchronized AuthInfo logInWithPassword(String password) throws AuthenticationException {
return logInWithPassword(password, new SpecificCharacterSelector(characterUUID));
}

View File

@@ -62,7 +62,7 @@ public class CacheRepository {
public void tryCacheFile(Path path, String algorithm, String hash) throws IOException {
Path cache = getFile(algorithm, hash);
if (Files.exists(cache)) return;
if (Files.isRegularFile(cache)) return;
FileUtils.copyFile(path.toFile(), cache.toFile());
}