mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-02-04 22:11:55 +01:00
Fix PlayerAuth constructor calls
This commit is contained in:
parent
4c2348e6e3
commit
e9f299fca8
@ -1,183 +1,183 @@
|
|||||||
package fr.xephi.authme.api;
|
package fr.xephi.authme.api;
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.Utils;
|
import fr.xephi.authme.Utils;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
public class API {
|
public class API {
|
||||||
|
|
||||||
public static final String newline = System.getProperty("line.separator");
|
public static final String newline = System.getProperty("line.separator");
|
||||||
public static AuthMe instance;
|
public static AuthMe instance;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public API(AuthMe instance) {
|
public API(AuthMe instance) {
|
||||||
API.instance = instance;
|
API.instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook into AuthMe
|
* Hook into AuthMe
|
||||||
*
|
*
|
||||||
* @return AuthMe instance
|
* @return AuthMe instance
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static AuthMe hookAuthMe() {
|
public static AuthMe hookAuthMe() {
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
return instance;
|
return instance;
|
||||||
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
|
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
|
||||||
if (plugin == null || !(plugin instanceof AuthMe)) {
|
if (plugin == null || !(plugin instanceof AuthMe)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
instance = (AuthMe) plugin;
|
instance = (AuthMe) plugin;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public AuthMe getPlugin() {
|
public AuthMe getPlugin() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return true if player is authenticate
|
* @return true if player is authenticate
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean isAuthenticated(Player player) {
|
public static boolean isAuthenticated(Player player) {
|
||||||
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return true if player is a npc
|
* @return true if player is a npc
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isaNPC(Player player) {
|
public boolean isaNPC(Player player) {
|
||||||
return Utils.isNPC(player);
|
return Utils.isNPC(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return true if player is a npc
|
* @return true if player is a npc
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isNPC(Player player) {
|
public boolean isNPC(Player player) {
|
||||||
return Utils.isNPC(player);
|
return Utils.isNPC(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return true if the player is unrestricted
|
* @return true if the player is unrestricted
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean isUnrestricted(Player player) {
|
public static boolean isUnrestricted(Player player) {
|
||||||
return Utils.isUnrestricted(player);
|
return Utils.isUnrestricted(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Location getLastLocation(Player player) {
|
public static Location getLastLocation(Player player) {
|
||||||
try {
|
try {
|
||||||
PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase());
|
PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase());
|
||||||
|
|
||||||
if (auth != null) {
|
if (auth != null) {
|
||||||
Location loc = new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ());
|
Location loc = new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ());
|
||||||
return loc;
|
return loc;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NullPointerException ex) {
|
} catch (NullPointerException ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setPlayerInventory(Player player, ItemStack[] content,
|
public static void setPlayerInventory(Player player, ItemStack[] content,
|
||||||
ItemStack[] armor) {
|
ItemStack[] armor) {
|
||||||
try {
|
try {
|
||||||
player.getInventory().setContents(content);
|
player.getInventory().setContents(content);
|
||||||
player.getInventory().setArmorContents(armor);
|
player.getInventory().setArmorContents(armor);
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param playerName
|
* @param playerName
|
||||||
* @return true if player is registered
|
* @return true if player is registered
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean isRegistered(String playerName) {
|
public static boolean isRegistered(String playerName) {
|
||||||
String player = playerName.toLowerCase();
|
String player = playerName.toLowerCase();
|
||||||
return instance.database.isAuthAvailable(player);
|
return instance.database.isAuthAvailable(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param String
|
* @param String
|
||||||
* playerName, String passwordToCheck
|
* playerName, String passwordToCheck
|
||||||
* @return true if the password is correct , false else
|
* @return true if the password is correct , false else
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean checkPassword(String playerName,
|
public static boolean checkPassword(String playerName,
|
||||||
String passwordToCheck) {
|
String passwordToCheck) {
|
||||||
if (!isRegistered(playerName))
|
if (!isRegistered(playerName))
|
||||||
return false;
|
return false;
|
||||||
String player = playerName.toLowerCase();
|
String player = playerName.toLowerCase();
|
||||||
PlayerAuth auth = instance.database.getAuth(player);
|
PlayerAuth auth = instance.database.getAuth(player);
|
||||||
try {
|
try {
|
||||||
return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName);
|
return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a player
|
* Register a player
|
||||||
*
|
*
|
||||||
* @param String
|
* @param String
|
||||||
* playerName, String password
|
* playerName, String password
|
||||||
* @return true if the player is register correctly
|
* @return true if the player is register correctly
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean registerPlayer(String playerName, String password) {
|
public static boolean registerPlayer(String playerName, String password) {
|
||||||
try {
|
try {
|
||||||
String name = playerName.toLowerCase();
|
String name = playerName.toLowerCase();
|
||||||
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||||
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;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force a player to login
|
* Force a player to login
|
||||||
*
|
*
|
||||||
* @param Player
|
* @param Player
|
||||||
* player
|
* player
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void forceLogin(Player player) {
|
public static void forceLogin(Player player) {
|
||||||
instance.management.performLogin(player, "dontneed", true);
|
instance.management.performLogin(player, "dontneed", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,153 +1,153 @@
|
|||||||
package fr.xephi.authme.api;
|
package fr.xephi.authme.api;
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.Utils;
|
import fr.xephi.authme.Utils;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.security.PasswordSecurity;
|
import fr.xephi.authme.security.PasswordSecurity;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
|
|
||||||
public class NewAPI {
|
public class NewAPI {
|
||||||
|
|
||||||
public static final String newline = System.getProperty("line.separator");
|
public static final String newline = System.getProperty("line.separator");
|
||||||
public static NewAPI singleton;
|
public static NewAPI singleton;
|
||||||
public AuthMe plugin;
|
public AuthMe plugin;
|
||||||
|
|
||||||
public NewAPI(AuthMe plugin) {
|
public NewAPI(AuthMe plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NewAPI(Server serv) {
|
public NewAPI(Server serv) {
|
||||||
this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe");
|
this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook into AuthMe
|
* Hook into AuthMe
|
||||||
*
|
*
|
||||||
* @return AuthMe plugin
|
* @return AuthMe plugin
|
||||||
*/
|
*/
|
||||||
public static NewAPI getInstance() {
|
public static NewAPI getInstance() {
|
||||||
if (singleton != null)
|
if (singleton != null)
|
||||||
return singleton;
|
return singleton;
|
||||||
Plugin p = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
|
Plugin p = Bukkit.getServer().getPluginManager().getPlugin("AuthMe");
|
||||||
if (p == null || !(p instanceof AuthMe)) {
|
if (p == null || !(p instanceof AuthMe)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
AuthMe authme = (AuthMe) p;
|
AuthMe authme = (AuthMe) p;
|
||||||
singleton = (new NewAPI(authme));
|
singleton = (new NewAPI(authme));
|
||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthMe getPlugin() {
|
public AuthMe getPlugin() {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return true if player is authenticate
|
* @return true if player is authenticate
|
||||||
*/
|
*/
|
||||||
public boolean isAuthenticated(Player player) {
|
public boolean isAuthenticated(Player player) {
|
||||||
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return true if player is a npc
|
* @return true if player is a npc
|
||||||
*/
|
*/
|
||||||
public boolean isNPC(Player player) {
|
public boolean isNPC(Player player) {
|
||||||
return Utils.isNPC(player);
|
return Utils.isNPC(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return true if the player is unrestricted
|
* @return true if the player is unrestricted
|
||||||
*/
|
*/
|
||||||
public boolean isUnrestricted(Player player) {
|
public boolean isUnrestricted(Player player) {
|
||||||
return Utils.isUnrestricted(player);
|
return Utils.isUnrestricted(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getLastLocation(Player player) {
|
public Location getLastLocation(Player player) {
|
||||||
try {
|
try {
|
||||||
PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase());
|
PlayerAuth auth = PlayerCache.getInstance().getAuth(player.getName().toLowerCase());
|
||||||
|
|
||||||
if (auth != null) {
|
if (auth != null) {
|
||||||
return new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ());
|
return new Location(Bukkit.getWorld(auth.getWorld()), auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ());
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NullPointerException ex) {
|
} catch (NullPointerException ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param playerName
|
* @param playerName
|
||||||
* @return true if player is registered
|
* @return true if player is registered
|
||||||
*/
|
*/
|
||||||
public boolean isRegistered(String playerName) {
|
public boolean isRegistered(String playerName) {
|
||||||
String player = playerName.toLowerCase();
|
String player = playerName.toLowerCase();
|
||||||
return plugin.database.isAuthAvailable(player);
|
return plugin.database.isAuthAvailable(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param String
|
* @param String
|
||||||
* playerName, String passwordToCheck
|
* playerName, String passwordToCheck
|
||||||
* @return true if the password is correct , false else
|
* @return true if the password is correct , false else
|
||||||
*/
|
*/
|
||||||
public boolean checkPassword(String playerName, String passwordToCheck) {
|
public boolean checkPassword(String playerName, String passwordToCheck) {
|
||||||
if (!isRegistered(playerName))
|
if (!isRegistered(playerName))
|
||||||
return false;
|
return false;
|
||||||
String player = playerName.toLowerCase();
|
String player = playerName.toLowerCase();
|
||||||
PlayerAuth auth = plugin.database.getAuth(player);
|
PlayerAuth auth = plugin.database.getAuth(player);
|
||||||
try {
|
try {
|
||||||
return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName);
|
return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a player
|
* Register a player
|
||||||
*
|
*
|
||||||
* @param String
|
* @param String
|
||||||
* playerName, String password
|
* playerName, String password
|
||||||
* @return true if the player is register correctly
|
* @return true if the player is register correctly
|
||||||
*/
|
*/
|
||||||
public boolean registerPlayer(String playerName, String password) {
|
public boolean registerPlayer(String playerName, String password) {
|
||||||
try {
|
try {
|
||||||
String name = playerName.toLowerCase();
|
String name = playerName.toLowerCase();
|
||||||
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, password, name);
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force a player to login
|
* Force a player to login
|
||||||
*
|
*
|
||||||
* @param Player
|
* @param Player
|
||||||
* player
|
* player
|
||||||
*/
|
*/
|
||||||
public void forceLogin(Player player) {
|
public void forceLogin(Player player) {
|
||||||
plugin.management.performLogin(player, "dontneed", true);
|
plugin.management.performLogin(player, "dontneed", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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));
|
||||||
|
@ -9,7 +9,7 @@ import javax.crypto.spec.SecretKeySpec;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Default PRF implementation based on standard javax.crypt.Mac mechanisms.
|
* Default PRF implementation based on standard javax.crypt.Mac mechanisms.
|
||||||
*
|
*
|
||||||
* <hr />
|
* <hr />
|
||||||
* <p>
|
* <p>
|
||||||
* A free Java implementation of Password Based Key Derivation Function 2 as
|
* A free Java implementation of Password Based Key Derivation Function 2 as
|
||||||
@ -37,7 +37,7 @@ import javax.crypto.spec.SecretKeySpec;
|
|||||||
* href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"
|
* href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"
|
||||||
* >http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html</a>.
|
* >http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html</a>.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Matthias Gärtner
|
* @author Matthias Gärtner
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
@ -51,7 +51,7 @@ public class MacBasedPRF implements PRF {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Mac-based Pseudo Random Function.
|
* Create Mac-based Pseudo Random Function.
|
||||||
*
|
*
|
||||||
* @param macAlgorithm
|
* @param macAlgorithm
|
||||||
* Mac algorithm to use, i.e. HMacSHA1 or HMacMD5.
|
* Mac algorithm to use, i.e. HMacSHA1 or HMacMD5.
|
||||||
*/
|
*/
|
||||||
@ -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