-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.sk
74 lines (70 loc) · 2.41 KB
/
storage.sk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#
# ==============
# storage.sk
# ==============
# storage.sk is part of the STEEM.CRAFT core functions.
# ==============
#
# > Function - saveStorageData
# > Saves data for a username and a specific usage type to the desired format.
# > Parameters:
# > <text>usage identifier
# > <offline player>the player who should be saved
# > <text>data key
# > <object>data value
function saveStorageData(usage:text,player:offline player,key:text,data:object):
#
# > Get the storage type out of the configuration to allow the server
# > operator multiple storage formats.
set {_storageformat} to getStorageType()
if {_storageformat} is "yaml":
saveyamluserdata({_usage},{_player},{_key},{_data})
#
# > Function - getStorageData
# > Returns the requested data from the desired storage format.
# > Try to cache results, since this may not very fast.
# > Parameters:
# > <text>usage identifier
# > <offline player>the player who should be saved
# > <text>data key
# > Returns:
# > <object>data value
function getStorageData(usage:text,player:offline player,key:text) :: object:
#
# > Get the storage type out of the configuration to allow the server
# > operator multiple storage formats.
set {_storageformat} to getStorageType()
if {_storageformat} is "yaml":
return getyamluserdata({_usage},{_player},{_key})
#
# > Function - saveGeneralStorageData
# > Saves data for a specific usage type to the desired format.
# > Parameters:
# > <text>usage identifier
# > <text>category
# > <text>data key
# > <object>data value
function saveGeneralStorageData(usage:text,category:text,key:text,data:object):
#
# > Get the storage type out of the configuration to allow the server
# > operator multiple storage formats.
set {_storageformat} to getStorageType()
if {_storageformat} is "yaml":
saveyamldata({_usage},{_category},{_key},{_data})
#
# > Function - getGeneralStorageData
# > Returns the requested data from the desired storage format.
# > Try to cache results, since this may not very fast.
# > Parameters:
# > <text>usage identifier
# > <text>category
# > <text>data key
# > Returns:
# > <object>data value
function getGeneralStorageData(usage:text,category:text,key:text) :: object:
#
# > Get the storage type out of the configuration to allow the server
# > operator multiple storage formats.
set {_storageformat} to getStorageType()
if {_storageformat} is "yaml":
return getyamldata({_usage},{_category},{_key})