Search in sources :

Example 1 with IMixinStatisticsManager

use of org.spongepowered.common.interfaces.statistic.IMixinStatisticsManager in project SpongeCommon by SpongePowered.

the class StatisticDataProcessor method getVal.

@Override
protected Optional<Map<Statistic, Long>> getVal(EntityPlayerMP player) {
    checkNotNull(player, "null player");
    StatisticsManagerServer stats = player.getStatFile();
    Map<StatBase, TupleIntJsonSerializable> data = ((IMixinStatisticsManager) stats).getStatsData();
    Map<Statistic, Long> statMap = Maps.newHashMap();
    for (Entry<StatBase, TupleIntJsonSerializable> statEntry : data.entrySet()) {
        statMap.put((Statistic) statEntry.getKey(), (long) statEntry.getValue().getIntegerValue());
    }
    return Optional.of(statMap);
}
Also used : TupleIntJsonSerializable(net.minecraft.util.TupleIntJsonSerializable) IMixinStatisticsManager(org.spongepowered.common.interfaces.statistic.IMixinStatisticsManager) Statistic(org.spongepowered.api.statistic.Statistic) StatisticsManagerServer(net.minecraft.stats.StatisticsManagerServer) StatBase(net.minecraft.stats.StatBase)

Aggregations

StatBase (net.minecraft.stats.StatBase)1 StatisticsManagerServer (net.minecraft.stats.StatisticsManagerServer)1 TupleIntJsonSerializable (net.minecraft.util.TupleIntJsonSerializable)1 Statistic (org.spongepowered.api.statistic.Statistic)1 IMixinStatisticsManager (org.spongepowered.common.interfaces.statistic.IMixinStatisticsManager)1