The IAlmanacProvider allow to access player specific fishing statistics and historical catch data. This provider allows you to check if a player has completed certain milestones or to retrieve their total catch counts for specific species.
Class location:
dev.rm20.anglersalmanac.api.IAlmanacProvider;Accessing the Provider: You can retrieve the active implementation via the AnglersAlmanacAPI class:
IAlmanacProvider almanac = AnglersAlmanacAPI.getAlmanac();Available Methods
Use these methods to query fishing data for a specific player:
| Method | Return Type | Description |
|---|---|---|
getPlayerStats(uuid) | PlayerStatsData | Returns a data object containing total catches, legendary counts, and performance ratings. |
hasPlayerCaught(uuid, fishId) | boolean | Checks if a player has ever successfully caught the specified fish ID. |
getAllFishCounts(uuid) | Map<String, Integer> | Returns a map of every fish caught by the player and their respective catch counts. |
Implementation Example
This example demonstrates how to check a player’s progress and reward them if they reach a specific milestone using the AlmanacInstance.
PlayerStatsData
class PlayerStatsData {
public int totalCatches = 0;
public int legendaryCount = 0;
public java.util.List<FishEntry> topFish = new java.util.ArrayList<>();
public java.util.Map<String, Integer> ratingsMap = new java.util.HashMap<>();
public java.util.Map<String, Integer> catchMap = new java.util.HashMap<>();
public boolean hasCaught(String fishId) { return catchMap.containsKey(fishId); }
public int getRatingCount(MinigamePRating.PerformanceRating rating) { return ratingsMap.getOrDefault(rating.name(), 0); }
public int getFishCount(String fishId) { return catchMap.getOrDefault(fishId, 0); }
}