Fixed stat bugs.
This commit is contained in:
parent
526b5c333a
commit
a4cf9e2f4b
@ -48,29 +48,14 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
}
|
||||
}
|
||||
|
||||
public void incrementStat(Player player, final String statName, int value)
|
||||
public void incrementStat(Player player, final String statName, final int value)
|
||||
{
|
||||
int newValue = Get(player).addStat(statName, value);
|
||||
|
||||
//Event
|
||||
UtilServer.getServer().getPluginManager().callEvent(new StatChangeEvent(player.getName(), statName, newValue - value, newValue));
|
||||
|
||||
String uuidString = player.getUniqueId().toString();
|
||||
|
||||
synchronized (_statSync)
|
||||
{
|
||||
if (!_statUploadQueue.containsKey(uuidString))
|
||||
{
|
||||
_statUploadQueue.put(uuidString, new NautHashMap<String, Integer>());
|
||||
}
|
||||
|
||||
if (!_statUploadQueue.get(uuidString).containsKey(statName))
|
||||
{
|
||||
_statUploadQueue.get(uuidString).put(statName, 0);
|
||||
}
|
||||
|
||||
_statUploadQueue.get(uuidString).put(statName, value);
|
||||
}
|
||||
final String uuidString = player.getUniqueId().toString();
|
||||
|
||||
// Verify stat is in our local cache, if not add it remotely.
|
||||
if (!_stats.containsKey(statName))
|
||||
@ -81,6 +66,12 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
{
|
||||
synchronized (_statSync)
|
||||
{
|
||||
if (_stats.containsKey(statName))
|
||||
{
|
||||
addToQueue(statName, uuidString, value);
|
||||
return;
|
||||
}
|
||||
|
||||
_repository.addStat(statName);
|
||||
|
||||
_stats.clear();
|
||||
@ -89,10 +80,34 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
{
|
||||
_stats.put(stat.Name, stat.Id);
|
||||
}
|
||||
|
||||
addToQueue(statName, uuidString, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
synchronized (_statSync)
|
||||
{
|
||||
addToQueue(statName, uuidString, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addToQueue(String statName, String uuidString, int value)
|
||||
{
|
||||
if (!_statUploadQueue.containsKey(uuidString))
|
||||
{
|
||||
_statUploadQueue.put(uuidString, new NautHashMap<String, Integer>());
|
||||
}
|
||||
|
||||
if (!_statUploadQueue.get(uuidString).containsKey(statName))
|
||||
{
|
||||
_statUploadQueue.get(uuidString).put(statName, 0);
|
||||
}
|
||||
|
||||
_statUploadQueue.get(uuidString).put(statName, value);
|
||||
}
|
||||
|
||||
protected void saveStats()
|
||||
|
Loading…
Reference in New Issue
Block a user