Search in sources :

Example 1 with SenderColl

use of com.massivecraft.massivecore.store.SenderColl in project MassiveCore by MassiveCraft.

the class EngineMassiveCoreDatabase method massiveStoreLoginSync.

// Can not be cancelled.
@EventHandler(priority = EventPriority.LOWEST)
public void massiveStoreLoginSync(PlayerLoginEvent event) {
    // Get player id ...
    Player player = event.getPlayer();
    if (MUtil.isntPlayer(player))
        return;
    final String playerId = player.getUniqueId().toString();
    // ... get remote entries ...
    Map<SenderColl<?>, Entry<JsonObject, Long>> remoteEntries = getRemoteEntries(playerId);
    // ... and sync each of them.
    for (Entry<SenderColl<?>, Entry<JsonObject, Long>> entry : remoteEntries.entrySet()) {
        SenderColl<?> coll = entry.getKey();
        Entry<JsonObject, Long> remoteEntry = entry.getValue();
        coll.syncId(playerId, null, remoteEntry);
    }
}
Also used : Player(org.bukkit.entity.Player) Entry(java.util.Map.Entry) JsonObject(com.massivecraft.massivecore.xlib.gson.JsonObject) SenderColl(com.massivecraft.massivecore.store.SenderColl) EventHandler(org.bukkit.event.EventHandler)

Aggregations

SenderColl (com.massivecraft.massivecore.store.SenderColl)1 JsonObject (com.massivecraft.massivecore.xlib.gson.JsonObject)1 Entry (java.util.Map.Entry)1 Player (org.bukkit.entity.Player)1 EventHandler (org.bukkit.event.EventHandler)1