Class StatisticsManager
java.lang.Object
com.minecolonies.core.colony.managers.StatisticsManager
- All Implemented Interfaces:
IStatisticsManager
Manager for colony related statistics.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all the statistics, this will remove all the entries from the mapvoiddeserialize(@NotNull net.minecraft.network.FriendlyByteBuf buf) Deserialize from bytebuf.Gets all the current stat entries in this manager.intgetStatsInPeriod(@NotNull String id, int startDay, int endDay) 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.FriendlyByteBuf buf, boolean fullSync) Serialize to bytebuf.voidwriteToNBT(@NotNull net.minecraft.nbt.CompoundTag compound) Write the eventmanager and all events to NBT
-
Constructor Details
-
StatisticsManager
public StatisticsManager()
-
-
Method Details
-
increment
Description copied from interface:IStatisticsManagerIncrement a given statistic. Creates a new if it doesn't exist yet. Assigns a timestamp to the entry.- Specified by:
incrementin interfaceIStatisticsManager- Parameters:
id- the id of the stat.
-
incrementBy
Description copied from interface:IStatisticsManagerIncrement a given statistic by some quantity. Creates a new if it doesn't exist yet. Assigns a timestamp to the entry.- Specified by:
incrementByin interfaceIStatisticsManager- Parameters:
id- the id of the stat.qty- the quantity.
-
getStatTotal
Description copied from interface:IStatisticsManagerGet the total for a given stat,- Specified by:
getStatTotalin interfaceIStatisticsManager- Parameters:
id- the id of the stat.- Returns:
- the total since colony creation.
-
getStatsInPeriod
Description copied from interface:IStatisticsManagerGet the number of occurrences in a given period.- Specified by:
getStatsInPeriodin interfaceIStatisticsManager- Parameters:
id- the id of the stat.startDay- the start day.endDay- the end day.- Returns:
- the count.
-
getStatTypes
Description copied from interface:IStatisticsManagerGetter for the whole stat list.- Specified by:
getStatTypesin interfaceIStatisticsManager- Returns:
- the map of stats.
-
getStatEntries
@NotNull public @NotNull Set<Map.Entry<String,it.unimi.dsi.fastutil.ints.Int2IntLinkedOpenHashMap>> getStatEntries()Gets all the current stat entries in this manager.- Specified by:
getStatEntriesin interfaceIStatisticsManager- Returns:
- a set of entries with the id and the stats map.
-
clear
public void clear()Clear all the statistics, this will remove all the entries from the map- Specified by:
clearin interfaceIStatisticsManager
-
serialize
public void serialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf, boolean fullSync) Description copied from interface:IStatisticsManagerSerialize to bytebuf.- Specified by:
serializein interfaceIStatisticsManager- Parameters:
buf- the buffer to write to.
-
deserialize
public void deserialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Description copied from interface:IStatisticsManagerDeserialize from bytebuf.- Specified by:
deserializein interfaceIStatisticsManager- Parameters:
buf- the buffer to read from.
-
writeToNBT
public void writeToNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Description copied from interface:IStatisticsManagerWrite the eventmanager and all events to NBT- Specified by:
writeToNBTin interfaceIStatisticsManager- Parameters:
compound- the compound to write to.
-
readFromNBT
public void readFromNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Description copied from interface:IStatisticsManagerReads the eventManager nbt and creates events from it- Specified by:
readFromNBTin interfaceIStatisticsManager- Parameters:
compound- the compound to read from.
-