This commit is contained in:
yuhuihuang
2020-08-01 15:08:12 +08:00
parent 37c47fc2dc
commit 00b945f6e3
2 changed files with 10 additions and 10 deletions

View File

@@ -142,17 +142,18 @@ public class AuthlibInjectorAccount extends YggdrasilAccount {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!(obj instanceof AuthlibInjectorAccount)) if (obj == null || obj.getClass() != AuthlibInjectorAccount.class)
return false; return false;
AuthlibInjectorAccount another = (AuthlibInjectorAccount) obj; AuthlibInjectorAccount another = (AuthlibInjectorAccount) obj;
return super.equals(another) && server.equals(another.server); return characterUUID.equals(another.characterUUID) && server.equals(another.server);
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this) return new ToStringBuilder(this)
.append("uuid", characterUUID)
.append("username", getUsername()) .append("username", getUsername())
.append("server", getServer()) .append("server", getServer().getUrl())
.toString(); .toString();
} }
} }

View File

@@ -35,9 +35,9 @@ import static java.util.Objects.requireNonNull;
public class YggdrasilAccount extends Account { public class YggdrasilAccount extends Account {
private final YggdrasilService service; protected final YggdrasilService service;
private final UUID characterUUID; protected final UUID characterUUID;
private final String username; protected final String username;
private boolean authenticated = false; private boolean authenticated = false;
private YggdrasilSession session; private YggdrasilSession session;
@@ -174,9 +174,8 @@ public class YggdrasilAccount extends Account {
Map<Object, Object> storage = new HashMap<>(); Map<Object, Object> storage = new HashMap<>();
storage.put("username", username); storage.put("username", username);
storage.putAll(session.toStorage()); storage.putAll(session.toStorage());
service.getProfileRepository().getImmediately(characterUUID).ifPresent(profile -> { service.getProfileRepository().getImmediately(characterUUID).ifPresent(profile ->
storage.put("profileProperties", profile.getProperties()); storage.put("profileProperties", profile.getProperties()));
});
return storage; return storage;
} }
@@ -210,7 +209,7 @@ public class YggdrasilAccount extends Account {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!(obj instanceof YggdrasilAccount)) if (obj == null || obj.getClass() != YggdrasilAccount.class)
return false; return false;
YggdrasilAccount another = (YggdrasilAccount) obj; YggdrasilAccount another = (YggdrasilAccount) obj;
return characterUUID.equals(another.characterUUID); return characterUUID.equals(another.characterUUID);