mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-02-10 00:41:39 +01:00
Fix PlayerAuth constructor calls
This commit is contained in:
parent
4c2348e6e3
commit
e9f299fca8
@ -159,7 +159,7 @@ public class API {
|
|||||||
if (isRegistered(name)) {
|
if (isRegistered(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com");
|
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com", playerName);
|
||||||
if (!instance.database.saveAuth(auth)) {
|
if (!instance.database.saveAuth(auth)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ public class NewAPI {
|
|||||||
if (isRegistered(name)) {
|
if (isRegistered(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com");
|
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com", playerName);
|
||||||
return plugin.database.saveAuth(auth);
|
return plugin.database.saveAuth(auth);
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -260,7 +260,7 @@ public class AdminCommand implements CommandExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, lowpass, name);
|
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, lowpass, name);
|
||||||
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com");
|
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com", name);
|
||||||
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null)
|
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null)
|
||||||
auth.setSalt(PasswordSecurity.userSalt.get(name));
|
auth.setSalt(PasswordSecurity.userSalt.get(name));
|
||||||
else auth.setSalt("");
|
else auth.setSalt("");
|
||||||
|
@ -173,12 +173,9 @@ public class EmailCommand implements CommandExecutor {
|
|||||||
plugin.database.updatePassword(auth);
|
plugin.database.updatePassword(auth);
|
||||||
plugin.mail.main(auth, thePass);
|
plugin.mail.main(auth, thePass);
|
||||||
m.send(player, "email_send");
|
m.send(player, "email_send");
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
} catch (NoSuchAlgorithmException | NoClassDefFoundError ex) {
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
m.send(sender, "error");
|
m.send(sender, "error");
|
||||||
} catch (NoClassDefFoundError ncdfe) {
|
|
||||||
ConsoleLogger.showError(ncdfe.getMessage());
|
|
||||||
m.send(sender, "error");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m.send(player, "reg_email_msg");
|
m.send(player, "reg_email_msg");
|
||||||
|
@ -49,10 +49,10 @@ public class CrazyLoginConverter implements Converter {
|
|||||||
continue;
|
continue;
|
||||||
if (args[0].equalsIgnoreCase("name"))
|
if (args[0].equalsIgnoreCase("name"))
|
||||||
continue;
|
continue;
|
||||||
String player = args[0].toLowerCase();
|
String playerName = args[0].toLowerCase();
|
||||||
String psw = args[1];
|
String psw = args[1];
|
||||||
if (psw != null) {
|
if (psw != null) {
|
||||||
PlayerAuth auth = new PlayerAuth(player, psw, "127.0.0.1", System.currentTimeMillis(), player);
|
PlayerAuth auth = new PlayerAuth(playerName, psw, "127.0.0.1", System.currentTimeMillis(), playerName);
|
||||||
database.saveAuth(auth);
|
database.saveAuth(auth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,17 +74,17 @@ public class RakamakConverter implements Converter {
|
|||||||
}
|
}
|
||||||
users.close();
|
users.close();
|
||||||
for (Entry<String, String> m : playerPSW.entrySet()) {
|
for (Entry<String, String> m : playerPSW.entrySet()) {
|
||||||
String player = m.getKey();
|
String playerName = m.getKey();
|
||||||
String psw = playerPSW.get(player);
|
String psw = playerPSW.get(playerName);
|
||||||
String ip;
|
String ip;
|
||||||
if (useIP) {
|
if (useIP) {
|
||||||
ip = playerIP.get(player);
|
ip = playerIP.get(playerName);
|
||||||
} else {
|
} else {
|
||||||
ip = "127.0.0.1";
|
ip = "127.0.0.1";
|
||||||
}
|
}
|
||||||
PlayerAuth auth = new PlayerAuth(player, psw, ip, System.currentTimeMillis(), player);
|
PlayerAuth auth = new PlayerAuth(playerName, psw, ip, System.currentTimeMillis(), playerName);
|
||||||
if (PasswordSecurity.userSalt.containsKey(player))
|
if (PasswordSecurity.userSalt.containsKey(playerName))
|
||||||
auth.setSalt(PasswordSecurity.userSalt.get(player));
|
auth.setSalt(PasswordSecurity.userSalt.get(playerName));
|
||||||
database.saveAuth(auth);
|
database.saveAuth(auth);
|
||||||
}
|
}
|
||||||
ConsoleLogger.info("Rakamak database has been imported correctly");
|
ConsoleLogger.info("Rakamak database has been imported correctly");
|
||||||
|
@ -30,7 +30,7 @@ public class RoyalAuthConverter implements Converter {
|
|||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
continue;
|
continue;
|
||||||
RoyalAuthYamlReader ra = new RoyalAuthYamlReader(file);
|
RoyalAuthYamlReader ra = new RoyalAuthYamlReader(file);
|
||||||
PlayerAuth auth = new PlayerAuth(name, ra.getHash(), "127.0.0.1", ra.getLastLogin(), "your@email.com");
|
PlayerAuth auth = new PlayerAuth(name, ra.getHash(), "127.0.0.1", ra.getLastLogin(), "your@email.com", o.getName());
|
||||||
data.saveAuth(auth);
|
data.saveAuth(auth);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ConsoleLogger.writeStackTrace(e);
|
ConsoleLogger.writeStackTrace(e);
|
||||||
|
@ -44,9 +44,9 @@ public class vAuthFileReader {
|
|||||||
}
|
}
|
||||||
if (pname == null)
|
if (pname == null)
|
||||||
continue;
|
continue;
|
||||||
auth = new PlayerAuth(pname.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com");
|
auth = new PlayerAuth(pname.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", pname);
|
||||||
} else {
|
} else {
|
||||||
auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com");
|
auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", name);
|
||||||
}
|
}
|
||||||
database.saveAuth(auth);
|
database.saveAuth(auth);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class xAuthToFlat {
|
|||||||
String pl = getIdPlayer(id);
|
String pl = getIdPlayer(id);
|
||||||
String psw = getPassword(id);
|
String psw = getPassword(id);
|
||||||
if (psw != null && !psw.isEmpty() && pl != null) {
|
if (psw != null && !psw.isEmpty() && pl != null) {
|
||||||
PlayerAuth auth = new PlayerAuth(pl, psw, "192.168.0.1", 0, "your@email.com");
|
PlayerAuth auth = new PlayerAuth(pl, psw, "192.168.0.1", 0, "your@email.com", pl);
|
||||||
database.saveAuth(auth);
|
database.saveAuth(auth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ public class FlatFile implements DataSource {
|
|||||||
public int purgeDatabase(long until) {
|
public int purgeDatabase(long until) {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
BufferedWriter bw = null;
|
BufferedWriter bw = null;
|
||||||
ArrayList<String> lines = new ArrayList<String>();
|
ArrayList<String> lines = new ArrayList<>();
|
||||||
int cleared = 0;
|
int cleared = 0;
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new FileReader(source));
|
br = new BufferedReader(new FileReader(source));
|
||||||
@ -330,8 +330,8 @@ public class FlatFile implements DataSource {
|
|||||||
public List<String> autoPurgeDatabase(long until) {
|
public List<String> autoPurgeDatabase(long until) {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
BufferedWriter bw = null;
|
BufferedWriter bw = null;
|
||||||
ArrayList<String> lines = new ArrayList<String>();
|
ArrayList<String> lines = new ArrayList<>();
|
||||||
List<String> cleared = new ArrayList<String>();
|
List<String> cleared = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new FileReader(source));
|
br = new BufferedReader(new FileReader(source));
|
||||||
String line;
|
String line;
|
||||||
@ -379,7 +379,7 @@ public class FlatFile implements DataSource {
|
|||||||
}
|
}
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
BufferedWriter bw = null;
|
BufferedWriter bw = null;
|
||||||
ArrayList<String> lines = new ArrayList<String>();
|
ArrayList<String> lines = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new FileReader(source));
|
br = new BufferedReader(new FileReader(source));
|
||||||
String line;
|
String line;
|
||||||
@ -512,7 +512,7 @@ public class FlatFile implements DataSource {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getAllAuthsByName(PlayerAuth auth) {
|
public List<String> getAllAuthsByName(PlayerAuth auth) {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
List<String> countIp = new ArrayList<String>();
|
List<String> countIp = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new FileReader(source));
|
br = new BufferedReader(new FileReader(source));
|
||||||
String line;
|
String line;
|
||||||
@ -525,10 +525,10 @@ public class FlatFile implements DataSource {
|
|||||||
return countIp;
|
return countIp;
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
return new ArrayList<String>();
|
return new ArrayList<>();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
return new ArrayList<String>();
|
return new ArrayList<>();
|
||||||
} finally {
|
} finally {
|
||||||
if (br != null) {
|
if (br != null) {
|
||||||
try {
|
try {
|
||||||
@ -542,7 +542,7 @@ public class FlatFile implements DataSource {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getAllAuthsByIp(String ip) {
|
public List<String> getAllAuthsByIp(String ip) {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
List<String> countIp = new ArrayList<String>();
|
List<String> countIp = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new FileReader(source));
|
br = new BufferedReader(new FileReader(source));
|
||||||
String line;
|
String line;
|
||||||
@ -555,10 +555,10 @@ public class FlatFile implements DataSource {
|
|||||||
return countIp;
|
return countIp;
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
return new ArrayList<String>();
|
return new ArrayList<>();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
return new ArrayList<String>();
|
return new ArrayList<>();
|
||||||
} finally {
|
} finally {
|
||||||
if (br != null) {
|
if (br != null) {
|
||||||
try {
|
try {
|
||||||
@ -572,7 +572,7 @@ public class FlatFile implements DataSource {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getAllAuthsByEmail(String email) {
|
public List<String> getAllAuthsByEmail(String email) {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
List<String> countEmail = new ArrayList<String>();
|
List<String> countEmail = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new FileReader(source));
|
br = new BufferedReader(new FileReader(source));
|
||||||
String line;
|
String line;
|
||||||
@ -585,10 +585,10 @@ public class FlatFile implements DataSource {
|
|||||||
return countEmail;
|
return countEmail;
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
return new ArrayList<String>();
|
return new ArrayList<>();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ConsoleLogger.showError(ex.getMessage());
|
ConsoleLogger.showError(ex.getMessage());
|
||||||
return new ArrayList<String>();
|
return new ArrayList<>();
|
||||||
} finally {
|
} finally {
|
||||||
if (br != null) {
|
if (br != null) {
|
||||||
try {
|
try {
|
||||||
@ -603,7 +603,7 @@ public class FlatFile implements DataSource {
|
|||||||
public void purgeBanned(List<String> banned) {
|
public void purgeBanned(List<String> banned) {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
BufferedWriter bw = null;
|
BufferedWriter bw = null;
|
||||||
ArrayList<String> lines = new ArrayList<String>();
|
ArrayList<String> lines = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new FileReader(source));
|
br = new BufferedReader(new FileReader(source));
|
||||||
String line;
|
String line;
|
||||||
@ -613,8 +613,7 @@ public class FlatFile implements DataSource {
|
|||||||
if (banned.contains(args[0])) {
|
if (banned.contains(args[0])) {
|
||||||
lines.add(line);
|
lines.add(line);
|
||||||
}
|
}
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException | ArrayIndexOutOfBoundsException exc) {
|
||||||
} catch (ArrayIndexOutOfBoundsException aioobe) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bw = new BufferedWriter(new FileWriter(source));
|
bw = new BufferedWriter(new FileWriter(source));
|
||||||
@ -700,7 +699,7 @@ public class FlatFile implements DataSource {
|
|||||||
@Override
|
@Override
|
||||||
public List<PlayerAuth> getAllAuths() {
|
public List<PlayerAuth> getAllAuths() {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
List<PlayerAuth> auths = new ArrayList<PlayerAuth>();
|
List<PlayerAuth> auths = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
br = new BufferedReader(new FileReader(source));
|
br = new BufferedReader(new FileReader(source));
|
||||||
String line;
|
String line;
|
||||||
@ -746,6 +745,6 @@ public class FlatFile implements DataSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlayerAuth> getLoggedPlayers() {
|
public List<PlayerAuth> getLoggedPlayers() {
|
||||||
return new ArrayList<PlayerAuth>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,7 @@ public class EssSpawn extends CustomConfiguration {
|
|||||||
return null;
|
return null;
|
||||||
Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch")));
|
Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch")));
|
||||||
return location;
|
return location;
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException | NumberFormatException npe) {
|
||||||
return null;
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ public class PHPFUSION implements EncryptionMethod {
|
|||||||
hash.append(hex);
|
hash.append(hex);
|
||||||
}
|
}
|
||||||
digest = hash.toString();
|
digest = hash.toString();
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) {
|
||||||
} catch (InvalidKeyException e) {
|
//ingore
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return digest;
|
return digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class XF implements EncryptionMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String regmatch(String pattern, String line) {
|
public String regmatch(String pattern, String line) {
|
||||||
List<String> allMatches = new ArrayList<String>();
|
List<String> allMatches = new ArrayList<>();
|
||||||
Matcher m = Pattern.compile(pattern).matcher(line);
|
Matcher m = Pattern.compile(pattern).matcher(line);
|
||||||
while (m.find()) {
|
while (m.find()) {
|
||||||
allMatches.add(m.group(1));
|
allMatches.add(m.group(1));
|
||||||
|
@ -70,9 +70,7 @@ public class MacBasedPRF implements PRF {
|
|||||||
try {
|
try {
|
||||||
mac = Mac.getInstance(macAlgorithm, provider);
|
mac = Mac.getInstance(macAlgorithm, provider);
|
||||||
hLen = mac.getMacLength();
|
hLen = mac.getMacLength();
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException | NoSuchProviderException e) {
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (NoSuchProviderException e) {
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ public class OtherAccounts extends CustomConfiguration {
|
|||||||
this.getStringList(uuid.toString()).add(player.getName());
|
this.getStringList(uuid.toString()).add(player.getName());
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodError e) {
|
} catch (NoSuchMethodError | Exception e) {
|
||||||
} catch (Exception e) {
|
//ingore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,10 +58,9 @@ public class OtherAccounts extends CustomConfiguration {
|
|||||||
this.getStringList(uuid.toString()).remove(player.getName());
|
this.getStringList(uuid.toString()).remove(player.getName());
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
} catch (NoSuchMethodError e) {
|
} catch (NoSuchMethodError | Exception e) {
|
||||||
} catch (Exception e) {
|
//ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getAllPlayersByUUID(UUID uuid) {
|
public List<String> getAllPlayersByUUID(UUID uuid) {
|
||||||
|
@ -90,9 +90,7 @@ public class Spawn extends CustomConfiguration {
|
|||||||
return null;
|
return null;
|
||||||
Location location = new Location(Bukkit.getWorld(this.getString("spawn.world")), this.getDouble("spawn.x"), this.getDouble("spawn.y"), this.getDouble("spawn.z"), Float.parseFloat(this.getString("spawn.yaw")), Float.parseFloat(this.getString("spawn.pitch")));
|
Location location = new Location(Bukkit.getWorld(this.getString("spawn.world")), this.getDouble("spawn.x"), this.getDouble("spawn.y"), this.getDouble("spawn.z"), Float.parseFloat(this.getString("spawn.yaw")), Float.parseFloat(this.getString("spawn.pitch")));
|
||||||
return location;
|
return location;
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException | NumberFormatException npe) {
|
||||||
return null;
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,9 +101,7 @@ public class Spawn extends CustomConfiguration {
|
|||||||
return null;
|
return null;
|
||||||
Location location = new Location(Bukkit.getWorld(this.getString("firstspawn.world")), this.getDouble("firstspawn.x"), this.getDouble("firstspawn.y"), this.getDouble("firstspawn.z"), Float.parseFloat(this.getString("firstspawn.yaw")), Float.parseFloat(this.getString("firstspawn.pitch")));
|
Location location = new Location(Bukkit.getWorld(this.getString("firstspawn.world")), this.getDouble("firstspawn.x"), this.getDouble("firstspawn.y"), this.getDouble("firstspawn.z"), Float.parseFloat(this.getString("firstspawn.yaw")), Float.parseFloat(this.getString("firstspawn.pitch")));
|
||||||
return location;
|
return location;
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException | NumberFormatException npe) {
|
||||||
return null;
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user