Documentation ¶
Index ¶
Constants ¶
View Source
const ( STATS_DIR = "/stats" PLAYER_DIR = "/playerdata" ADVANCEMENTS_DIR = "/advancements" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advancement ¶
type Advancement struct {
Done bool `json:"done"`
}
type CustomStats ¶
type CustomStats struct { Jump int Deaths int DamageTaken int DamageDealt int Playtime int Walk int Swim int Sprint int Dive int Fall int Fly int Boat int Horse int Climb int Sleep int Crafted int Custom map[string]int }
func (*CustomStats) UnmarshalJSON ¶
func (s *CustomStats) UnmarshalJSON(data []byte) error
Implements Unmarshal, allows unknown stats to be saved in map
type ErrFailedToParseStat ¶
func NewErrFailedToParseStat ¶
func NewErrFailedToParseStat(name string, value int) *ErrFailedToParseStat
func (*ErrFailedToParseStat) Error ¶
func (e *ErrFailedToParseStat) Error() string
type ErrNoWorldDirectory ¶
type ErrNoWorldDirectory struct {
// contains filtered or unexported fields
}
func NewErrNoWorldDirectory ¶
func NewErrNoWorldDirectory(details string) *ErrNoWorldDirectory
func (*ErrNoWorldDirectory) Error ¶
func (e *ErrNoWorldDirectory) Error() string
type MinecraftAdvancements ¶
type MinecraftAdvancements struct {
Advancements map[string]Advancement
}
func (*MinecraftAdvancements) UnmarshalJSON ¶
func (a *MinecraftAdvancements) UnmarshalJSON(data []byte) error
Implements Unmarshal, allows to drop "DataVersion"
type MinecraftLevelDat ¶
type MinecraftLevelDat struct { Data struct { Version MinecraftVersion `nbt:"Version"` StorageVersion int `nbt:"version"` } `nbt:"Data"` }
type MinecraftPlayerData ¶
type MinecraftStats ¶
type MinecraftStats struct {
Stats Stats `json:"stats"`
}
type MinecraftVersion ¶
type PlayerData ¶
type PlayerData struct { Advancements map[string]Advancement Stats Stats PlayerData MinecraftPlayerData }
type Save ¶
type Save struct { Version MinecraftVersion // contains filtered or unexported fields }
func (*Save) GetPlayers ¶
Return all players from the save
func (*Save) GetVersion ¶
Return the Minecraft Version of the save
func (*Save) LoadPlayerData ¶
func (s *Save) LoadPlayerData(player string) (PlayerData, error)
Load all relevant data for the given player
type SaveCollector ¶
type SaveCollector struct { ReduceMetrics bool // contains filtered or unexported fields }
func NewSaveCollector ¶
func NewSaveCollector(path string, reduceMetrics bool) (*SaveCollector, error)
Create new instance of collector, returns error if an world directory is not provided Arguments:
path: The path of the minecraft world directory reduceMetrics: Indicate if the amount of metrics should be reduced
func (*SaveCollector) Collect ¶
func (c *SaveCollector) Collect(ch chan<- prometheus.Metric)
Implements the Collect function for prometheus.Collector
func (*SaveCollector) Describe ¶
func (c *SaveCollector) Describe(ch chan<- *prometheus.Desc)
Implements the Describe function for prometheus.Collector
type Stats ¶
type Stats struct { CraftedItems map[string]int `json:"minecraft:crafted"` Mined map[string]int `json:"minecraft:mined"` PickedUp map[string]int `json:"minecraft:picked_up"` Killed map[string]int `json:"minecraft:killed"` KilledBy map[string]int `json:"minecraft:killed_by"` Custom CustomStats `json:"minecraft:custom"` }
Click to show internal directories.
Click to hide internal directories.