Package com.plotsquared.core
Class PlotSquared
java.lang.Object
com.plotsquared.core.PlotSquared
An implementation of the core, with a static getter for easy access.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPlotSquared
(@NonNull PlotPlatform<?> iPlotMain, @NonNull String platform) Initialize PlotSquared with the desired Implementation class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPlotArea
(@NonNull PlotArea plotArea) Add a global reference to a plot world.boolean
checkVersion
(int[] version, int... version2) Check if `version` is >= `version2`.void
Copies a file from inside the jar to a locationvoid
disable()
Safely closes the database connection.void
forEachPlotRaw
(@NonNull Consumer<Plot> consumer) static @NonNull PlotSquared
get()
Gets an instance of PlotSquared.getCaptionMap
(@NonNull String namespace) Get the caption map belonging to a namespace.getClusters
(@NonNull String world) Gets the server platform this plugin is running on this is running on.Get the platform specificPlotAreaManager
instanceGets the current PlotSquared version.boolean
isMainThread
(@NonNull Thread thread) boolean
isNonStandardGeneration
(@NonNull String world, @NonNull BlockVector2 chunkCoordinates) Check if the chunk uses vanilla/non-PlotSquared generationvoid
void
loadWorld
(@NonNull String world, @Nullable GeneratorWrapper<?> baseGenerator) This method is called by the PlotGenerator class normally.static @NonNull PlotPlatform<?>
platform()
Get the platform specific implementation of PlotSquaredvoid
registerCaptionMap
(@NonNull String namespace, @NonNull CaptionMap captionMap) Register a caption map.boolean
removePlot
(@NonNull Plot plot, boolean callEvent) Unregisters a plot from local memory without calling the database.void
removePlotArea
(@NonNull PlotArea area) Remove a plot world reference.void
removePlotAreas
(@NonNull String world) void
setConfigurationVersion
(@NonNull String newVersion) void
void
Setup the default configuration.boolean
Setup all configuration files
- Config: settings.yml
- Storage: storage.ymlvoid
Setup the database connection.boolean
setupPlotWorld
(@NonNull String world, @Nullable String args, @NonNull IndependentPlotGenerator generator) Setup the configuration for a plot world based on world arguments.sortPlots
(@NonNull Collection<Plot> plots, @NonNull PlotSquared.SortType type, @Nullable PlotArea priorityArea) Sort a collection of plots by world (with a priority world), then by hashcode.sortPlotsByTemp
(Collection<Plot> plots) void
-
Field Details
-
plots_tmp
-
-
Constructor Details
-
PlotSquared
Initialize PlotSquared with the desired Implementation class.- Parameters:
iPlotMain
- Implementation ofPlotPlatform
usedplatform
- The platform being used
-
-
Method Details
-
get
Gets an instance of PlotSquared.- Returns:
- instance of PlotSquared
-
platform
Get the platform specific implementation of PlotSquared- Returns:
- Platform implementation
-
loadCaptionMap
- Throws:
Exception
-
getPlotAreaManager
Get the platform specificPlotAreaManager
instance- Returns:
- Plot area manager
-
startExpiryTasks
public void startExpiryTasks() -
isMainThread
-
checkVersion
public boolean checkVersion(int[] version, int... version2) Check if `version` is >= `version2`.- Parameters:
version
- First versionversion2
- Second version- Returns:
true
if `version` is >= `version2`
-
getVersion
Gets the current PlotSquared version.- Returns:
- current version in config or null
-
getPlatform
Gets the server platform this plugin is running on this is running on.This will be either Bukkit or Sponge
- Returns:
- the server implementation
-
addPlotArea
Add a global reference to a plot world.You can remove the reference by calling
removePlotArea(PlotArea)
- Parameters:
plotArea
- thePlotArea
to add.
-
removePlotArea
Remove a plot world reference.- Parameters:
area
- thePlotArea
to remove
-
removePlotAreas
-
getClusters
-
sortPlotsByTemp
-
sortPlots
public @NonNull List<Plot> sortPlots(@NonNull Collection<Plot> plots, @NonNull PlotSquared.SortType type, @Nullable PlotArea priorityArea) Sort a collection of plots by world (with a priority world), then by hashcode.- Parameters:
plots
- the plots to sorttype
- The sorting method to use for each world (timestamp, or hash)priorityArea
- Use null, "world", or "gibberish" if you want default world order- Returns:
- ArrayList of plot
-
setPlots
-
removePlot
Unregisters a plot from local memory without calling the database.- Parameters:
plot
- the plot to removecallEvent
- If to call an event about the plot being removed- Returns:
true
if plot existed |false
if it didn't
-
loadWorld
This method is called by the PlotGenerator class normally.- Initializes the PlotArea and PlotManager classes
- Registers the PlotArea and PlotManager classes
- Loads (and/or generates) the PlotArea configuration
- Sets up the world border if configured
If loading an augmented plot world:
- Creates the AugmentedPopulator classes
- Injects the AugmentedPopulator classes if required
- Parameters:
world
- the world to loadbaseGenerator
- The generator for that world, or null
-
setupPlotWorld
public boolean setupPlotWorld(@NonNull String world, @Nullable String args, @NonNull IndependentPlotGenerator generator) Setup the configuration for a plot world based on world arguments. e.g. /mv create <world> normal -g PlotSquared:<args>- Parameters:
world
- The name of the worldargs
- The argumentsgenerator
- the plot generator- Returns:
- boolean | if valid arguments were provided
-
copyFile
Copies a file from inside the jar to a location- Parameters:
file
- Name of the file inside PlotSquared.jarfolder
- The output location relative to /plugins/PlotSquared/
-
disable
public void disable()Safely closes the database connection. -
setupDatabase
public void setupDatabase()Setup the database connection. -
setupConfig
public void setupConfig()Setup the default configuration. -
setupConfigs
public boolean setupConfigs()Setup all configuration files
- Config: settings.yml
- Storage: storage.yml- Returns:
- success or not
-
getConfigurationVersion
-
setConfigurationVersion
- Throws:
IOException
-
forEachPlotRaw
-
isNonStandardGeneration
public boolean isNonStandardGeneration(@NonNull String world, @NonNull BlockVector2 chunkCoordinates) Check if the chunk uses vanilla/non-PlotSquared generation- Parameters:
world
- World namechunkCoordinates
- Chunk coordinates- Returns:
true
if the chunk uses non-standard generation,false
if not
-
getConfig
-
getImpromptuUUIDPipeline
-
getBackgroundUUIDPipeline
-
getWorldEdit
-
getConfigFile
-
getWorldsFile
-
getWorldConfiguration
-
getCaptionMap
Get the caption map belonging to a namespace. If none exists, a dummy caption map will be returned.You can register a caption map by calling
registerCaptionMap(String, CaptionMap)
- Parameters:
namespace
- Namespace- Returns:
- Map instance
-
getEventDispatcher
-
getPlotListener
-