Class DBFunc

java.lang.Object
com.plotsquared.core.database.DBFunc

public class DBFunc extends Object
Database Functions - These functions do not update the local plot objects and only make changes to the DB
  • Field Details

    • EVERYONE

      public static final UUID EVERYONE
      The "global" uuid.
    • SERVER

      public static final UUID SERVER
    • dbManager

      public static AbstractDB dbManager
      Abstract Database Manager
  • Constructor Details

    • DBFunc

      public DBFunc()
  • Method Details

    • updateTables

      public static void updateTables(int[] oldVersion)
    • addPersistentMeta

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

      public static void getPersistentMeta(UUID uuid, RunnableVal<Map<String,​byte[]>> result)
    • removePersistentMeta

      public static void removePersistentMeta(UUID uuid, String key)
    • swapPlots

      public static CompletableFuture<Boolean> swapPlots(Plot plot1, Plot plot2)
    • deleteTables

      public static boolean deleteTables()
    • movePlot

      public static void movePlot(Plot originalPlot, Plot newPlot)
    • validatePlots

      public static void validatePlots(Set<Plot> plots)
    • hasColumn

      @Deprecated public static boolean hasColumn(ResultSet resultSet, String name)
      Deprecated.
      Check if a ResultSet contains a column.
      Parameters:
      resultSet -
      name -
      Returns:
    • setOwner

      public static void setOwner(Plot plot, UUID uuid)
      Set the owner of a plot
      Parameters:
      plot - Plot Object
      uuid - New Owner
    • createPlotsAndData

      public static void createPlotsAndData(List<Plot> plots, Runnable whenDone)
      Create all settings + (trusted, denied, members)
      Parameters:
      plots - List containing all plot objects
    • createPlotSafe

      public static void createPlotSafe(Plot plot, Runnable success, Runnable failure)
    • createPlotAndSettings

      public static void createPlotAndSettings(Plot plot, Runnable whenDone)
      Create a plot.
      Parameters:
      plot - Plot to create
    • createTables

      public static void createTables() throws Exception
      Create tables.
      Throws:
      Exception
    • delete

      public static void delete(Plot plot)
      Delete a plot.
      Parameters:
      plot - Plot to delete
    • deleteRatings

      public static void deleteRatings(Plot plot)
      Delete the ratings for a plot.
      Parameters:
      plot -
    • deleteTrusted

      public static void deleteTrusted(Plot plot)
      Delete the trusted list for a plot.
      Parameters:
      plot -
    • deleteMembers

      public static void deleteMembers(Plot plot)
      Delete the members list for a plot.
      Parameters:
      plot -
    • deleteDenied

      public static void deleteDenied(Plot plot)
      Delete the denied list for a plot.
      Parameters:
      plot -
    • deleteComments

      public static void deleteComments(Plot plot)
      Delete the comments in a plot.
      Parameters:
      plot -
    • deleteSettings

      public static void deleteSettings(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 db

      This shouldn't ever be needed

      Parameters:
      plot -
    • delete

      public static void delete(PlotCluster toDelete)
    • createPlotSettings

      public static void createPlotSettings(int id, Plot plot)
      Create plot settings.
      Parameters:
      id - Plot ID
      plot - Plot Object
    • getId

      public static int getId(Plot plot)
      Get a plot id.
      Parameters:
      plot - Plot Object
      Returns:
      ID
    • getPlots

      public static HashMap<String,​HashMap<PlotId,​Plot>> getPlots()
      Returns:
      Plots
    • setMerged

      public static void setMerged(Plot plot, boolean[] merged)
    • setFlag

      public static void setFlag(Plot plot, PlotFlag<?,​?> flag)
    • removeFlag

      public static void removeFlag(Plot plot, PlotFlag<?,​?> flag)
    • setAlias

      public static void setAlias(Plot plot, String alias)
      Parameters:
      plot -
      alias -
    • purgeIds

      public static void purgeIds(Set<Integer> uniqueIds)
    • purge

      public static void purge(PlotArea area, Set<PlotId> plotIds)
    • setPosition

      public static void setPosition(Plot plot, String position)
      Parameters:
      plot -
      position -
    • removeComment

      public static void removeComment(Plot plot, PlotComment comment)
      Parameters:
      plot -
      comment -
    • clearInbox

      public static void clearInbox(Plot plot, String inbox)
    • setComment

      public static void setComment(Plot plot, PlotComment comment)
      Parameters:
      plot -
      comment -
    • getComments

      public static void getComments(Plot plot, String inbox, RunnableVal<List<PlotComment>> whenDone)
      Parameters:
      plot -
    • removeTrusted

      public static void removeTrusted(Plot plot, UUID uuid)
      Parameters:
      plot -
      uuid -
    • removeHelper

      public static void removeHelper(PlotCluster cluster, UUID uuid)
      Parameters:
      cluster -
      uuid -
    • createCluster

      public static void createCluster(PlotCluster cluster)
      Parameters:
      cluster -
    • resizeCluster

      public static void resizeCluster(PlotCluster current, PlotId min, PlotId max)
      Parameters:
      current -
      min -
      max -
    • removeMember

      public static void removeMember(Plot plot, UUID uuid)
      Parameters:
      plot -
      uuid -
    • removeInvited

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

      public static void setTrusted(Plot plot, UUID uuid)
      Parameters:
      plot -
      uuid -
    • setHelper

      public static void setHelper(PlotCluster cluster, UUID uuid)
    • setMember

      public static void setMember(Plot plot, UUID uuid)
      Parameters:
      plot -
      uuid -
    • setInvited

      public static void setInvited(PlotCluster cluster, UUID uuid)
    • removeDenied

      public static void removeDenied(Plot plot, UUID uuid)
      Parameters:
      plot -
      uuid -
    • setDenied

      public static void setDenied(Plot plot, UUID uuid)
      Parameters:
      plot -
      uuid -
    • getRatings

      public static HashMap<UUID,​Integer> getRatings(Plot plot)
    • setRating

      public static void setRating(Plot plot, UUID rater, int value)
    • getClusters

      public static HashMap<String,​Set<PlotCluster>> getClusters()
    • setPosition

      public static void setPosition(PlotCluster cluster, String position)
    • replaceWorld

      public static void replaceWorld(String oldWorld, String newWorld, PlotId min, PlotId max)
    • replaceUUID

      public static void replaceUUID(UUID old, UUID now)
      Replace all occurrences of a uuid in the database with another one
      Parameters:
      old -
      now -
    • close

      public static void close()