-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFLoadFromAutoSave.java
52 lines (44 loc) · 1.21 KB
/
FLoadFromAutoSave.java
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
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class FLoadFromAutoSave {
//TODO: Id laden
// private int id;
private String name;
private Date lastSave;
private int level;
private int points;
/**
* Constructor for objects of class LoadGameState
*/
public FLoadFromAutoSave() {
try (BufferedReader reader = new BufferedReader(new FileReader(System.getProperty("user.dir") + "/save/GameAutoSave.txt"))) {
String line;
while ((line = reader.readLine()) != null) {
String[] parts = line.split(",");
level = Integer.parseInt(parts[0]);
points = Integer.parseInt(parts[1]);
}
} catch (IOException e) {
e.printStackTrace();
}
}
// public int getId() {
// return id;
// }
public String getName() {
return this.name;
}
public Date getLastSave() {
return this.lastSave;
}
public int getLevel() {
return this.level;
}
public int getPoints() {
return this.points;
}
}