Guest User

Untitled

a guest
Jan 24th, 2020
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. // Source code recreated from a .class file by IntelliJ IDEA
  3. // (powered by Fernflower decompiler)
  4. //
  5.  
  6. package fr.nexion.base.punishment;
  7.  
  8. import fr.nexion.api.databases.Database;
  9. import fr.nexion.api.utils.TaskRunner;
  10. import fr.nexion.base.NexionBase;
  11. import lombok.NonNull;
  12. import org.bukkit.entity.Player;
  13.  
  14. public class Punishment {
  15. private static final String[] COLUMNS = new String[]{"type", "user", "reason", "author", "expiration"};
  16. @NonNull
  17. private String type;
  18. @NonNull
  19. private String reason;
  20. @NonNull
  21. private String author;
  22. @NonNull
  23. private String user;
  24. @NonNull
  25. private String created;
  26. private long expirationMillis;
  27.  
  28. public void persist() {
  29. Database database = NexionBase.getInstance().getDataBase();
  30. Object[] values = new Object[]{this.type, this.user, this.reason, this.author, this.expirationMillis};
  31. TaskRunner.ASYNC.runTask(() -> {
  32. database.insertIntoOrUpdate("punishments", COLUMNS, values, false);
  33. }, NexionBase.getInstance());
  34. }
  35.  
  36. public void apply(Player player, Player author) {
  37. }
  38.  
  39. public PunishmentType getPunishmentType() {
  40. return PunishmentType.valueOf(this.type);
  41. }
  42.  
  43. Punishment(@NonNull String type, @NonNull String reason, @NonNull String author, @NonNull String user, @NonNull String created, long expirationMillis) {
  44. if (type == null) {
  45. throw new NullPointerException("type is marked non-null but is null");
  46. } else if (reason == null) {
  47. throw new NullPointerException("reason is marked non-null but is null");
  48. } else if (author == null) {
  49. throw new NullPointerException("author is marked non-null but is null");
  50. } else if (user == null) {
  51. throw new NullPointerException("user is marked non-null but is null");
  52. } else if (created == null) {
  53. throw new NullPointerException("created is marked non-null but is null");
  54. } else {
  55. this.type = type;
  56. this.reason = reason;
  57. this.author = author;
  58. this.user = user;
  59. this.created = created;
  60. this.expirationMillis = expirationMillis;
  61. }
  62. }
  63.  
  64. public static fr.nexion.base.punishment.Punishment.PunishmentBuilder builder() {
  65. return new fr.nexion.base.punishment.Punishment.PunishmentBuilder();
  66. }
  67.  
  68. @NonNull
  69. public String getType() {
  70. return this.type;
  71. }
  72.  
  73. @NonNull
  74. public String getReason() {
  75. return this.reason;
  76. }
  77.  
  78. @NonNull
  79. public String getAuthor() {
  80. return this.author;
  81. }
  82.  
  83. @NonNull
  84. public String getUser() {
  85. return this.user;
  86. }
  87.  
  88. @NonNull
  89. public String getCreated() {
  90. return this.created;
  91. }
  92.  
  93. public long getExpirationMillis() {
  94. return this.expirationMillis;
  95. }
  96.  
  97. public void setType(@NonNull String type) {
  98. if (type == null) {
  99. throw new NullPointerException("type is marked non-null but is null");
  100. } else {
  101. this.type = type;
  102. }
  103. }
  104.  
  105. public void setReason(@NonNull String reason) {
  106. if (reason == null) {
  107. throw new NullPointerException("reason is marked non-null but is null");
  108. } else {
  109. this.reason = reason;
  110. }
  111. }
  112.  
  113. public void setAuthor(@NonNull String author) {
  114. if (author == null) {
  115. throw new NullPointerException("author is marked non-null but is null");
  116. } else {
  117. this.author = author;
  118. }
  119. }
  120.  
  121. public void setUser(@NonNull String user) {
  122. if (user == null) {
  123. throw new NullPointerException("user is marked non-null but is null");
  124. } else {
  125. this.user = user;
  126. }
  127. }
  128.  
  129. public void setCreated(@NonNull String created) {
  130. if (created == null) {
  131. throw new NullPointerException("created is marked non-null but is null");
  132. } else {
  133. this.created = created;
  134. }
  135. }
  136.  
  137. public void setExpirationMillis(long expirationMillis) {
  138. this.expirationMillis = expirationMillis;
  139. }
  140.  
  141. public boolean equals(Object o) {
  142. if (o == this) {
  143. return true;
  144. } else if (!(o instanceof Punishment)) {
  145. return false;
  146. } else {
  147. Punishment other = (Punishment)o;
  148. if (!other.canEqual(this)) {
  149. return false;
  150. } else {
  151. label75: {
  152. Object this$type = this.getType();
  153. Object other$type = other.getType();
  154. if (this$type == null) {
  155. if (other$type == null) {
  156. break label75;
  157. }
  158. } else if (this$type.equals(other$type)) {
  159. break label75;
  160. }
  161.  
  162. return false;
  163. }
  164.  
  165. Object this$reason = this.getReason();
  166. Object other$reason = other.getReason();
  167. if (this$reason == null) {
  168. if (other$reason != null) {
  169. return false;
  170. }
  171. } else if (!this$reason.equals(other$reason)) {
  172. return false;
  173. }
  174.  
  175. Object this$author = this.getAuthor();
  176. Object other$author = other.getAuthor();
  177. if (this$author == null) {
  178. if (other$author != null) {
  179. return false;
  180. }
  181. } else if (!this$author.equals(other$author)) {
  182. return false;
  183. }
  184.  
  185. label54: {
  186. Object this$user = this.getUser();
  187. Object other$user = other.getUser();
  188. if (this$user == null) {
  189. if (other$user == null) {
  190. break label54;
  191. }
  192. } else if (this$user.equals(other$user)) {
  193. break label54;
  194. }
  195.  
  196. return false;
  197. }
  198.  
  199. label47: {
  200. Object this$created = this.getCreated();
  201. Object other$created = other.getCreated();
  202. if (this$created == null) {
  203. if (other$created == null) {
  204. break label47;
  205. }
  206. } else if (this$created.equals(other$created)) {
  207. break label47;
  208. }
  209.  
  210. return false;
  211. }
  212.  
  213. if (this.getExpirationMillis() != other.getExpirationMillis()) {
  214. return false;
  215. } else {
  216. return true;
  217. }
  218. }
  219. }
  220. }
  221.  
  222. protected boolean canEqual(Object other) {
  223. return other instanceof Punishment;
  224. }
  225.  
  226. public int hashCode() {
  227. int PRIME = true;
  228. int result = 1;
  229. Object $type = this.getType();
  230. int result = result * 59 + ($type == null ? 43 : $type.hashCode());
  231. Object $reason = this.getReason();
  232. result = result * 59 + ($reason == null ? 43 : $reason.hashCode());
  233. Object $author = this.getAuthor();
  234. result = result * 59 + ($author == null ? 43 : $author.hashCode());
  235. Object $user = this.getUser();
  236. result = result * 59 + ($user == null ? 43 : $user.hashCode());
  237. Object $created = this.getCreated();
  238. result = result * 59 + ($created == null ? 43 : $created.hashCode());
  239. long $expirationMillis = this.getExpirationMillis();
  240. result = result * 59 + (int)($expirationMillis >>> 32 ^ $expirationMillis);
  241. return result;
  242. }
  243.  
  244. public String toString() {
  245. return "Punishment(type=" + this.getType() + ", reason=" + this.getReason() + ", author=" + this.getAuthor() + ", user=" + this.getUser() + ", created=" + this.getCreated() + ", expirationMillis=" + this.getExpirationMillis() + ")";
  246. }
  247. }
RAW Paste Data