Interface AbstractDB

All Known Implementing Classes:
SQLManager

public interface AbstractDB
  • Field Details

    • everyone

      static final UUID everyone
      The UUID that will count as EVERYONE.
  • Method Details

    • setOwner

      void setOwner(Plot plot, UUID uuid)
      Sets Plot owner.
      Parameters:
      plot - the plot
      uuid - the uuid of the new owner
    • createPlotsAndData

      void createPlotsAndData(List<Plot> plots, Runnable whenDone)
      Creates all settings, and create default helpers, trusted + denied lists.
      Parameters:
      plots - Plots for which the default table entries should be created
      whenDone - the task to run when the method is finished executing
    • createPlotSafe

      void createPlotSafe(Plot plot, Runnable success, Runnable failure)
      Creates a plot.
      Parameters:
      plot - the plot to create
    • createTables

      void createTables() throws Exception
      Create tables.
      Throws:
      Exception - If the database manager is unable to create the tables
    • delete

      void delete(Plot plot)
      Deletes a plot.
      Parameters:
      plot - the plot to delete
    • deleteSettings

      void deleteSettings(Plot plot)
    • deleteHelpers

      void deleteHelpers(Plot plot)
    • deleteTrusted

      void deleteTrusted(Plot plot)
    • deleteDenied

      void deleteDenied(Plot plot)
      Removes all denied players from the plot.
      Parameters:
      plot - the plot
    • deleteComments

      void deleteComments(Plot plot)
      Deletes all comments from the plot.
      Parameters:
      plot - the plot
    • deleteRatings

      void deleteRatings(Plot plot)
    • delete

      void delete(PlotCluster cluster)
    • addPersistentMeta

      void addPersistentMeta(UUID uuid, String key, byte[] meta, boolean delete)
    • removePersistentMeta

      void removePersistentMeta(UUID uuid, String key)
    • getPersistentMeta

      void getPersistentMeta(UUID uuid, RunnableVal<Map<String,byte[]>> result)
    • createPlotSettings

      void createPlotSettings(int id, Plot plot)
      Creates the plot settings.
      Parameters:
      id - the plot entry id
      plot - the plot
    • getId

      int getId(Plot plot)
      Gets the table entry ID.
      Parameters:
      plot - the plot
      Returns:
      Integer = Plot Entry Id
    • getClusterId

      int getClusterId(PlotCluster cluster)
      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

      void validateAllPlots(Set<Plot> toValidate)
      Parameters:
      toValidate -
    • getClusters

      Returns:
      A HashMap containing all plot clusters
    • setMerged

      void setMerged(Plot plot, boolean[] merged)
      Sets the merged status for a plot.
      Parameters:
      plot - The plot to set the merged status of
      merged - boolean[]
    • swapPlots

      Swaps the settings, helpers etc. of two plots.
      Parameters:
      plot1 - Plot1
      plot2 - Plot2
    • setFlag

      void setFlag(Plot plot, PlotFlag<?,?> flag)
      Sets plot flag.
      Parameters:
      plot - Plot Object
      flag - Flag to set
    • removeFlag

      void removeFlag(Plot plot, PlotFlag<?,?> flag)
      Remove a plot flag.
      Parameters:
      plot - Plot Object
      flag - Flag to remove
    • setClusterName

      void setClusterName(PlotCluster cluster, String name)
      Renames a cluster to the given name.
      Parameters:
      cluster - the cluster to rename
      name - the new cluster name
    • setAlias

      void setAlias(Plot plot, String alias)
      Sets the plot alias.
      Parameters:
      plot - Plot for which the alias should be set
      alias - Plot Alias
    • purgeIds

      void purgeIds(Set<Integer> uniqueIds)
      Purges a plot.
      Parameters:
      uniqueIds - list of plot id (db) to be purged
    • purge

      void purge(PlotArea area, Set<PlotId> plotIds)
      Purges a whole world.
      Parameters:
      area - World in which the plots should be purged
      plotIds - the PlotIds of Plots to purge
    • setPosition

      void setPosition(Plot plot, String position)
      Sets the plot home position.
      Parameters:
      plot - the plot
      position - the position of plot home
    • setPosition

      void setPosition(PlotCluster cluster, String position)
      Parameters:
      cluster -
      position -
    • removeTrusted

      void removeTrusted(Plot plot, UUID uuid)
      Remove the specified player from the trust list of the specified plot.
      Parameters:
      plot - the plot
      uuid - the uuid of the player to remove
    • removeHelper

      void removeHelper(PlotCluster cluster, UUID uuid)
      Parameters:
      cluster - PlotCluster Object
      uuid - Player that should be removed
    • removeMember

      void removeMember(Plot plot, UUID uuid)
      Parameters:
      plot - the plot
      uuid - Player that should be removed
    • removeInvited

      void removeInvited(PlotCluster cluster, UUID uuid)
      Parameters:
      cluster -
      uuid -
    • setTrusted

      void setTrusted(Plot plot, UUID uuid)
      Parameters:
      plot - Plot Object
      uuid - Player that should be removed
    • setHelper

      void setHelper(PlotCluster cluster, UUID uuid)
      Parameters:
      cluster - PlotCluster Object
      uuid - Player that should be removed
    • setMember

      void setMember(Plot plot, UUID uuid)
      Parameters:
      plot - Plot Object
      uuid - Player that should be added
    • setInvited

      void setInvited(PlotCluster cluster, UUID uuid)
      Parameters:
      cluster -
      uuid -
    • removeDenied

      void removeDenied(Plot plot, UUID uuid)
      Removes the specified player from the denied list of the specified plot.
      Parameters:
      plot - the plot
      uuid - the uuid of the player to remove
    • setDenied

      void setDenied(Plot plot, UUID uuid)
      Denies the specified player from the given plot.
      Parameters:
      plot - the plot
      uuid - 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

      void setRating(Plot plot, UUID rater, int value)
      Sets a rating for a plot.
      Parameters:
      plot -
      rater -
      value -
    • removeComment

      void removeComment(Plot plot, PlotComment comment)
      Removes the specified comment from the given plot.
      Parameters:
      plot - the plot
      comment - the comment to remove
    • clearInbox

      void clearInbox(Plot plot, String inbox)
      Clears the specified inbox on the given plot.
      Parameters:
      plot - the plot
      inbox - the inbox to clear
    • setComment

      void setComment(Plot plot, PlotComment comment)
      Adds the specified comment to the given plot.
      Parameters:
      plot - the plot
      comment - the comment to add
    • getComments

      void getComments(@NonNull Plot plot, String inbox, RunnableVal<List<PlotComment>> whenDone)
      Gets Plot comments.
      Parameters:
      plot - The Plot to get comments from
    • createPlotAndSettings

      void createPlotAndSettings(Plot plot, Runnable whenDone)
    • createCluster

      void createCluster(PlotCluster cluster)
    • resizeCluster

      void resizeCluster(PlotCluster current, PlotId min, PlotId max)
    • movePlot

      void movePlot(Plot originalPlot, Plot newPlot)
    • replaceUUID

      void replaceUUID(UUID old, UUID now)
      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

      void replaceWorld(String oldWorld, String newWorld, PlotId min, PlotId max)
    • updateTables

      void updateTables(int[] oldVersion)