Modifier and Type | Field and Description |
---|---|
protected ActionsTable |
actionsTable
Table representing plan_actions in the database.
|
protected CommandUseTable |
commandUseTable
Table representing plan_commandusages in the database.
|
protected org.apache.commons.dbcp2.BasicDataSource |
dataSource |
protected IPsTable |
ipsTable
Table representing plan_ips in the database.
|
protected KillsTable |
killsTable
Table representing plan_kills in the database.
|
protected NicknamesTable |
nicknamesTable
Table representing plan_nicknames in the database.
|
protected IPlan |
plugin
Instance of Plan used with this database.
|
protected SecurityTable |
securityTable
Table representing plan_security in the database.
|
protected ServerTable |
serverTable
Table representing plan_servers in the database.
|
protected SessionsTable |
sessionsTable
Table representing plan_sessions in the database.
|
protected TPSTable |
tpsTable
Table representing plan_tps in the database.
|
protected UserInfoTable |
userInfoTable
Table representing plan_user_info in the database.
|
protected UsersTable |
usersTable
Table representing plan_users in the database.
|
protected VersionTable |
versionTable
Table representing plan_version in the database.
|
protected WorldTable |
worldTable
Table representing plan_worlds in the database.
|
protected WorldTimesTable |
worldTimesTable
Table representing plan_world_times in the database.
|
Constructor and Description |
---|
Database(IPlan plugin)
Super constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Closes the database and it's resources.
|
abstract void |
commit(Connection connection) |
ActionsTable |
getActionsTable() |
Map<String,Integer> |
getCommandUse()
Used to get the Command usage mep.
|
CommandUseTable |
getCommandUseTable()
Used to get the command usage table.
|
String |
getConfigName()
Used to get the config name of the database type.
|
org.apache.commons.dbcp2.BasicDataSource |
getDataSource() |
IPsTable |
getIpsTable()
Used to get the ips table.
|
KillsTable |
getKillsTable()
Used to get the kills table.
|
abstract String |
getName()
Used to get the name of the database type.
|
NicknamesTable |
getNicknamesTable()
Used to get the nicknames table.
|
Set<UUID> |
getSavedUUIDs()
Used to fetch the saved UUIDs in the users table.
|
SecurityTable |
getSecurityTable()
Used to get the security table.
|
ServerTable |
getServerTable() |
SessionsTable |
getSessionsTable()
Used to get the users table.
|
TPSTable |
getTpsTable()
Used to get the tps table.
|
UserInfoTable |
getUserInfoTable() |
UsersTable |
getUsersTable()
Used to get the users table.
|
abstract int |
getVersion()
Used to get the database schema version.
|
WorldTable |
getWorldTable()
Used to get the worlds table.
|
WorldTimesTable |
getWorldTimesTable()
Used to get the world times table.
|
void |
init()
Initiates the database.
|
abstract boolean |
isNewDatabase() |
boolean |
isUsingMySQL() |
abstract void |
removeAccount(UUID uuid)
Removes all data related to an account from the database.
|
abstract void |
removeAllData()
Used to clear all data from the database.
|
abstract void |
setVersion(int version)
Used to set the database schema version.
|
abstract boolean |
wasSeenBefore(UUID uuid)
Check if the user is saved in the database.
|
protected final IPlan plugin
protected UsersTable usersTable
protected UserInfoTable userInfoTable
protected ActionsTable actionsTable
protected KillsTable killsTable
protected NicknamesTable nicknamesTable
protected SessionsTable sessionsTable
protected IPsTable ipsTable
protected CommandUseTable commandUseTable
protected TPSTable tpsTable
protected VersionTable versionTable
protected SecurityTable securityTable
protected WorldTable worldTable
protected WorldTimesTable worldTimesTable
protected ServerTable serverTable
protected org.apache.commons.dbcp2.BasicDataSource dataSource
public Database(IPlan plugin)
plugin
- current instance of Plan.public void init() throws DatabaseInitException
DatabaseInitException
- if SQLException or other exception occurs.public abstract boolean wasSeenBefore(UUID uuid)
uuid
- UUID of the user.public abstract String getName()
Thread safe.
public String getConfigName()
Thread safe.
public abstract boolean isNewDatabase() throws SQLException
SQLException
public abstract int getVersion() throws SQLException
SQLException
- If a database error occurs.public abstract void setVersion(int version) throws SQLException
version
- Integer starting from 0, incremented by one when schema is
updated.SQLException
- If a database error occurs.public abstract void close() throws SQLException
SQLException
- If a database error occurs.public abstract void removeAccount(UUID uuid) throws SQLException
uuid
- UUID of the account.SQLException
- If a database error occurs.public abstract void removeAllData() throws SQLException
Uses DELETE * FROM table.
SQLException
- if remove fails.public Set<UUID> getSavedUUIDs() throws SQLException
SQLException
- If a database error occurs.public Map<String,Integer> getCommandUse() throws SQLException
SQLException
- If a database error occurs.public UsersTable getUsersTable()
public SessionsTable getSessionsTable()
public KillsTable getKillsTable()
public IPsTable getIpsTable()
public NicknamesTable getNicknamesTable()
public CommandUseTable getCommandUseTable()
public TPSTable getTpsTable()
public SecurityTable getSecurityTable()
public WorldTable getWorldTable()
public WorldTimesTable getWorldTimesTable()
public ServerTable getServerTable()
public ActionsTable getActionsTable()
public UserInfoTable getUserInfoTable()
public org.apache.commons.dbcp2.BasicDataSource getDataSource()
public abstract void commit(Connection connection) throws SQLException
SQLException
public boolean isUsingMySQL()
Copyright © 2017. All rights reserved.