Class MySqlStats

java.lang.Object
dev.jacrispys.JavaBot.api.libs.utils.mysql.MySqlStats

public class MySqlStats extends Object
Database handler for all Stats
  • Constructor Details

    • MySqlStats

      protected MySqlStats()
  • Method Details

    • getInstance

      public static MySqlStats getInstance()
      Returns:
      instance of the current class
      Throws:
      SQLException - if a database error occurs
      ExecutionException - if the Async database connection creation fails
      InterruptedException - if there is a thread fault while obtaining a connection
    • obtainConnection

      public void obtainConnection(Connection connection)
    • incrementGuildStat

      public void incrementGuildStat(long guildId, StatType statType)
      Increment's the given stat for the given guild
      Parameters:
      guildId - guild to increment stat for
      statType - type of stat to increment
    • incrementGuildStat

      public void incrementGuildStat(long guildId, long increment, StatType statType)
      Increment's the given stat for the given guild
      Parameters:
      guildId - guild to increment stat for
      increment - amount to increment the stat
      statType - type of stat to increment
    • getGuildStat

      public Object getGuildStat(long guildId, StatType statType) throws SQLException
      Obtains the given stat for the given guild
      Parameters:
      guildId - guild to obtain stat for
      statType - type of stat to obtain
      Throws:
      SQLException - if a database error occurs
    • getJdaStat

      public Object getJdaStat(StatType statType) throws SQLException
      Obtains the given stat in a global context
      Parameters:
      statType - type of stat to obtain
      Throws:
      SQLException - if a database error occurs
    • incrementUserStat

      public void incrementUserStat(net.dv8tion.jda.api.entities.Member member, UserStats stat)
      Increments a stat for a specific user
      Parameters:
      member - to increment stat for
      stat - stat type to increment
    • incrementUserStat

      public void incrementUserStat(net.dv8tion.jda.api.entities.Member member, long increment, UserStats stat)
      Increments a stat for a specific user
      Parameters:
      member - to increment stat for
      increment - amount to increment the stat by
      stat - stat type to increment