Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 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. private UUID uuid;
  13.  
  14. public PlayerData(UUID uuid) {
  15. fb = new FileBuilder("plugins//PowerBans//PlayerData//", uuid.toString() + ".yml");
  16. fb.save();
  17. this.uuid = uuid;
  18.  
  19. }
  20.  
  21. public boolean exist() {
  22. return fb.exist();
  23.  
  24. }
  25.  
  26. public void setTempBanned(String from, String reason, long time) {
  27. fb.setValue("tempban.istempbanned", true);
  28. fb.setValue("tempban.from", from);
  29. fb.setValue("tempban.reason", reason);
  30. fb.setValue("tempban.duration", time);
  31. fb.setValue("tempban.timestamp", new SimpleDateFormat("dd.MM.yyyy HH:mm").format(new Date()));
  32. fb.save();
  33. }
  34.  
  35. public void setUnTempbanned() {
  36. fb.setValue("tempban", null);
  37. fb.save();
  38.  
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement