Package xyz.geik.farmer.database
Class SQL
java.lang.Object
xyz.geik.farmer.database.SQL
SQL Queries and abstracted methods exist in this class
- Since:
- b000
- Author:
- Amowny
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addUser
(@NotNull UUID uuid, String name, FarmerPerm perm, int farmerId) Adds user to farmer in sql onlyvoid
addUser
(UUID uuid, String name, FarmerPerm perm, @NotNull Farmer farmer) Adds user to farmer in sqlprotected void
closeConnections
(PreparedStatement preparedStatement, Connection connection, ResultSet resultSet) Closes connection of sqlvoid
createFarmer
(@NotNull Farmer farmer) Creates farmer on sqlabstract void
Creates table on dbvoid
Fix database methodabstract DatabaseType
Database type of sqlvoid
Loads all farmer data from sql to cachevoid
removeFarmer
(@NotNull Farmer farmer) Removes farmer from sqlboolean
removeUser
(@NotNull User user, Farmer farmer) Removes user from farmer in sqlvoid
saveFarmer
(@NotNull Farmer farmer) Saves farmer syncvoid
Updates all farmers which saves all data of farmers on cachevoid
Does same thing with #updateAllFarmers asyncvoid
updateRole
(UUID uuid, int roleId, int farmerId) Updates role of player
-
Constructor Details
-
SQL
public SQL()Constructor of class
-
-
Method Details
-
createTable
public abstract void createTable()Creates table on db -
updateAllFarmers
public void updateAllFarmers()Updates all farmers which saves all data of farmers on cache -
updateAllFarmersAsync
public void updateAllFarmersAsync()Does same thing with #updateAllFarmers async -
loadAllFarmers
public void loadAllFarmers()Loads all farmer data from sql to cache -
createFarmer
Creates farmer on sql- Parameters:
farmer
- temp farmer
-
removeFarmer
Removes farmer from sql- Parameters:
farmer
- object of farmer
-
saveFarmer
Saves farmer sync- Parameters:
farmer
- farmer object
-
addUser
Adds user to farmer in sql- Parameters:
uuid
- uuid of playername
- name of playerperm
- perm of playerfarmer
- farmer of region
-
addUser
Adds user to farmer in sql only- Parameters:
uuid
- of playername
- of playerperm
- of player perm FarmerPerm#permfarmerId
- id of farmer
-
removeUser
Removes user from farmer in sql- Parameters:
user
- user objectfarmer
- of region- Returns:
- status of task
-
updateRole
Updates role of player- Parameters:
uuid
- uuid of playerroleId
- roleId of player (FarmerPerm#getRole)farmerId
- id of farmer
-
getDatabaseType
Database type of sql- Returns:
- DatabaseType object
-
closeConnections
protected void closeConnections(PreparedStatement preparedStatement, Connection connection, ResultSet resultSet) Closes connection of sql- Parameters:
preparedStatement
- statementconnection
- connectionresultSet
- resultSet
-
fixDatabase
public void fixDatabase()Fix database methodFixes users and owners if there is any corruption occurred in older versions or blackouts.
-