Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. package me.events;
  2.  
  3. import java.text.SimpleDateFormat;
  4. import java.util.Date;
  5. import java.util.UUID;
  6.  
  7. import de.omel.api.file.FileBuilder;
  8.  
  9. public class PlayerData {
  10.  
  11. private FileBuilder fb;
  12. @SuppressWarnings("unused")
  13. private UUID uuid;
  14.  
  15. public PlayerData(UUID uuid) {
  16. fb = new FileBuilder("plugins//PowerBans//PlayerData//", uuid.toString() + ".yml");
  17. fb.save();
  18. this.uuid = uuid;
  19.  
  20. }
  21.  
  22. public boolean exist() {
  23. return fb.exist();
  24.  
  25. }
  26.  
  27. public void setTempBanned(String from, String reason, long time) {
  28. fb.setValue("tempban.istempbanned", true);
  29. fb.setValue("tempban.from", from);
  30. fb.setValue("tempban.reason", reason);
  31. fb.setValue("tempban.duration", time + System.currentTimeMillis());
  32. fb.setValue("tempban.timestamp", new SimpleDateFormat("dd.MM.yyyy HH:mm").format(new Date()));
  33. fb.save();
  34. }
  35.  
  36. public void setUnTempbanned() {
  37. fb.setValue("tempban", null);
  38. fb.save();
  39.  
  40. }
  41. public String getTempBannedReason() {
  42. return fb.getString("tempban.reason");
  43. }
  44.  
  45. public String getTempBannedFrom() {
  46. return fb.getString("tempban.from");
  47. }
  48.  
  49. public long getTempBanMilliseconds() {
  50. return fb.getLong("tempban.duration");
  51.  
  52. }
  53.  
  54. public String getTempbanTimestamp() {
  55. return fb.getString("tempban.timestamp");
  56. }
  57.  
  58. public boolean isTempbanned() {
  59. return fb.getBoolean("tempban.istempbanned");
  60. }
  61.  
  62. public void setMuted(boolean muted) {
  63. fb.setValue("muted", muted);
  64. fb.save();
  65. }
  66.  
  67. public boolean isMuted() {
  68. return fb.getBoolean("muted");
  69.  
  70. }
  71.  
  72. public boolean isTempmuted() {
  73. return fb.getBoolean("tempmuted");
  74. }
  75.  
  76. public long getTempmuteMilliseconds() {
  77. return fb.getLong("tempmute.duration");
  78.  
  79. }
  80.  
  81. public void setUnTempmuted() {
  82. fb.setValue("tempmute", null);
  83. fb.save();
  84.  
  85. }
  86.  
  87. public void setTempmuted(String from, String reason, long time) {
  88. fb.setValue("tempmute.istempmuted", true);
  89. fb.setValue("tempmute.from", from);
  90. fb.setValue("tempmute.reason", reason);
  91. fb.setValue("tempmute.duration", time + System.currentTimeMillis());
  92. fb.setValue("tempmute.timestamp", new SimpleDateFormat("dd.MM.yyyy HH:mm").format(new Date()));
  93. fb.save();
  94.  
  95. }
  96.  
  97. public String getTempmutedFrom() {
  98. return fb.getString("tempmute.from");
  99. }
  100.  
  101. public void setBanned(String from, String reason) {
  102. fb.setValue("ban.isbanned", true);
  103. fb.setValue("tempban.from", from);
  104. fb.setValue("tempban.reason", reason);
  105.  
  106. }
  107.  
  108. public void setUnbanned() {
  109. fb.setValue("unban", null);
  110. fb.save();
  111. }
  112.  
  113. public String getTempmutedReason() {
  114. return fb.getString("tempmute.reason");
  115. }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement