Facebook
From ds, 8 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 414
  1. public class Mute
  2. {
  3.     private static Main plugin;
  4.     private String admin;
  5.     private long createTime;
  6.     private long expireTime;
  7.     private int ID;
  8.     private String reason;
  9.     private UUID uuid;
  10.    
  11.     public Mute(final ResultSet rs) throws SQLException {
  12.         super();
  13.         this.ID = rs.getInt("id");
  14.         this.uuid = UUID.fromString(rs.getString("uuid"));
  15.         this.reason = rs.getString("reason");
  16.         this.admin = rs.getString("admin");
  17.         this.createTime = rs.getLong("createTime");
  18.         this.expireTime = rs.getLong("expireTime");
  19.     }
  20.    
  21.     public Mute(final UUID uuid, final String reason, final String admin, final long expireTime) {
  22.         super();
  23.         this.ID = -1;
  24.         this.uuid = uuid;
  25.         this.reason = reason;
  26.         this.admin = admin;
  27.         this.createTime = System.currentTimeMillis();
  28.         this.expireTime = expireTime;
  29.         this.insert();
  30.     }
  31.    
  32.     public static void setTools(final Main plugin) {
  33.         Mute.plugin = plugin;
  34.     }
  35.    
  36.     public void delete() {
  37.         Mute.plugin.getMysql().updateNow("DELETE FROM `tools_mutes` WHERE `uuid` = '" + this.getUuid() + "'");
  38.     }
  39.    
  40.     public void insert() {
  41.         final String query = "INSERT INTO `tools_mutes` SET `uuid` = '" + this.getUuid() + "', `admin` = '" + this.getAdmin() + "', `reason` = '" + this.getReason() + "', `createTime` = '" + this.getCreateTime() + "', `expireTime` = '" + this.getExpireTime() + "'";
  42.         Mute.plugin.getMysql().updateNow(query);
  43.     }
  44.    
  45.     public void update(final boolean paramBoolean) {
  46.         final String query = "UPDATE `tools_mutes` SET `admin` = '" + this.getAdmin() + "', `reason` = '" + this.getReason() + "', `createTime` = '" + this.getCreateTime() + "', `expireTime` = '" + this.getExpireTime() + " WHERE `uuid` = '" + this.getUuid() + "'";
  47.         if (paramBoolean) {
  48.             Mute.plugin.getMysql().updateNow(query);
  49.         }
  50.         else {
  51.             Mute.plugin.getMysql().update(query);
  52.         }
  53.     }
  54.    
  55.     public String getAdmin() {
  56.         return this.admin;
  57.     }
  58.    
  59.     public void setAdmin(final String admin) {
  60.         this.admin = admin;
  61.     }
  62.    
  63.     public long getCreateTime() {
  64.         return this.createTime;
  65.     }
  66.    
  67.     public void setCreateTime(final long createTime) {
  68.         this.createTime = createTime;
  69.     }
  70.    
  71.     public long getExpireTime() {
  72.         return this.expireTime;
  73.     }
  74.    
  75.     public void setExpireTime(final long expireTime) {
  76.         this.expireTime = expireTime;
  77.     }
  78.    
  79.     public int getID() {
  80.         return this.ID;
  81.     }
  82.    
  83.     public void setID(final int ID) {
  84.         this.ID = ID;
  85.     }
  86.    
  87.     public String getReason() {
  88.         return this.reason;
  89.     }
  90.    
  91.     public void setReason(final String reason) {
  92.         this.reason = reason;
  93.     }
  94.    
  95.     public UUID getUuid() {
  96.         return this.uuid;
  97.     }
  98.    
  99.     public void setUuid(final UUID uuid) {
  100.         this.uuid = uuid;
  101.     }
  102. }
  103.