mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-28 19:47:35 +01:00
Update PlayerAuth builder class.
This commit is contained in:
parent
c196f45854
commit
7ba54123db
@ -3,6 +3,11 @@ package fr.xephi.authme.cache.auth;
|
||||
import fr.xephi.authme.security.HashAlgorithm;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
import static com.google.common.base.Objects.firstNonNull;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Strings.nullToEmpty;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public class PlayerAuth {
|
||||
@ -461,7 +466,7 @@ public class PlayerAuth {
|
||||
* @return String
|
||||
*/
|
||||
public String serialize() {
|
||||
StringBuilder str = new StringBuilder();
|
||||
StringBuffer str = new StringBuffer();
|
||||
char d = ';';
|
||||
str.append(this.nickname).append(d);
|
||||
str.append(this.realName).append(d);
|
||||
@ -503,34 +508,35 @@ public class PlayerAuth {
|
||||
|
||||
public static final class Builder {
|
||||
private String name;
|
||||
private String realName = "Player";
|
||||
private String hash = "";
|
||||
private String salt = "";
|
||||
private String ip = "127.0.0.1";
|
||||
private String world = "world";
|
||||
private String realName;
|
||||
private String hash;
|
||||
private String salt;
|
||||
private String ip;
|
||||
private String world;
|
||||
private String email;
|
||||
private int groupId = -1;
|
||||
private double x = 0.0f;
|
||||
private double y = 0.0f;
|
||||
private double z = 0.0f;
|
||||
private long lastLogin = System.currentTimeMillis();
|
||||
private int groupId = -1;
|
||||
private String email = "your@email.com";
|
||||
|
||||
public PlayerAuth build() {
|
||||
return new PlayerAuth(
|
||||
name,
|
||||
hash,
|
||||
salt,
|
||||
checkNotNull(name).toLowerCase(),
|
||||
nullToEmpty(hash),
|
||||
nullToEmpty(salt),
|
||||
groupId,
|
||||
ip,
|
||||
firstNonNull(ip, "127.0.0.1"),
|
||||
lastLogin,
|
||||
x, y, z, world,
|
||||
email,
|
||||
realName
|
||||
x, y, z,
|
||||
firstNonNull(world, "world"),
|
||||
firstNonNull(email, "your@email.com"),
|
||||
firstNonNull(realName, "Player")
|
||||
);
|
||||
}
|
||||
|
||||
public Builder name(String name) {
|
||||
this.name = name.toLowerCase();
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user