Interface IStatisticsManager
- All Known Implementing Classes:
StatisticsManager
public interface IStatisticsManager
Interface for the statistics manager
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaggregateStats(IStatisticsManager target, IStatisticsManager source) Aggregate the statistics of the source statistics manager into the target statistics manager.voidclear()Clear all the statistics, this will remove all the entries from the mapvoiddeserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Deserialize from bytebuf.Getter for all stat entries.intgetStatsInPeriod(@NotNull String id, int dayStart, int dayEnd) Get the number of occurrences in a given period.intgetStatTotal(@NotNull String id) Get the total for a given stat,Getter for the whole stat list.voidIncrement a given statistic.voidincrementBy(@NotNull String id, int qty, int day) Increment a given statistic by some quantity.voidreadFromNBT(@NotNull net.minecraft.nbt.CompoundTag compound) Reads the eventManager nbt and creates events from itvoidserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf, boolean hasNewSubscribers) Serialize to bytebuf.voidwriteToNBT(@NotNull net.minecraft.nbt.CompoundTag compound) Write the eventmanager and all events to NBT
-
Method Details
-
increment
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
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
Get the total for a given stat,- Parameters:
id- the id of the stat.- Returns:
- the total since colony creation.
-
getStatsInPeriod
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
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
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.
-