//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!
43 lines
1.0 KiB
Java
43 lines
1.0 KiB
Java
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;
|
|
}
|
|
|
|
}
|