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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUser(@NotNull UUID uuid, String name, FarmerPerm perm, int farmerId) Adds user to farmer in sql onlyvoidaddUser(UUID uuid, String name, FarmerPerm perm, @NotNull Farmer farmer) Adds user to farmer in sqlprotected voidcloseConnections(PreparedStatement preparedStatement, Connection connection, ResultSet resultSet) Closes connection of sqlvoidcreateFarmer(@NotNull Farmer farmer, UUID ownerUUID) Creates farmer on sqlabstract voidCreates table on dbvoidFix database methodabstract DatabaseTypeDatabase type of sqlvoidLoads all farmer data from sql to cachevoidremoveFarmer(@NotNull Farmer farmer, UUID ownerUUID) Removes farmer from sqlbooleanremoveUser(@NotNull User user, Farmer farmer) Removes user from farmer in sqlvoidsaveFarmer(@NotNull Farmer farmer) Saves farmer syncvoidUpdates all farmers which saves all data of farmers on cachevoidDoes same thing with #updateAllFarmers asyncvoidupdateRole(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.
-