Repository navigation
Expand file tree
/
Copy pathPlayerProfile.java
More file actions
82 lines (72 loc) · 2.11 KB
/
Copy pathPlayerProfile.java
File metadata and controls
82 lines (72 loc) · 2.11 KB
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
75
76
77
78
79
80
81
82
/**
* Represents a PlayerProfile, storing the player's name, id and max level reached.
* @author Tahi Rahman
*/
public class PlayerProfile {
private final int playerId;
private String name;
private int maxLevelReached;
/**
* Constructs a new PlayerProfile with the specified name, maximum level reached, and high score.
* Each profile is assigned a unique player ID.
* @param name the name of the player
*/
public PlayerProfile(String name) {
this.playerId = ProfileManager.getNextPlayerId();
this.name = name;
this.maxLevelReached = 1;
}
/**
* Constructs a new PlayerProfile with the specified name, maximum level reached, and high score.
* Each profile is assigned a unique player ID.
*/
public PlayerProfile() {
this.playerId = ProfileManager.getNextPlayerId();
this.maxLevelReached = 1;
}
/**
* Constructs a new PlayerProfile with the specified name, maximum level reached, and high score.
* Each profile is assigned a unique player ID.
*
*/
public PlayerProfile(int playerId, String name, int maxLevelReached) {
this.playerId = playerId;
this.name = name;
this.maxLevelReached = maxLevelReached;
}
/**
* Gets the player's unique ID.
* @return the player's ID
*/
public int getPlayerId() {
return playerId;
}
/**
* Gets the player's name.
* @return the player's name
*/
public String getName() {
return name;
}
/**
* Sets the player's name.
* @param name the new name of the player
*/
public void setName(String name) {
this.name = name;
}
/**
* Gets the maximum level reached by the player.
* @return the maximum level reached
*/
public int getMaxLevelReached() {
return maxLevelReached;
}
/**
* Sets the maximum level reached by the player.
* @param maxLevelReached the new maximum level reached
*/
public void setMaxLevelReached(int maxLevelReached) {
this.maxLevelReached = maxLevelReached;
}
}