Fix: Player and PlayerTest Changed

This commit is contained in:
GabrieleRadice
2026-03-19 15:51:05 +01:00
parent 4792298495
commit 91be6bddc0
7 changed files with 69 additions and 135 deletions
@@ -91,18 +91,13 @@ public class Player {
this.PrestigeValue -= Value;
}
public void setUserName(String UserName) throws IllegalArgumentException{
final int MAXLEN = 32;
if(UserName.isEmpty() || UserName.length() > MAXLEN){
throw new IllegalArgumentException();
}
this.UserName = UserName;
}
// End setters
// Constructors
public Player(String UserName){
public Player(String UserName) throws IllegalArgumentException {
if(UserName.isEmpty() || UserName.length() > 32) {
throw new IllegalArgumentException();
}
this.UserName = UserName;
this.inventors = new ArrayList <>();