Package com.plotsquared.core.database
Interface AbstractDB
- All Known Implementing Classes:
SQLManager
public interface AbstractDB
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPersistentMeta
(UUID uuid, String key, byte[] meta, boolean delete) void
clearInbox
(Plot plot, String inbox) Clears the specified inbox on the given plot.void
close()
Closes the database.boolean
void
createCluster
(PlotCluster cluster) void
createPlotAndSettings
(Plot plot, Runnable whenDone) void
createPlotSafe
(Plot plot, Runnable success, Runnable failure) Creates a plot.void
createPlotsAndData
(List<Plot> plots, Runnable whenDone) Creates all settings, and create default helpers, trusted + denied lists.void
createPlotSettings
(int id, Plot plot) Creates the plot settings.void
Create tables.void
Deletes a plot.void
delete
(PlotCluster cluster) void
deleteComments
(Plot plot) Deletes all comments from the plot.void
deleteDenied
(Plot plot) Removes all denied players from the plot.void
deleteHelpers
(Plot plot) void
deleteRatings
(Plot plot) void
deleteSettings
(Plot plot) boolean
Don't use this method unless you want to ruin someone's server.void
deleteTrusted
(Plot plot) int
getClusterId
(PlotCluster cluster) Gets the id of a given plot cluster.void
getComments
(@NonNull Plot plot, String inbox, RunnableVal<List<PlotComment>> whenDone) Gets Plot comments.int
Gets the table entry ID.void
getPersistentMeta
(UUID uuid, RunnableVal<Map<String, byte[]>> result) getPlots()
getRatings
(Plot plot) Gets the ratings from the specified plot.void
void
Purges a whole world.void
Purges a plot.void
removeComment
(Plot plot, PlotComment comment) Removes the specified comment from the given plot.void
removeDenied
(Plot plot, UUID uuid) Removes the specified player from the denied list of the specified plot.void
removeFlag
(Plot plot, PlotFlag<?, ?> flag) Remove a plot flag.void
removeHelper
(PlotCluster cluster, UUID uuid) void
removeInvited
(PlotCluster cluster, UUID uuid) void
removeMember
(Plot plot, UUID uuid) void
removePersistentMeta
(UUID uuid, String key) void
removeTrusted
(Plot plot, UUID uuid) Remove the specified player from the trust list of the specified plot.void
replaceUUID
(UUID old, UUID now) Replaces a old uuid with a new one in the database.void
replaceWorld
(String oldWorld, String newWorld, PlotId min, PlotId max) void
resizeCluster
(PlotCluster current, PlotId min, PlotId max) void
Sets the plot alias.void
setClusterName
(PlotCluster cluster, String name) Renames a cluster to the given name.void
setComment
(Plot plot, PlotComment comment) Adds the specified comment to the given plot.void
Denies the specified player from the given plot.void
Sets plot flag.void
setHelper
(PlotCluster cluster, UUID uuid) void
setInvited
(PlotCluster cluster, UUID uuid) void
void
Sets the merged status for a plot.void
Sets Plot owner.void
setPosition
(PlotCluster cluster, String position) void
setPosition
(Plot plot, String position) Sets the plot home position.void
Sets a rating for a plot.void
setTrusted
(Plot plot, UUID uuid) Swaps the settings, helpers etc.void
updateTables
(int[] oldVersion) void
validateAllPlots
(Set<Plot> toValidate)
-
Field Details
-
everyone
The UUID that will count as EVERYONE.
-
-
Method Details
-
setOwner
Sets Plot owner.- Parameters:
plot
- the plotuuid
- the uuid of the new owner
-
createPlotsAndData
Creates all settings, and create default helpers, trusted + denied lists.- Parameters:
plots
- Plots for which the default table entries should be createdwhenDone
- the task to run when the method is finished executing
-
createPlotSafe
Creates a plot.- Parameters:
plot
- the plot to create
-
createTables
Create tables.- Throws:
Exception
- If the database manager is unable to create the tables
-
delete
Deletes a plot.- Parameters:
plot
- the plot to delete
-
deleteSettings
-
deleteHelpers
-
deleteTrusted
-
deleteDenied
Removes all denied players from the plot.- Parameters:
plot
- the plot
-
deleteComments
Deletes all comments from the plot.- Parameters:
plot
- the plot
-
deleteRatings
-
delete
-
addPersistentMeta
-
removePersistentMeta
-
getPersistentMeta
-
createPlotSettings
Creates the plot settings.- Parameters:
id
- the plot entry idplot
- the plot
-
getId
Gets the table entry ID.- Parameters:
plot
- the plot- Returns:
Integer
= Plot Entry Id
-
getClusterId
Gets the id of a given plot cluster.- Parameters:
cluster
- PlotCluster Object- Returns:
- Integer = Cluster Entry Id
-
convertFlags
boolean convertFlags() -
getPlots
- Returns:
- A linked HashMap containing all plots
-
validateAllPlots
- Parameters:
toValidate
-
-
getClusters
- Returns:
- A HashMap containing all plot clusters
-
setMerged
Sets the merged status for a plot.- Parameters:
plot
- The plot to set the merged status ofmerged
- boolean[]
-
swapPlots
Swaps the settings, helpers etc. of two plots.- Parameters:
plot1
- Plot1plot2
- Plot2
-
setFlag
Sets plot flag.- Parameters:
plot
- Plot Objectflag
- Flag to set
-
removeFlag
Remove a plot flag.- Parameters:
plot
- Plot Objectflag
- Flag to remove
-
setClusterName
Renames a cluster to the given name.- Parameters:
cluster
- the cluster to renamename
- the new cluster name
-
setAlias
Sets the plot alias.- Parameters:
plot
- Plot for which the alias should be setalias
- Plot Alias
-
purgeIds
Purges a plot.- Parameters:
uniqueIds
- list of plot id (db) to be purged
-
purge
Purges a whole world. -
setPosition
Sets the plot home position.- Parameters:
plot
- the plotposition
- the position of plot home
-
setPosition
- Parameters:
cluster
-position
-
-
removeTrusted
Remove the specified player from the trust list of the specified plot.- Parameters:
plot
- the plotuuid
- the uuid of the player to remove
-
removeHelper
- Parameters:
cluster
- PlotCluster Objectuuid
- Player that should be removed
-
removeMember
- Parameters:
plot
- the plotuuid
- Player that should be removed
-
removeInvited
- Parameters:
cluster
-uuid
-
-
setTrusted
- Parameters:
plot
- Plot Objectuuid
- Player that should be removed
-
setHelper
- Parameters:
cluster
- PlotCluster Objectuuid
- Player that should be removed
-
setMember
- Parameters:
plot
- Plot Objectuuid
- Player that should be added
-
setInvited
- Parameters:
cluster
-uuid
-
-
removeDenied
Removes the specified player from the denied list of the specified plot.- Parameters:
plot
- the plotuuid
- the uuid of the player to remove
-
setDenied
Denies the specified player from the given plot.- Parameters:
plot
- the plotuuid
- the uuid of the player to deny
-
getRatings
Gets the ratings from the specified plot.- Parameters:
plot
- the plot- Returns:
- the plot ratings (pre-calculated)
-
setRating
Sets a rating for a plot.- Parameters:
plot
-rater
-value
-
-
removeComment
Removes the specified comment from the given plot.- Parameters:
plot
- the plotcomment
- the comment to remove
-
clearInbox
Clears the specified inbox on the given plot.- Parameters:
plot
- the plotinbox
- the inbox to clear
-
setComment
Adds the specified comment to the given plot.- Parameters:
plot
- the plotcomment
- the comment to add
-
getComments
Gets Plot comments.- Parameters:
plot
- The Plot to get comments from
-
createPlotAndSettings
-
createCluster
-
resizeCluster
-
movePlot
-
replaceUUID
Replaces a old uuid with a new one in the database.- Useful for replacing a few uuids (not the entire database).
- or entire conversion, the uuidconvert command scales better.
- Parameters:
old
-now
-
-
deleteTables
boolean deleteTables()Don't use this method unless you want to ruin someone's server.- Returns:
true
if the tables were deleted,false
when an error is encountered
-
close
void close()Closes the database. Generally not recommended to be used by add-ons. -
replaceWorld
-
updateTables
-