Cuberite
A lightweight, fast and extensible game server for Minecraft
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
WorldStorage
StatSerializer.h
Go to the documentation of this file.
1
2
// StatSerializer.h
3
4
// Declares the cStatSerializer class that is used for saving stats into JSON
5
6
7
8
9
10
#pragma once
11
12
#include "json/json.h"
13
14
15
16
17
18
// fwd:
19
class
cStatManager
;
20
21
22
23
24
class
cStatSerializer
25
{
26
public
:
27
28
cStatSerializer
(
const
AString
& a_WorldName,
const
AString
& a_PlayerName,
const
AString
& a_FileName,
cStatManager
* a_Manager);
29
30
/* Try to load the player statistics. Returns whether the operation was successful or not. */
31
bool
Load
(
void
);
32
33
/* Try to save the player statistics. Returns whether the operation was successful or not. */
34
bool
Save
(
void
);
35
36
37
protected
:
38
39
void
SaveStatToJSON
(Json::Value & a_Out);
40
41
bool
LoadStatFromJSON
(
const
Json::Value & a_In);
42
43
44
private
:
45
46
cStatManager
*
m_Manager
;
47
48
AString
m_LegacyPath
;
// The old <username>.json path to try to read from if the uuid path doesn't exist on load
49
AString
m_Path
;
50
51
52
} ;
53
54
55
56
cStatManager
Class that manages the statistics and achievements of a single player.
Definition:
Statistics.h:127
cStatSerializer::m_LegacyPath
AString m_LegacyPath
Definition:
StatSerializer.h:48
cStatSerializer::LoadStatFromJSON
bool LoadStatFromJSON(const Json::Value &a_In)
Definition:
StatSerializer.cpp:106
cStatSerializer::cStatSerializer
cStatSerializer(const AString &a_WorldName, const AString &a_PlayerName, const AString &a_FileName, cStatManager *a_Manager)
Definition:
StatSerializer.cpp:14
cStatSerializer::Save
bool Save(void)
Definition:
StatSerializer.cpp:61
cStatSerializer::m_Manager
cStatManager * m_Manager
Definition:
StatSerializer.h:46
cStatSerializer::m_Path
AString m_Path
Definition:
StatSerializer.h:49
AString
std::string AString
Definition:
StringUtils.h:13
cStatSerializer::Load
bool Load(void)
Definition:
StatSerializer.cpp:34
cStatSerializer
Definition:
StatSerializer.h:24
cStatSerializer::SaveStatToJSON
void SaveStatToJSON(Json::Value &a_Out)
Definition:
StatSerializer.cpp:85
Generated on Mon Feb 24 2020 09:04:17 for Cuberite by
1.8.11