Class MySqlStats
java.lang.Object
dev.jacrispys.JavaBot.api.libs.utils.mysql.MySqlStats
Database handler for all Stats
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetGuildStat(long guildId, StatType statType) Obtains the given stat for the given guildstatic MySqlStatsgetJdaStat(StatType statType) Obtains the given stat in a global contextvoidincrementGuildStat(long guildId, long increment, StatType statType) Increment's the given stat for the given guildvoidincrementGuildStat(long guildId, StatType statType) Increment's the given stat for the given guildvoidincrementUserStat(net.dv8tion.jda.api.entities.Member member, long increment, UserStats stat) Increments a stat for a specific uservoidincrementUserStat(net.dv8tion.jda.api.entities.Member member, UserStats stat) Increments a stat for a specific uservoidobtainConnection(Connection connection)
-
Constructor Details
-
MySqlStats
protected MySqlStats()
-
-
Method Details
-
getInstance
- Returns:
- instance of the current class
- Throws:
SQLException- if a database error occursExecutionException- if the Async database connection creation failsInterruptedException- if there is a thread fault while obtaining a connection
-
obtainConnection
-
incrementGuildStat
Increment's the given stat for the given guild- Parameters:
guildId- guild to increment stat forstatType- type of stat to increment
-
incrementGuildStat
Increment's the given stat for the given guild- Parameters:
guildId- guild to increment stat forincrement- amount to increment the statstatType- type of stat to increment
-
getGuildStat
Obtains the given stat for the given guild- Parameters:
guildId- guild to obtain stat forstatType- type of stat to obtain- Throws:
SQLException- if a database error occurs
-
getJdaStat
Obtains the given stat in a global context- Parameters:
statType- type of stat to obtain- Throws:
SQLException- if a database error occurs
-
incrementUserStat
Increments a stat for a specific user- Parameters:
member- to increment stat forstat- 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 forincrement- amount to increment the stat bystat- stat type to increment
-