Package com.plotsquared.core.database
Class DBFunc
java.lang.Object
com.plotsquared.core.database.DBFunc
Database Functions
- These functions do not update the local plot objects and only make changes to the DB
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddPersistentMeta(UUID uuid, String key, byte[] meta, boolean delete) static voidclearInbox(Plot plot, String inbox) static voidclose()static voidcreateCluster(PlotCluster cluster) static voidcreatePlotAndSettings(Plot plot, Runnable whenDone) Create a plot.static voidcreatePlotSafe(Plot plot, Runnable success, Runnable failure) static voidcreatePlotsAndData(List<Plot> plots, Runnable whenDone) Create all settings + (trusted, denied, members)static voidcreatePlotSettings(int id, Plot plot) Create plot settings.static voidCreate tables.static voidDelete a plot.static voiddelete(PlotCluster toDelete) static voiddeleteComments(Plot plot) Delete the comments in a plot.static voiddeleteDenied(Plot plot) Delete the denied list for a plot.static voiddeleteMembers(Plot plot) Delete the members list for a plot.static voiddeleteRatings(Plot plot) Delete the ratings for a plot.static voiddeleteSettings(Plot plot) Deleting settings will 1) Delete any settings (flags and such) associated with the plot 2) Prevent any local changes to the plot from saving properly to the dbstatic booleanstatic voiddeleteTrusted(Plot plot) Delete the trusted list for a plot.static HashMap<String,Set<PlotCluster>> static voidgetComments(Plot plot, String inbox, RunnableVal<List<PlotComment>> whenDone) static intGet a plot id.static voidgetPersistentMeta(UUID uuid, RunnableVal<Map<String, byte[]>> result) getPlots()getRatings(Plot plot) static booleanDeprecated.static voidstatic voidstatic voidstatic voidremoveComment(Plot plot, PlotComment comment) static voidremoveDenied(Plot plot, UUID uuid) static voidremoveFlag(Plot plot, PlotFlag<?, ?> flag) static voidremoveHelper(PlotCluster cluster, UUID uuid) static voidremoveInvited(PlotCluster cluster, UUID uuid) static voidremoveMember(Plot plot, UUID uuid) static voidremovePersistentMeta(UUID uuid, String key) static voidremoveTrusted(Plot plot, UUID uuid) static voidreplaceUUID(UUID old, UUID now) Replace all occurrences of a uuid in the database with another onestatic voidreplaceWorld(String oldWorld, String newWorld, PlotId min, PlotId max) static voidresizeCluster(PlotCluster current, PlotId min, PlotId max) static voidstatic voidsetComment(Plot plot, PlotComment comment) static voidstatic voidstatic voidsetHelper(PlotCluster cluster, UUID uuid) static voidsetInvited(PlotCluster cluster, UUID uuid) static voidstatic voidstatic voidSet the owner of a plotstatic voidsetPosition(PlotCluster cluster, String position) static voidsetPosition(Plot plot, String position) static voidstatic voidsetTrusted(Plot plot, UUID uuid) static CompletableFuture<Boolean>static voidupdateTables(int[] oldVersion) static voidvalidatePlots(Set<Plot> plots)
-
Field Details
-
EVERYONE
The "global" uuid. -
SERVER
-
dbManager
Abstract Database Manager
-
-
Constructor Details
-
DBFunc
public DBFunc()
-
-
Method Details
-
updateTables
public static void updateTables(int[] oldVersion) -
addPersistentMeta
-
getPersistentMeta
-
removePersistentMeta
-
swapPlots
-
deleteTables
public static boolean deleteTables() -
movePlot
-
validatePlots
-
hasColumn
Deprecated.Check if aResultSetcontains a column.- Parameters:
resultSet-name-- Returns:
-
setOwner
Set the owner of a plot- Parameters:
plot- Plot Objectuuid- New Owner
-
createPlotsAndData
Create all settings + (trusted, denied, members)- Parameters:
plots- List containing all plot objects
-
createPlotSafe
-
createPlotAndSettings
Create a plot.- Parameters:
plot- Plot to create
-
createTables
Create tables.- Throws:
Exception
-
delete
Delete a plot.- Parameters:
plot- Plot to delete
-
deleteRatings
Delete the ratings for a plot.- Parameters:
plot-
-
deleteTrusted
Delete the trusted list for a plot.- Parameters:
plot-
-
deleteMembers
Delete the members list for a plot.- Parameters:
plot-
-
deleteDenied
Delete the denied list for a plot.- Parameters:
plot-
-
deleteComments
Delete the comments in a plot.- Parameters:
plot-
-
deleteSettings
Deleting settings will 1) Delete any settings (flags and such) associated with the plot 2) Prevent any local changes to the plot from saving properly to the dbThis shouldn't ever be needed
- Parameters:
plot-
-
delete
-
createPlotSettings
Create plot settings.- Parameters:
id- Plot IDplot- Plot Object
-
getId
Get a plot id.- Parameters:
plot- Plot Object- Returns:
- ID
-
getPlots
- Returns:
- Plots
-
setMerged
-
setFlag
-
removeFlag
-
setAlias
- Parameters:
plot-alias-
-
purgeIds
-
purge
-
setPosition
- Parameters:
plot-position-
-
removeComment
- Parameters:
plot-comment-
-
clearInbox
-
setComment
- Parameters:
plot-comment-
-
getComments
- Parameters:
plot-
-
removeTrusted
- Parameters:
plot-uuid-
-
removeHelper
- Parameters:
cluster-uuid-
-
createCluster
- Parameters:
cluster-
-
resizeCluster
- Parameters:
current-min-max-
-
removeMember
- Parameters:
plot-uuid-
-
removeInvited
- Parameters:
cluster-uuid-
-
setTrusted
- Parameters:
plot-uuid-
-
setHelper
-
setMember
- Parameters:
plot-uuid-
-
setInvited
-
removeDenied
- Parameters:
plot-uuid-
-
setDenied
- Parameters:
plot-uuid-
-
getRatings
-
setRating
-
getClusters
-
setPosition
-
replaceWorld
-
replaceUUID
Replace all occurrences of a uuid in the database with another one- Parameters:
old-now-
-
close
public static void close()
-