Newer
Older
CactusServer / src / main / java / cactusServer / entities / Account.java
  1. package cactusServer.entities;
  2.  
  3. //import com.fasterxml.jackson.annotation.JsonIgnore;
  4. //import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  5.  
  6. import cactusServer.utils.RandomStringGenerator;
  7. import net.arnx.jsonic.JSONHint;
  8.  
  9. public class Account {
  10. private String id, name, token, pass, uniqueID;
  11. private boolean login = false;
  12.  
  13. private Account() {
  14.  
  15. }
  16.  
  17. public Account(String userID, String userName, String userPass, String uniqueID) {
  18. setId(userID);
  19. setName(userName);
  20. setPass(userPass);
  21. setUniqueID(uniqueID);
  22. formToken();
  23. login = true;
  24. }
  25.  
  26. public String getId() {
  27. return id;
  28. }
  29.  
  30. public void setId(String id) {
  31. this.id = id;
  32. }
  33.  
  34. public String getName() {
  35. return name;
  36. }
  37.  
  38. public void setName(String name) {
  39. this.name = name;
  40. }
  41.  
  42. @JSONHint(ignore = true)
  43. public String getPass() {
  44. return pass;
  45. }
  46.  
  47. public void setPass(String pass) {
  48. this.pass = pass;
  49. }
  50.  
  51. public boolean isLogin() {
  52. return login;
  53. }
  54.  
  55. public void setLogin(boolean login) {
  56. this.login = login;
  57. }
  58.  
  59. public String getToken() {
  60. return token;
  61. }
  62.  
  63. public String formToken() {
  64. token = RandomStringGenerator.generateRandomString(64, RandomStringGenerator.ALPHA_NUMERIC);
  65. return token;
  66. }
  67.  
  68. public void setToken(String token) {
  69. this.token = token;
  70. }
  71.  
  72. public String getUniqueID() {
  73. return uniqueID;
  74. }
  75.  
  76. public void setUniqueID(String uniqueID) {
  77. this.uniqueID = uniqueID;
  78. }
  79. }