RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
PersonalStoreSaver.java
1
package
com.osroyale.content.store;
2
3
import
com.google.gson.JsonParser;
4
import
com.osroyale.content.store.impl.PersonalStore;
5
import
com.osroyale.util.GsonUtils;
6
7
import
java.io.FileReader;
8
import
java.io.FileWriter;
9
import
java.nio.file.Files;
10
import
java.nio.file.Path;
11
import
java.nio.file.Paths;
12
36
37
public
class
PersonalStoreSaver
{
38
39
private
static
final
String PAYMENT_PATH =
"/def/content/game/personal_stores_payments.json"
;
40
41
public
static
void
savePayments() {
42
Thread.startVirtualThread(() -> {
43
try
(FileWriter fw =
new
FileWriter(
"./data"
+ PAYMENT_PATH)) {
44
fw.write(
GsonUtils
.JSON_PRETTY_ALLOW_NULL.get().toJson(
PersonalStore
.
SOLD_ITEMS
));
45
}
catch
(
final
Exception e) {
46
e.printStackTrace();
47
}
48
});
49
}
50
51
public
static
void
loadPayments() {
52
Path path = Paths.get(
"data"
, PAYMENT_PATH);
53
54
if
(!Files.exists(path)) {
55
return
;
56
}
57
58
try
(FileReader reader =
new
FileReader(path.toFile())) {
59
JsonParser parser =
new
JsonParser();
60
//PersonalStore.SOLD_ITEMS = new GsonBuilder().create().fromJson(parser.parse(reader), type);
61
}
catch
(Exception e) {
62
e.printStackTrace();
63
}
64
}
65
}
com.osroyale.content.store.PersonalStoreSaver
Definition
PersonalStoreSaver.java:37
com.osroyale.content.store.impl.PersonalStore
Definition
PersonalStore.java:59
com.osroyale.content.store.impl.PersonalStore.SOLD_ITEMS
static Map< String, Long > SOLD_ITEMS
Definition
PersonalStore.java:65
com.osroyale.util.GsonUtils
Definition
GsonUtils.java:25