Change from HashMap to ConcurrentHashMap, need to be available from
other threads !
This commit is contained in:
parent
96925a580a
commit
dc3a8c1f06
@ -1,8 +1,7 @@
|
||||
package fr.xephi.authme.datasource;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -13,7 +12,7 @@ public class CacheDataSource extends Thread implements DataSource {
|
||||
|
||||
private DataSource source;
|
||||
public AuthMe plugin;
|
||||
private HashMap<String, PlayerAuth> cache = new HashMap<String, PlayerAuth>();
|
||||
private ConcurrentHashMap<String, PlayerAuth> cache = new ConcurrentHashMap<String, PlayerAuth>();
|
||||
|
||||
public CacheDataSource(AuthMe plugin, DataSource source) {
|
||||
this.plugin = plugin;
|
||||
|
||||
@ -381,16 +381,14 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onAsyncLogin(AsyncPlayerPreLoginEvent event)
|
||||
{
|
||||
public void onAsyncLogin(AsyncPlayerPreLoginEvent event) {
|
||||
Player player = null;
|
||||
try {
|
||||
player = Bukkit.getPlayer(event.getUniqueId());
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
player = Bukkit.getOfflinePlayer(event.getUniqueId()).getPlayer();
|
||||
} catch (Exception ex)
|
||||
{
|
||||
} catch (Exception ex) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -534,7 +532,8 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAntiBotMod(final AsyncPlayerPreLoginEvent event, final Player player) {
|
||||
private void checkAntiBotMod(final AsyncPlayerPreLoginEvent event,
|
||||
final Player player) {
|
||||
if (plugin.delayedAntiBot || plugin.antibotMod)
|
||||
return;
|
||||
if (plugin.authmePermissible(player, "authme.bypassantibot"))
|
||||
@ -679,8 +678,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
try {
|
||||
DataFileCache dataFile = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour());
|
||||
playerBackup.createCache(player, dataFile, LimboCache.getInstance().getLimboPlayer(name).getGroup(), LimboCache.getInstance().getLimboPlayer(name).getOperator(), LimboCache.getInstance().getLimboPlayer(name).isFlying());
|
||||
} catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.showError("Error on creating an inventory cache for " + name + ", maybe inventory wipe in preparation...");
|
||||
}
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user