mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-28 05:05:14 +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.security.HashAlgorithm;
|
||||||
import fr.xephi.authme.settings.Settings;
|
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 {
|
public class PlayerAuth {
|
||||||
@ -461,7 +466,7 @@ public class PlayerAuth {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String serialize() {
|
public String serialize() {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuffer str = new StringBuffer();
|
||||||
char d = ';';
|
char d = ';';
|
||||||
str.append(this.nickname).append(d);
|
str.append(this.nickname).append(d);
|
||||||
str.append(this.realName).append(d);
|
str.append(this.realName).append(d);
|
||||||
@ -503,34 +508,35 @@ public class PlayerAuth {
|
|||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private String name;
|
private String name;
|
||||||
private String realName = "Player";
|
private String realName;
|
||||||
private String hash = "";
|
private String hash;
|
||||||
private String salt = "";
|
private String salt;
|
||||||
private String ip = "127.0.0.1";
|
private String ip;
|
||||||
private String world = "world";
|
private String world;
|
||||||
|
private String email;
|
||||||
|
private int groupId = -1;
|
||||||
private double x = 0.0f;
|
private double x = 0.0f;
|
||||||
private double y = 0.0f;
|
private double y = 0.0f;
|
||||||
private double z = 0.0f;
|
private double z = 0.0f;
|
||||||
private long lastLogin = System.currentTimeMillis();
|
private long lastLogin = System.currentTimeMillis();
|
||||||
private int groupId = -1;
|
|
||||||
private String email = "your@email.com";
|
|
||||||
|
|
||||||
public PlayerAuth build() {
|
public PlayerAuth build() {
|
||||||
return new PlayerAuth(
|
return new PlayerAuth(
|
||||||
name,
|
checkNotNull(name).toLowerCase(),
|
||||||
hash,
|
nullToEmpty(hash),
|
||||||
salt,
|
nullToEmpty(salt),
|
||||||
groupId,
|
groupId,
|
||||||
ip,
|
firstNonNull(ip, "127.0.0.1"),
|
||||||
lastLogin,
|
lastLogin,
|
||||||
x, y, z, world,
|
x, y, z,
|
||||||
email,
|
firstNonNull(world, "world"),
|
||||||
realName
|
firstNonNull(email, "your@email.com"),
|
||||||
|
firstNonNull(realName, "Player")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder name(String name) {
|
public Builder name(String name) {
|
||||||
this.name = name.toLowerCase();
|
this.name = name;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user