me.armar.plugins.autorank.mysql.wrapper
Class MySQLWrapper
java.lang.Object
me.armar.plugins.autorank.mysql.wrapper.MySQLWrapper
public class MySQLWrapper
- extends java.lang.Object
This class keeps all incoming and outgoing under control.
It sends MySQL queries and can locate the database.
Previously, Playtimes kept all
MySQL, but it wasn't neatly organised.
MySQLWrapper class is (hopefully) fail-prove and organised.
This also has a fail-safe when two queries are altering at the same time.
- Author:
- Staartvin
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
plugin
private Autorank plugin
mysql
private SQLDataStorage mysql
hostname
java.lang.String hostname
username
java.lang.String username
password
java.lang.String password
database
java.lang.String database
table
java.lang.String table
databaseTime
int databaseTime
timeThread
java.lang.Thread timeThread
MySQLWrapper
public MySQLWrapper(Autorank instance)
setupTable
public void setupTable()
waitForThread
private void waitForThread(java.lang.Thread thread)
- Because the MySQL queries are done async, we need to wait for the result. Otherwise it would be cached and out of date.
This waits for the thread to die and then it will continue
Use this whenever you do an async MySQL thread.
sqlSetup
public void sqlSetup(SimpleYamlConfiguration config)
getDatabaseTime
public int getDatabaseTime(java.lang.String name)
- Gets the database time of player
Run this ASYNC!
- Parameters:
name - Playername to get the time of
- Returns:
- time player has played across all servers
setGlobalTime
public void setGlobalTime(java.lang.String playerName,
int time)
- Sets the time of a player
- Parameters:
playerName - Player to set the time oftime - Time to change to
isMySQLEnabled
public boolean isMySQLEnabled()
getDatabaseName
public java.lang.String getDatabaseName()