Interface IStatisticsManager

All Known Implementing Classes:
StatisticsManager

public interface IStatisticsManager
Interface for the statistics manager
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Aggregate the statistics of the source statistics manager into the target statistics manager.
    void
    Clear all the statistics, this will remove all the entries from the map
    void
    deserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
    Deserialize from bytebuf.
    @NotNull Set<Map.Entry<String,it.unimi.dsi.fastutil.ints.Int2IntLinkedOpenHashMap>>
    Getter for all stat entries.
    int
    getStatsInPeriod(@NotNull String id, int dayStart, int dayEnd)
    Get the number of occurrences in a given period.
    int
    getStatTotal(@NotNull String id)
    Get the total for a given stat,
    @NotNull Set<String>
    Getter for the whole stat list.
    void
    increment(@NotNull String id, int day)
    Increment a given statistic.
    void
    incrementBy(@NotNull String id, int qty, int day)
    Increment a given statistic by some quantity.
    void
    readFromNBT(@NotNull net.minecraft.nbt.CompoundTag compound)
    Reads the eventManager nbt and creates events from it
    void
    serialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf, boolean hasNewSubscribers)
    Serialize to bytebuf.
    void
    writeToNBT(@NotNull net.minecraft.nbt.CompoundTag compound)
    Write the eventmanager and all events to NBT
  • Method Details

    • increment

      void increment(@NotNull @NotNull String id, int day)
      Increment a given statistic. Creates a new if it doesn't exist yet. Assigns a timestamp to the entry.
      Parameters:
      id - the id of the stat.
    • incrementBy

      void incrementBy(@NotNull @NotNull String id, int qty, int day)
      Increment a given statistic by some quantity. Creates a new if it doesn't exist yet. Assigns a timestamp to the entry.
      Parameters:
      id - the id of the stat.
      qty - the quantity.
    • getStatTotal

      int getStatTotal(@NotNull @NotNull String id)
      Get the total for a given stat,
      Parameters:
      id - the id of the stat.
      Returns:
      the total since colony creation.
    • getStatsInPeriod

      int getStatsInPeriod(@NotNull @NotNull String id, int dayStart, int dayEnd)
      Get the number of occurrences in a given period.
      Parameters:
      id - the id of the stat.
      dayStart - the start day.
      dayEnd - the end day.
      Returns:
      the count.
    • serialize

      void serialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf, boolean hasNewSubscribers)
      Serialize to bytebuf.
      Parameters:
      buf - the buffer to write to.
      hasNewSubscribers -
    • deserialize

      void deserialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
      Deserialize from bytebuf.
      Parameters:
      buf - the buffer to read from.
    • readFromNBT

      void readFromNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Reads the eventManager nbt and creates events from it
      Parameters:
      compound - the compound to read from.
    • writeToNBT

      void writeToNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Write the eventmanager and all events to NBT
      Parameters:
      compound - the compound to write to.
    • getStatTypes

      @NotNull @NotNull Set<String> getStatTypes()
      Getter for the whole stat list.
      Returns:
      the map of stats.
    • getStatEntries

      @NotNull @NotNull Set<Map.Entry<String,it.unimi.dsi.fastutil.ints.Int2IntLinkedOpenHashMap>> getStatEntries()
      Getter for all stat entries.
      Returns:
      the set of stat entries.
    • clear

      @NotNull void clear()
      Clear all the statistics, this will remove all the entries from the map
    • aggregateStats

      static void aggregateStats(IStatisticsManager target, IStatisticsManager source)
      Aggregate the statistics of the source statistics manager into the target statistics manager. The target manager will be modified in place, the source manager will not be modified.
      Parameters:
      target - the manager to add the statistics to.
      source - the manager to take the statistics from.