package valandur.webapi.serialize.view.player;

import com.fasterxml.jackson.annotation.JsonValue;
import org.spongepowered.api.data.manipulator.mutable.entity.StatisticData;
import org.spongepowered.api.statistic.Statistic;
import valandur.webapi.api.serialize.BaseView;

import java.util.Map;

public class StatisticDataView extends BaseView<StatisticData> {

    @JsonValue
    public Map<String, Long> data;


    public StatisticDataView(StatisticData value) {
        super(value);

        Map<Statistic, Long> map = value.asMap();
        for (Map.Entry<Statistic, Long> entry : map.entrySet()) {
            data.put(entry.getKey().getId(), entry.getValue());
        }
    }
}

@@ -269,24 +269,51 @@
 aseView;%0D%0A%0D%0A
+import java.util.HashMap;%0D%0A
 import java.
@@ -442,16 +442,34 @@
 ng%3E data
+ = new HashMap%3C%3E()
 ;%0D%0A%0D%0A%0D%0A 

Fix NPE in StatisticsDataView. Fixes #50