AuthMe 3.0

//Changes 3.0://
* Repackaging from uk.org.whoami.authme to fr.xephi.authme, please
developpers, update!
* Rewrite some of parts of the plugin
* Some code was already perfect , also did not change it :p
* Full support for phpbb3
* Add full support for WordPress + passwordHash: WORDPRESS
* Completely rewrite Management system for inventories and tp issues,
Thanks to : [[http://dev.bukkit.org/profiles/Possible/|Possible]]
* Rework on /passpartu command
* Completely rewrite the password encryption method
* Add a way for developers to add their own Password Encryption Method
on AuthMe via event way (please see
fr.xephi.authme.events.PasswordEncryptionEvent)
* Add an auto purge with players.dat removing method and essentials
files removing ( if you want authme to hook with an another plugin let
me know )
* Complete Hook with BungeeCord by removing the /server command before
login
* message_lang.yml will never be overwritten with English Strings , but
correctly update the message_lang.yml when needed to
* Fix a lot of issues mentioned in tickets , commants , or by mp, Thanks
for all your reports!
This commit is contained in:
Xephi
2013-10-17 05:14:46 +02:00
parent e6467eccf2
commit 10b4eaeca7
112 changed files with 3142 additions and 2640 deletions
+216
View File
@@ -0,0 +1,216 @@
package fr.xephi.authme.cache.auth;
import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.settings.Settings;
public class PlayerAuth {
private String nickname;
private String hash;
private String ip = "198.18.0.1";
private long lastLogin;
private int x = 0;
private int y = 0;
private int z = 0;
private String world = "world";
private String salt = "";
private String vBhash = null;
private int groupId;
private String email = "your@email.com";
public PlayerAuth(String nickname, String hash, String ip, long lastLogin) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
}
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, String email) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.email = email;
}
public PlayerAuth(String nickname, int x, int y, int z, String world) {
this.nickname = nickname;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
}
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, int x, int y, int z, String world, String email) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
this.email = email;
}
public PlayerAuth(String nickname, String hash, String salt, int groupId, String ip, long lastLogin, int x, int y, int z, String world, String email) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
this.salt = salt;
this.groupId = groupId;
this.email = email;
}
public PlayerAuth(String nickname, String hash, String salt, int groupId , String ip, long lastLogin) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.salt = salt;
this.groupId = groupId;
}
public PlayerAuth(String nickname, String hash, String salt, String ip, long lastLogin) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.salt = salt;
}
public PlayerAuth(String nickname, String hash, String salt, String ip, long lastLogin, int x, int y, int z, String world, String email) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
this.salt = salt;
this.email = email;
}
public PlayerAuth(String nickname, String hash, String ip, long lastLogin, int x, int y, int z, String world) {
this.nickname = nickname;
this.hash = hash;
this.ip = ip;
this.lastLogin = lastLogin;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
this.email = "your@email.com";
}
public String getIp() {
return ip;
}
public String getNickname() {
return nickname;
}
public String getHash() {
if(!salt.isEmpty() && Settings.getPasswordHash == HashAlgorithm.MD5VB) {
vBhash = "$MD5vb$"+salt+"$"+hash;
return vBhash;
}
else {
return hash;
}
}
public String getSalt() {
return this.salt;
}
public int getGroupId() {
return groupId;
}
public int getQuitLocX() {
return x;
}
public int getQuitLocY() {
return y;
}
public int getQuitLocZ() {
return z;
}
public String getEmail() {
return email;
}
public void setQuitLocX(int x) {
this.x = x;
}
public void setQuitLocY(int y) {
this.y = y;
}
public void setQuitLocZ(int z) {
this.z = z;
}
public long getLastLogin() {
return lastLogin;
}
public void setHash(String hash) {
this.hash = hash;
}
public void setIp(String ip) {
this.ip = ip;
}
public void setLastLogin(long lastLogin) {
this.lastLogin = lastLogin;
}
public void setEmail(String email) {
this.email = email;
}
public void setSalt(String salt) {
this.salt = salt;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof PlayerAuth)) {
return false;
}
PlayerAuth other = (PlayerAuth) obj;
return other.getIp().equals(this.ip) && other.getNickname().equals(this.nickname);
}
@Override
public int hashCode() {
int hashCode = 7;
hashCode = 71 * hashCode + (this.nickname != null ? this.nickname.hashCode() : 0);
hashCode = 71 * hashCode + (this.ip != null ? this.ip.hashCode() : 0);
return hashCode;
}
public void setWorld(String world) {
this.world = world;
}
public String getWorld() {
return world;
}
@Override
public String toString() {
String s = "Player : " + nickname + " ! IP : " + ip + " ! LastLogin : " + lastLogin + " ! LastPosition : " + x + "," + y + "," + z + "," + world
+ " ! Email : " + email + " ! Hash : " + hash + " ! Salt : " + salt;
return s;
}
}
@@ -0,0 +1,42 @@
package fr.xephi.authme.cache.auth;
import java.util.HashMap;
public class PlayerCache {
private static PlayerCache singleton = null;
private HashMap<String, PlayerAuth> cache;
private PlayerCache() {
cache = new HashMap<String, PlayerAuth>();
}
public void addPlayer(PlayerAuth auth) {
cache.put(auth.getNickname().toLowerCase(), auth);
}
public void updatePlayer(PlayerAuth auth) {
cache.remove(auth.getNickname().toLowerCase());
cache.put(auth.getNickname().toLowerCase(), auth);
}
public void removePlayer(String user) {
cache.remove(user.toLowerCase());
}
public boolean isAuthenticated(String user) {
return cache.containsKey(user.toLowerCase());
}
public PlayerAuth getAuth(String user) {
return cache.get(user.toLowerCase());
}
public static PlayerCache getInstance() {
if (singleton == null) {
singleton = new PlayerCache();
}
return singleton;
}
}