Advertisement
bbbbas

StatusLine

May 14th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. package game;
  2.  
  3. /**
  4. *
  5. * @author bas
  6. */
  7.  
  8. public class StatusLine {
  9. private String playerName;
  10. private int level;
  11. private int moves;
  12. private double time;
  13.  
  14. public StatusLine(String playerName) {
  15.  
  16. setPlayerName(playerName);
  17. setLevel(1);
  18. setMoves(0);
  19. setTime(0);
  20.  
  21. }
  22.  
  23. public String getPlayerName() {
  24.  
  25. return this.playerName;
  26.  
  27. }
  28.  
  29. public void setPlayerName(String playerName) {
  30. if (playerName.contains(null) || playerName.equals(" ")) {
  31. this.playerName = "guest";
  32. } else {
  33. this.playerName = playerName;
  34. }
  35. }
  36.  
  37. public int getLevel() {
  38.  
  39. return this.level;
  40.  
  41. }
  42.  
  43. public void setLevel(int level) {
  44. if (level < 1) {
  45. this.level = 1;
  46. } else {
  47. this.level = level;
  48. }
  49. }
  50.  
  51. public int getMoves() {
  52.  
  53. return this.moves;
  54.  
  55. }
  56.  
  57. public void setMoves(int moves) {
  58. if (moves < 0) {
  59. this.moves = 0;
  60. } else {
  61. this.moves = moves;
  62. }
  63. }
  64.  
  65. public double getTime() {
  66.  
  67. return this.time;
  68.  
  69. }
  70.  
  71. public void setTime(double time) {
  72. if (time < 0) {
  73. this.time = 0;
  74. } else {
  75. this.time = time;
  76. }
  77. }
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement