commit
b7ede1458e
@ -23,9 +23,8 @@ public class PlayerAuth {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public PlayerAuth(String serialized)
|
public PlayerAuth(String serialized) {
|
||||||
{
|
this.deserialize(serialized);
|
||||||
this.unserialize(serialized);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,8 +162,10 @@ public class PlayerAuth {
|
|||||||
* @param email String
|
* @param email String
|
||||||
* @param realName String
|
* @param realName String
|
||||||
*/
|
*/
|
||||||
public PlayerAuth(String nickname, String hash, String salt, int groupId, String ip, long lastLogin, double x, double y, double z, String world, String email, String realName) {
|
public PlayerAuth(String nickname, String hash, String salt, int groupId, String ip,
|
||||||
this.nickname = nickname;
|
long lastLogin, double x, double y, double z, String world, String email,
|
||||||
|
String realName) {
|
||||||
|
this.nickname = nickname.toLowerCase();
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
this.lastLogin = lastLogin;
|
this.lastLogin = lastLogin;
|
||||||
@ -203,7 +204,7 @@ public class PlayerAuth {
|
|||||||
* @param nickname String
|
* @param nickname String
|
||||||
*/
|
*/
|
||||||
public void setName(String nickname) {
|
public void setName(String nickname) {
|
||||||
this.nickname = nickname;
|
this.nickname = nickname.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -455,46 +456,137 @@ public class PlayerAuth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to serialize playerauth
|
* Method to serialize PlayerAuth
|
||||||
*
|
*
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String serialize()
|
public String serialize() {
|
||||||
{
|
StringBuilder str = new StringBuilder();
|
||||||
StringBuilder str = new StringBuilder();
|
char d = ';';
|
||||||
str.append(this.nickname).append(';');
|
str.append(this.nickname).append(d);
|
||||||
str.append(this.realName).append(';');
|
str.append(this.realName).append(d);
|
||||||
str.append(this.ip).append(';');
|
str.append(this.ip).append(d);
|
||||||
str.append(this.email).append(';');
|
str.append(this.email).append(d);
|
||||||
str.append(this.hash).append(';');
|
str.append(this.hash).append(d);
|
||||||
str.append(this.salt).append(';');
|
str.append(this.salt).append(d);
|
||||||
str.append(this.groupId).append(';');
|
str.append(this.groupId).append(d);
|
||||||
str.append(this.lastLogin).append(';');
|
str.append(this.lastLogin).append(d);
|
||||||
str.append(this.world).append(';');
|
str.append(this.world).append(d);
|
||||||
str.append(this.x).append(';');
|
str.append(this.x).append(d);
|
||||||
str.append(this.y).append(';');
|
str.append(this.y).append(d);
|
||||||
str.append(this.z);
|
str.append(this.z);
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to unserialize playerauth
|
* Method to deserialize PlayerAuth
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public void unserialize(String str)
|
public void deserialize(String str) {
|
||||||
{
|
String[] args = str.split(";");
|
||||||
String[] args = str.split(";");
|
this.nickname = args[0];
|
||||||
this.nickname = args[0];
|
this.realName = args[1];
|
||||||
this.realName = args[1];
|
this.ip = args[2];
|
||||||
this.ip = args[2];
|
this.email = args[3];
|
||||||
this.email = args[3];
|
this.hash = args[4];
|
||||||
this.hash = args[4];
|
this.salt = args[5];
|
||||||
this.salt = args[5];
|
this.groupId = Integer.parseInt(args[6]);
|
||||||
this.groupId = Integer.parseInt(args[6]);
|
this.lastLogin = Long.parseLong(args[7]);
|
||||||
this.lastLogin = Long.parseLong(args[7]);
|
this.world = args[8];
|
||||||
this.world = args[8];
|
this.x = Double.parseDouble(args[9]);
|
||||||
this.x = Double.parseDouble(args[9]);
|
this.y = Double.parseDouble(args[10]);
|
||||||
this.y = Double.parseDouble(args[10]);
|
this.z = Double.parseDouble(args[11]);
|
||||||
this.z = Double.parseDouble(args[11]);
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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,
|
||||||
|
groupId,
|
||||||
|
ip,
|
||||||
|
lastLogin,
|
||||||
|
x, y, z, world,
|
||||||
|
email,
|
||||||
|
realName
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder realName(String realName) {
|
||||||
|
this.realName = realName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder hash(String hash) {
|
||||||
|
this.hash = hash;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder salt(String salt) {
|
||||||
|
this.salt = salt;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder ip(String ip) {
|
||||||
|
this.ip = ip;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder locWorld(String world) {
|
||||||
|
this.world = world;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder locX(double x) {
|
||||||
|
this.x = x;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder locY(double y) {
|
||||||
|
this.y = y;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder locZ(double z) {
|
||||||
|
this.z = z;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder lastLogin(long lastLogin) {
|
||||||
|
this.lastLogin = lastLogin;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder groupId(int groupId) {
|
||||||
|
this.groupId = groupId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder email(String email) {
|
||||||
|
this.email = email;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -68,7 +68,7 @@ public final class Settings extends YamlConfiguration {
|
|||||||
enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
|
enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
|
||||||
broadcastWelcomeMessage, forceRegKick, forceRegLogin,
|
broadcastWelcomeMessage, forceRegKick, forceRegLogin,
|
||||||
checkVeryGames, delayJoinLeaveMessages, noTeleport, applyBlindEffect,
|
checkVeryGames, delayJoinLeaveMessages, noTeleport, applyBlindEffect,
|
||||||
customAttributes, generateImage, isRemoveSpeedEnabled, isMySQLWebsite;
|
customAttributes, generateImage, isRemoveSpeedEnabled;
|
||||||
public static String helpHeader, getNickRegex, getUnloggedinGroup, getMySQLHost,
|
public static String helpHeader, getNickRegex, getUnloggedinGroup, getMySQLHost,
|
||||||
getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase,
|
getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase,
|
||||||
getMySQLTablename, getMySQLColumnName, getMySQLColumnPassword,
|
getMySQLTablename, getMySQLColumnName, getMySQLColumnPassword,
|
||||||
@ -284,7 +284,6 @@ public final class Settings extends YamlConfiguration {
|
|||||||
forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole");
|
forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole");
|
||||||
customAttributes = configFile.getBoolean("Hooks.customAttributes");
|
customAttributes = configFile.getBoolean("Hooks.customAttributes");
|
||||||
generateImage = configFile.getBoolean("Email.generateImage", false);
|
generateImage = configFile.getBoolean("Email.generateImage", false);
|
||||||
isMySQLWebsite = configFile.getBoolean("DataSource.mySQLWebsite", false);
|
|
||||||
|
|
||||||
// Load the welcome message
|
// Load the welcome message
|
||||||
getWelcomeMessage();
|
getWelcomeMessage();
|
||||||
@ -676,10 +675,6 @@ public final class Settings extends YamlConfiguration {
|
|||||||
set("DataSource.mySQLRealName", "realname");
|
set("DataSource.mySQLRealName", "realname");
|
||||||
changes = true;
|
changes = true;
|
||||||
}
|
}
|
||||||
if (!contains("DataSource.mySQLQueryCache")) {
|
|
||||||
set("DataSource.mySQLWebsite", false);
|
|
||||||
changes = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changes) {
|
if (changes) {
|
||||||
plugin.getLogger().warning("Merged new Config Options - I'm not an error, please don't report me");
|
plugin.getLogger().warning("Merged new Config Options - I'm not an error, please don't report me");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user