Convert leaderboard stat events to insert into the repository using asynchronous task calls.
This commit is contained in:
parent
468f354422
commit
33ff7f8e50
@ -5,6 +5,7 @@ import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.spawn.command.SpawnCommand;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -58,9 +59,17 @@ public class LeaderboardManager extends MiniPlugin
|
||||
* @param value - the counter value used to increment the statistic
|
||||
* @return true, if the stat event was successfully triggered and logged, false otherwise.
|
||||
*/
|
||||
public boolean onStatEvent(Player player, StatType type, int gamemode, int value)
|
||||
public boolean onStatEvent(final Player player, final StatType type, final int gamemode, final int value)
|
||||
{
|
||||
_statEvents.insertStatEvent(player.getName(), gamemode, _serverGroup, type.getTypeId(), value);
|
||||
// Asynchronously make DB call to insert stat event.
|
||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_statEvents.insertStatEvent(player.getName(), gamemode, _serverGroup, type.getTypeId(), value);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user