mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Fill out a lot more JavaDoc.
I've left DB stuff alone
This commit is contained in:
parent
a4c9ed90b7
commit
665a72a08f
@ -85,11 +85,13 @@ public interface PlotPlatform<P> extends LocaleHolder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the version of Minecraft that is running.
|
* Gets the version of Minecraft that is running.
|
||||||
|
* @return server version as array of numbers
|
||||||
*/
|
*/
|
||||||
int[] getServerVersion();
|
int[] getServerVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the server implementation name and version
|
* Gets the server implementation name and version
|
||||||
|
* @return server implementationa and version as string
|
||||||
*/
|
*/
|
||||||
String getServerImplementation();
|
String getServerImplementation();
|
||||||
|
|
||||||
|
@ -1313,6 +1313,8 @@ public class PlotSquared {
|
|||||||
* Setup all configuration files<br>
|
* Setup all configuration files<br>
|
||||||
* - Config: settings.yml<br>
|
* - Config: settings.yml<br>
|
||||||
* - Storage: storage.yml<br>
|
* - Storage: storage.yml<br>
|
||||||
|
*
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setupConfigs() {
|
public boolean setupConfigs() {
|
||||||
File folder = new File(this.platform.getDirectory(), "config");
|
File folder = new File(this.platform.getDirectory(), "config");
|
||||||
|
@ -126,10 +126,10 @@ public class Auto extends SubCommand {
|
|||||||
/**
|
/**
|
||||||
* Teleport the player home, or claim a new plot
|
* Teleport the player home, or claim a new plot
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player player
|
||||||
* @param area
|
* @param area plot area
|
||||||
* @param start
|
* @param start start id
|
||||||
* @param schematic
|
* @param schematic schematic
|
||||||
*/
|
*/
|
||||||
public static void homeOrAuto(final PlotPlayer player, final PlotArea area, PlotId start,
|
public static void homeOrAuto(final PlotPlayer player, final PlotArea area, PlotId start,
|
||||||
final String schematic) {
|
final String schematic) {
|
||||||
@ -145,10 +145,10 @@ public class Auto extends SubCommand {
|
|||||||
/**
|
/**
|
||||||
* Claim a new plot for a player
|
* Claim a new plot for a player
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player player
|
||||||
* @param area
|
* @param area plot area
|
||||||
* @param start
|
* @param start start id
|
||||||
* @param schematic
|
* @param schematic schematic
|
||||||
*/
|
*/
|
||||||
public static void autoClaimSafe(final PlotPlayer<?> player, final PlotArea area, PlotId start,
|
public static void autoClaimSafe(final PlotPlayer<?> player, final PlotArea area, PlotId start,
|
||||||
final String schematic) {
|
final String schematic) {
|
||||||
|
@ -283,6 +283,7 @@ public abstract class Command {
|
|||||||
* @param player Caller
|
* @param player Caller
|
||||||
* @param args Arguments
|
* @param args Arguments
|
||||||
* @param confirm Instance, Success, Failure
|
* @param confirm Instance, Success, Failure
|
||||||
|
* @param whenDone task to run when done
|
||||||
* @return CompletableFuture true if the command executed fully, false in
|
* @return CompletableFuture true if the command executed fully, false in
|
||||||
* any other case
|
* any other case
|
||||||
*/
|
*/
|
||||||
|
@ -48,6 +48,7 @@ public interface CommandCaller {
|
|||||||
* Check the player's permissions. <i>Will be cached if permission caching is enabled.</i>
|
* Check the player's permissions. <i>Will be cached if permission caching is enabled.</i>
|
||||||
*
|
*
|
||||||
* @param permission the name of the permission
|
* @param permission the name of the permission
|
||||||
|
* @return if permission is had
|
||||||
*/
|
*/
|
||||||
boolean hasPermission(@Nonnull String permission);
|
boolean hasPermission(@Nonnull String permission);
|
||||||
|
|
||||||
|
@ -172,6 +172,7 @@ public class Like extends SubCommand {
|
|||||||
/**
|
/**
|
||||||
* Get the likes to dislike ratio of a plot as a percentage (in decimal form)
|
* Get the likes to dislike ratio of a plot as a percentage (in decimal form)
|
||||||
*
|
*
|
||||||
|
* @param plot plot
|
||||||
* @return likes to dislike ratio, returns zero if the plot has no likes
|
* @return likes to dislike ratio, returns zero if the plot has no likes
|
||||||
*/
|
*/
|
||||||
public static double getLikesPercentage(final Plot plot) {
|
public static double getLikesPercentage(final Plot plot) {
|
||||||
|
@ -86,7 +86,7 @@ public class Trim extends SubCommand {
|
|||||||
*
|
*
|
||||||
* @param world The world
|
* @param world The world
|
||||||
* @param result (viable = .mcr to trim, nonViable = .mcr keep)
|
* @param result (viable = .mcr to trim, nonViable = .mcr keep)
|
||||||
* @return
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public static boolean getTrimRegions(String world,
|
public static boolean getTrimRegions(String world,
|
||||||
final RunnableVal2<Set<BlockVector2>, Set<BlockVector2>> result) {
|
final RunnableVal2<Set<BlockVector2>, Set<BlockVector2>> result) {
|
||||||
|
@ -128,6 +128,7 @@ public class ComponentPresetManager {
|
|||||||
* if the player is in a compatible plot, and sends appropriate
|
* if the player is in a compatible plot, and sends appropriate
|
||||||
* error messages if not
|
* error messages if not
|
||||||
*
|
*
|
||||||
|
* @param player player
|
||||||
* @return Build inventory, if it could be created
|
* @return Build inventory, if it could be created
|
||||||
*/
|
*/
|
||||||
@Nullable public PlotInventory buildInventory(final PlotPlayer<?> player) {
|
@Nullable public PlotInventory buildInventory(final PlotPlayer<?> player) {
|
||||||
|
@ -53,10 +53,10 @@ public class Config {
|
|||||||
* Get the value for a node<br>
|
* Get the value for a node<br>
|
||||||
* Probably throws some error if you try to get a non existent key
|
* Probably throws some error if you try to get a non existent key
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key configuration key
|
||||||
* @param root
|
* @param root configuration class
|
||||||
* @param <T>
|
* @param <T> value type
|
||||||
* @return
|
* @return value
|
||||||
*/
|
*/
|
||||||
public static <T> T get(String key, Class<?> root) {
|
public static <T> T get(String key, Class<?> root) {
|
||||||
String[] split = key.split("\\.");
|
String[] split = key.split("\\.");
|
||||||
@ -80,7 +80,7 @@ public class Config {
|
|||||||
*
|
*
|
||||||
* @param key config node
|
* @param key config node
|
||||||
* @param value value
|
* @param value value
|
||||||
* @param root
|
* @param root configuration class
|
||||||
*/
|
*/
|
||||||
public static void set(String key, Object value, Class<? extends Config> root) {
|
public static void set(String key, Object value, Class<? extends Config> root) {
|
||||||
String[] split = key.split("\\.");
|
String[] split = key.split("\\.");
|
||||||
@ -124,8 +124,8 @@ public class Config {
|
|||||||
/**
|
/**
|
||||||
* Set all values in the file (load first to avoid overwriting)
|
* Set all values in the file (load first to avoid overwriting)
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file file
|
||||||
* @param root
|
* @param root configuration file class
|
||||||
*/
|
*/
|
||||||
public static void save(File file, Class<? extends Config> root) {
|
public static void save(File file, Class<? extends Config> root) {
|
||||||
try {
|
try {
|
||||||
@ -145,8 +145,8 @@ public class Config {
|
|||||||
/**
|
/**
|
||||||
* Get the static fields in a section.
|
* Get the static fields in a section.
|
||||||
*
|
*
|
||||||
* @param clazz
|
* @param clazz config section
|
||||||
* @return
|
* @return map or string against object of static fields
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> getFields(Class<Enabled_Components> clazz) {
|
public static Map<String, Object> getFields(Class<Enabled_Components> clazz) {
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
@ -33,11 +33,9 @@ import java.util.Map;
|
|||||||
public interface Configuration extends ConfigurationSection {
|
public interface Configuration extends ConfigurationSection {
|
||||||
/**
|
/**
|
||||||
* Sets the default value of the given path as provided.
|
* Sets the default value of the given path as provided.
|
||||||
* <p>
|
|
||||||
* <p>If no source {@link Configuration} was provided as a default
|
* <p>If no source {@link Configuration} was provided as a default
|
||||||
* collection, then a new {@link MemoryConfiguration} will be created to
|
* collection, then a new {@link MemoryConfiguration} will be created to
|
||||||
* hold the new default value.</p>
|
* hold the new default value.</p>
|
||||||
* <p>
|
|
||||||
* <p>If value is null, the value will be removed from the default
|
* <p>If value is null, the value will be removed from the default
|
||||||
* Configuration source.</p>
|
* Configuration source.</p>
|
||||||
*
|
*
|
||||||
@ -49,7 +47,6 @@ public interface Configuration extends ConfigurationSection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default values of the given paths as provided.
|
* Sets the default values of the given paths as provided.
|
||||||
* <p>
|
|
||||||
* <p>If no source {@link Configuration} was provided as a default
|
* <p>If no source {@link Configuration} was provided as a default
|
||||||
* collection, then a new {@link MemoryConfiguration} will be created to
|
* collection, then a new {@link MemoryConfiguration} will be created to
|
||||||
* hold the new default values.</p>
|
* hold the new default values.</p>
|
||||||
@ -61,11 +58,9 @@ public interface Configuration extends ConfigurationSection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default values of the given paths as provided.
|
* Sets the default values of the given paths as provided.
|
||||||
* <p>
|
|
||||||
* <p>If no source {@link Configuration} was provided as a default
|
* <p>If no source {@link Configuration} was provided as a default
|
||||||
* collection, then a new {@link MemoryConfiguration} will be created to
|
* collection, then a new {@link MemoryConfiguration} will be created to
|
||||||
* hold the new default value.</p>
|
* hold the new default value.</p>
|
||||||
* <p>
|
|
||||||
* <p>This method will not hold a reference to the specified Configuration,
|
* <p>This method will not hold a reference to the specified Configuration,
|
||||||
* nor will it automatically update if that Configuration ever changes. If
|
* nor will it automatically update if that Configuration ever changes. If
|
||||||
* you check this, you should set the default source with {@link
|
* you check this, you should set the default source with {@link
|
||||||
@ -78,9 +73,8 @@ public interface Configuration extends ConfigurationSection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the source {@link Configuration} for this configuration.
|
* Gets the source {@link Configuration} for this configuration.
|
||||||
* <p>
|
*
|
||||||
* <p>
|
* <p>If no configuration source was set, but default values were added, then
|
||||||
* If no configuration source was set, but default values were added, then
|
|
||||||
* a {@link MemoryConfiguration} will be returned. If no source was set
|
* a {@link MemoryConfiguration} will be returned. If no source was set
|
||||||
* and no defaults were set, then this method will return null.</p>
|
* and no defaults were set, then this method will return null.</p>
|
||||||
*
|
*
|
||||||
@ -90,9 +84,8 @@ public interface Configuration extends ConfigurationSection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the source of all default values for this {@link Configuration}.
|
* Sets the source of all default values for this {@link Configuration}.
|
||||||
* <p>
|
*
|
||||||
* <p>
|
* <p>If a previous source was set, or previous default values were defined,
|
||||||
* If a previous source was set, or previous default values were defined,
|
|
||||||
* then they will not be copied to the new source.</p>
|
* then they will not be copied to the new source.</p>
|
||||||
*
|
*
|
||||||
* @param defaults New source of default values for this configuration.
|
* @param defaults New source of default values for this configuration.
|
||||||
@ -102,7 +95,6 @@ public interface Configuration extends ConfigurationSection {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link ConfigurationOptions} for this {@link Configuration}.
|
* Gets the {@link ConfigurationOptions} for this {@link Configuration}.
|
||||||
* <p>
|
|
||||||
* <p>All setters through this method are chainable.</p>
|
* <p>All setters through this method are chainable.</p>
|
||||||
*
|
*
|
||||||
* @return Options for this configuration
|
* @return Options for this configuration
|
||||||
|
@ -53,11 +53,9 @@ public class ConfigurationSerialization {
|
|||||||
/**
|
/**
|
||||||
* Attempts to deserialize the given arguments into a new instance of the
|
* Attempts to deserialize the given arguments into a new instance of the
|
||||||
* given class.
|
* given class.
|
||||||
* <p>
|
|
||||||
* <p>The class must implement {@link ConfigurationSerializable}, including
|
* <p>The class must implement {@link ConfigurationSerializable}, including
|
||||||
* the extra methods as specified in the javadoc of
|
* the extra methods as specified in the javadoc of
|
||||||
* ConfigurationSerializable.</p>
|
* ConfigurationSerializable.</p>
|
||||||
* <p>
|
|
||||||
* <p>If a new instance could not be made, an example being the class not
|
* <p>If a new instance could not be made, an example being the class not
|
||||||
* fully implementing the interface, null will be returned.</p>
|
* fully implementing the interface, null will be returned.</p>
|
||||||
*
|
*
|
||||||
@ -72,15 +70,12 @@ public class ConfigurationSerialization {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to deserialize the given arguments into a new instance of the
|
* Attempts to deserialize the given arguments into a new instance of the
|
||||||
* <p>
|
|
||||||
* given class.
|
* given class.
|
||||||
* <p>
|
*
|
||||||
* The class must implement {@link ConfigurationSerializable}, including
|
* <p>The class must implement {@link ConfigurationSerializable}, including
|
||||||
* the extra methods as specified in the javadoc of
|
* the extra methods as specified in the javadoc of
|
||||||
* ConfigurationSerializable.</p>
|
* ConfigurationSerializable.</p>
|
||||||
* <p>
|
* <p>If a new instance could not be made, an example being the class not
|
||||||
* <p>
|
|
||||||
* If a new instance could not be made, an example being the class not
|
|
||||||
* fully implementing the interface, null will be returned.</p>
|
* fully implementing the interface, null will be returned.</p>
|
||||||
*
|
*
|
||||||
* @param args Arguments for deserialization
|
* @param args Arguments for deserialization
|
||||||
|
@ -60,10 +60,8 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
this.regionManager = regionManager;
|
this.regionManager = regionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean setComponent(@Nonnull PlotId plotId,
|
@Override
|
||||||
@Nonnull String component,
|
public boolean setComponent(@Nonnull PlotId plotId, @Nonnull String component, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
@Nonnull Pattern blocks,
|
|
||||||
@Nullable QueueCoordinator queue) {
|
|
||||||
final Optional<ClassicPlotManagerComponent> componentOptional = ClassicPlotManagerComponent.fromString(component);
|
final Optional<ClassicPlotManagerComponent> componentOptional = ClassicPlotManagerComponent.fromString(component);
|
||||||
if (componentOptional.isPresent()) {
|
if (componentOptional.isPresent()) {
|
||||||
switch (componentOptional.get()) {
|
switch (componentOptional.get()) {
|
||||||
@ -101,8 +99,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
/**
|
/**
|
||||||
* Set the plot floor
|
* Set the plot floor
|
||||||
*
|
*
|
||||||
|
* @param plotId id of plot to set floor of
|
||||||
|
* @param blocks pattern to set
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setFloor(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setFloor(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
||||||
@ -116,8 +117,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
/**
|
/**
|
||||||
* Sets the plot main, floor and air areas.
|
* Sets the plot main, floor and air areas.
|
||||||
*
|
*
|
||||||
|
* @param plotId id of plot to set all of
|
||||||
|
* @param blocks pattern to set
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setAll(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setAll(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
||||||
@ -130,8 +134,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
/**
|
/**
|
||||||
* Sets the plot air region.
|
* Sets the plot air region.
|
||||||
*
|
*
|
||||||
|
* @param plotId id of plot to set air of
|
||||||
|
* @param blocks pattern to set
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setAir(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setAir(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
||||||
@ -145,8 +152,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
/**
|
/**
|
||||||
* Sets the plot main blocks.
|
* Sets the plot main blocks.
|
||||||
*
|
*
|
||||||
|
* @param plotId id of plot to set main of
|
||||||
|
* @param blocks pattern to set
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setMain(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setMain(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
||||||
@ -159,8 +169,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
/**
|
/**
|
||||||
* Set the middle plot block to a Pattern
|
* Set the middle plot block to a Pattern
|
||||||
*
|
*
|
||||||
|
* @param plotId id of plot to set middle block of
|
||||||
|
* @param blocks pattern to set
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setMiddle(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setMiddle(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
Plot plot = classicPlotWorld.getPlotAbs(plotId);
|
||||||
@ -184,8 +197,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
/**
|
/**
|
||||||
* Set a plot's outline
|
* Set a plot's outline
|
||||||
*
|
*
|
||||||
|
* @param plotId id of plot to set outline of
|
||||||
|
* @param blocks pattern to set
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setOutline(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setOutline(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
if (classicPlotWorld.ROAD_WIDTH == 0) {
|
if (classicPlotWorld.ROAD_WIDTH == 0) {
|
||||||
@ -257,8 +273,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
/**
|
/**
|
||||||
* Set the wall filling for a plot
|
* Set the wall filling for a plot
|
||||||
*
|
*
|
||||||
|
* @param plotId id of plot to set wall filling of
|
||||||
|
* @param blocks pattern to set
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setWallFilling(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setWallFilling(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
if (classicPlotWorld.ROAD_WIDTH == 0) {
|
if (classicPlotWorld.ROAD_WIDTH == 0) {
|
||||||
@ -321,8 +340,11 @@ public class ClassicPlotManager extends SquarePlotManager {
|
|||||||
/**
|
/**
|
||||||
* Set a plot's wall top block only
|
* Set a plot's wall top block only
|
||||||
*
|
*
|
||||||
|
* @param plotId id of plot to set wall top block of
|
||||||
|
* @param blocks pattern to set
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setWall(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setWall(@Nonnull PlotId plotId, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
if (classicPlotWorld.ROAD_WIDTH == 0) {
|
if (classicPlotWorld.ROAD_WIDTH == 0) {
|
||||||
|
@ -73,7 +73,7 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* CONFIG NODE | DEFAULT VALUE | DESCRIPTION | CONFIGURATION TYPE | REQUIRED FOR INITIAL SETUP.
|
* CONFIG NODE | DEFAULT VALUE | DESCRIPTION | CONFIGURATION TYPE | REQUIRED FOR INITIAL SETUP.
|
||||||
* <p>
|
*
|
||||||
* <p>Set the last boolean to false if you do not check a specific config node to be set while using the setup
|
* <p>Set the last boolean to false if you do not check a specific config node to be set while using the setup
|
||||||
* command - this may be useful if a config value can be changed at a later date, and has no impact on the actual
|
* command - this may be useful if a config value can be changed at a later date, and has no impact on the actual
|
||||||
* world generation</p>
|
* world generation</p>
|
||||||
|
@ -41,6 +41,8 @@ public abstract class IndependentPlotGenerator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of this generator.
|
* Get the name of this generator.
|
||||||
|
*
|
||||||
|
* @return generator name
|
||||||
*/
|
*/
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
@ -49,8 +51,8 @@ public abstract class IndependentPlotGenerator {
|
|||||||
* The PlotArea settings is the same one this was initialized with.
|
* The PlotArea settings is the same one this was initialized with.
|
||||||
* The PseudoRandom random is a fast random object.
|
* The PseudoRandom random is a fast random object.
|
||||||
*
|
*
|
||||||
* @param result
|
* @param result queue
|
||||||
* @param settings
|
* @param settings PlotArea (settings)
|
||||||
*/
|
*/
|
||||||
public abstract void generateChunk(ScopedQueueCoordinator result, PlotArea settings);
|
public abstract void generateChunk(ScopedQueueCoordinator result, PlotArea settings);
|
||||||
|
|
||||||
@ -65,7 +67,7 @@ public abstract class IndependentPlotGenerator {
|
|||||||
* @param id (May be null) Area name
|
* @param id (May be null) Area name
|
||||||
* @param min Min plot id (may be null)
|
* @param min Min plot id (may be null)
|
||||||
* @param max Max plot id (may be null)
|
* @param max Max plot id (may be null)
|
||||||
* @return
|
* @return new plot area
|
||||||
*/
|
*/
|
||||||
public abstract PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max);
|
public abstract PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max);
|
||||||
|
|
||||||
@ -73,7 +75,7 @@ public abstract class IndependentPlotGenerator {
|
|||||||
* If any additional setup options need to be changed before world creation.
|
* If any additional setup options need to be changed before world creation.
|
||||||
* - e.g. If setup doesn't support some standard options
|
* - e.g. If setup doesn't support some standard options
|
||||||
*
|
*
|
||||||
* @param setup
|
* @param setup setup object
|
||||||
*/
|
*/
|
||||||
@Deprecated public void processSetup(SetupObject setup) {
|
@Deprecated public void processSetup(SetupObject setup) {
|
||||||
}
|
}
|
||||||
@ -90,7 +92,7 @@ public abstract class IndependentPlotGenerator {
|
|||||||
/**
|
/**
|
||||||
* It is preferred for the PlotArea object to do most of the initialization necessary.
|
* It is preferred for the PlotArea object to do most of the initialization necessary.
|
||||||
*
|
*
|
||||||
* @param area
|
* @param area area
|
||||||
*/
|
*/
|
||||||
public abstract void initialize(PlotArea area);
|
public abstract void initialize(PlotArea area);
|
||||||
|
|
||||||
@ -98,9 +100,9 @@ public abstract class IndependentPlotGenerator {
|
|||||||
* Get the generator for your specific implementation (bukkit/sponge).<br>
|
* Get the generator for your specific implementation (bukkit/sponge).<br>
|
||||||
* - e.g. YourIndependentGenerator.<ChunkGenerator>specify() - Would return a ChunkGenerator object<br>
|
* - e.g. YourIndependentGenerator.<ChunkGenerator>specify() - Would return a ChunkGenerator object<br>
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T> world
|
||||||
* @param <T>
|
* @param world ChunkGenerator Implementation
|
||||||
* @return
|
* @return Chunk generator
|
||||||
*/
|
*/
|
||||||
public <T> GeneratorWrapper<T> specify(String world) {
|
public <T> GeneratorWrapper<T> specify(String world) {
|
||||||
return (GeneratorWrapper<T>) PlotSquared.platform().wrapPlotGenerator(world, this);
|
return (GeneratorWrapper<T>) PlotSquared.platform().wrapPlotGenerator(world, this);
|
||||||
|
@ -51,6 +51,7 @@ public interface World<T> {
|
|||||||
/**
|
/**
|
||||||
* Get a {@link NullWorld} implementation
|
* Get a {@link NullWorld} implementation
|
||||||
*
|
*
|
||||||
|
* @param <T> implementation-specific world object type e.g. a bukkit World
|
||||||
* @return NullWorld instance
|
* @return NullWorld instance
|
||||||
*/
|
*/
|
||||||
static <T> NullWorld<T> nullWorld() {
|
static <T> NullWorld<T> nullWorld() {
|
||||||
|
@ -58,6 +58,7 @@ public final class MetaDataKey<T> {
|
|||||||
* Get a new named lock key
|
* Get a new named lock key
|
||||||
*
|
*
|
||||||
* @param key Key name
|
* @param key Key name
|
||||||
|
* @param type type
|
||||||
* @param <T> Type
|
* @param <T> Type
|
||||||
* @return MetaData key instance
|
* @return MetaData key instance
|
||||||
*/
|
*/
|
||||||
|
@ -317,7 +317,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
* Get the number of plots this player owns in the world.
|
* Get the number of plots this player owns in the world.
|
||||||
*
|
*
|
||||||
* @param world the name of the plotworld to check.
|
* @param world the name of the plotworld to check.
|
||||||
* @return
|
* @return plot count
|
||||||
*/
|
*/
|
||||||
public int getPlotCount(String world) {
|
public int getPlotCount(String world) {
|
||||||
UUID uuid = getUUID();
|
UUID uuid = getUUID();
|
||||||
@ -393,6 +393,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this player's full location (including yaw/pitch)
|
* Get this player's full location (including yaw/pitch)
|
||||||
|
* @return location
|
||||||
*/
|
*/
|
||||||
public abstract Location getLocationFull();
|
public abstract Location getLocationFull();
|
||||||
|
|
||||||
@ -460,7 +461,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
* - Please note that this is not intended to store large values
|
* - Please note that this is not intended to store large values
|
||||||
* - For session only data use meta
|
* - For session only data use meta
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key metadata key
|
||||||
*/
|
*/
|
||||||
public void setAttribute(String key) {
|
public void setAttribute(String key) {
|
||||||
setPersistentMeta("attrib_" + key, new byte[] {(byte) 1});
|
setPersistentMeta("attrib_" + key, new byte[] {(byte) 1});
|
||||||
@ -469,7 +470,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
/**
|
/**
|
||||||
* Retrieves the attribute of this player.
|
* Retrieves the attribute of this player.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key metadata key
|
||||||
* @return the attribute will be either true or false
|
* @return the attribute will be either true or false
|
||||||
*/
|
*/
|
||||||
public boolean getAttribute(String key) {
|
public boolean getAttribute(String key) {
|
||||||
@ -482,7 +483,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
/**
|
/**
|
||||||
* Remove an attribute from a player.
|
* Remove an attribute from a player.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key metadata key
|
||||||
*/
|
*/
|
||||||
public void removeAttribute(String key) {
|
public void removeAttribute(String key) {
|
||||||
removePersistentMeta("attrib_" + key);
|
removePersistentMeta("attrib_" + key);
|
||||||
@ -605,8 +606,8 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
/**
|
/**
|
||||||
* Get the amount of clusters this player owns in the specific world.
|
* Get the amount of clusters this player owns in the specific world.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world world
|
||||||
* @return
|
* @return number of clusters owned
|
||||||
*/
|
*/
|
||||||
public int getPlayerClusterCount(String world) {
|
public int getPlayerClusterCount(String world) {
|
||||||
return PlotSquared.get().getClusters(world).stream()
|
return PlotSquared.get().getClusters(world).stream()
|
||||||
@ -914,6 +915,8 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of money this Player has.
|
* The amount of money this Player has.
|
||||||
|
*
|
||||||
|
* @return amount of money owned by the player
|
||||||
*/
|
*/
|
||||||
public double getMoney() {
|
public double getMoney() {
|
||||||
return this.econHandler == null ?
|
return this.econHandler == null ?
|
||||||
|
@ -269,8 +269,15 @@ public class Plot {
|
|||||||
* @param id the plot id
|
* @param id the plot id
|
||||||
* @param owner the plot owner
|
* @param owner the plot owner
|
||||||
* @param trusted the plot trusted players
|
* @param trusted the plot trusted players
|
||||||
|
* @param members the plot added players
|
||||||
* @param denied the plot denied players
|
* @param denied the plot denied players
|
||||||
|
* @param alias the plot's alias
|
||||||
|
* @param position plot home position
|
||||||
|
* @param flags the plot's flags
|
||||||
|
* @param area the plot's PlotArea
|
||||||
* @param merged an array giving merged plots
|
* @param merged an array giving merged plots
|
||||||
|
* @param timestamp when the plot was created
|
||||||
|
* @param temp value representing whatever DBManager needs to to. Do not touch tbh.
|
||||||
* @see Plot#getPlot(Location) for existing plots
|
* @see Plot#getPlot(Location) for existing plots
|
||||||
*/
|
*/
|
||||||
public Plot(@Nonnull PlotId id,
|
public Plot(@Nonnull PlotId id,
|
||||||
@ -563,6 +570,8 @@ public class Plot {
|
|||||||
* Direct access is discouraged: use getOwners()
|
* Direct access is discouraged: use getOwners()
|
||||||
*
|
*
|
||||||
* @see #getOwnerAbs() getOwnerAbs() to get the owner as stored in the database
|
* @see #getOwnerAbs() getOwnerAbs() to get the owner as stored in the database
|
||||||
|
*
|
||||||
|
* @return Server if ServerPlot flag set, else {@link #getOwnerAbs()}
|
||||||
*/
|
*/
|
||||||
public UUID getOwner() {
|
public UUID getOwner() {
|
||||||
if (this.getFlag(ServerPlotFlag.class)) {
|
if (this.getFlag(ServerPlotFlag.class)) {
|
||||||
@ -750,6 +759,8 @@ public class Plot {
|
|||||||
* - If the plot is not merged it will return itself.<br>
|
* - If the plot is not merged it will return itself.<br>
|
||||||
* - The result is cached locally
|
* - The result is cached locally
|
||||||
*
|
*
|
||||||
|
* @param recalculate whether to recalculate the merged plots to find the origin
|
||||||
|
*
|
||||||
* @return base Plot
|
* @return base Plot
|
||||||
*/
|
*/
|
||||||
public Plot getBasePlot(boolean recalculate) {
|
public Plot getBasePlot(boolean recalculate) {
|
||||||
@ -1210,6 +1221,8 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* This will return null if the plot hasn't been analyzed
|
* This will return null if the plot hasn't been analyzed
|
||||||
*
|
*
|
||||||
|
* @param settings The set of settings to obtain the analysis of
|
||||||
|
*
|
||||||
* @return analysis of plot
|
* @return analysis of plot
|
||||||
*/
|
*/
|
||||||
public PlotAnalysis getComplexity(Settings.Auto_Clear settings) {
|
public PlotAnalysis getComplexity(Settings.Auto_Clear settings) {
|
||||||
@ -1233,6 +1246,7 @@ public class Plot {
|
|||||||
* Sets a flag for the plot and stores it in the database.
|
* Sets a flag for the plot and stores it in the database.
|
||||||
*
|
*
|
||||||
* @param flag Flag to set
|
* @param flag Flag to set
|
||||||
|
* @param <V> flag value type
|
||||||
* @return A boolean indicating whether or not the operation succeeded
|
* @return A boolean indicating whether or not the operation succeeded
|
||||||
*/
|
*/
|
||||||
public <V> boolean setFlag(PlotFlag<V, ?> flag) {
|
public <V> boolean setFlag(PlotFlag<V, ?> flag) {
|
||||||
@ -1343,6 +1357,10 @@ public class Plot {
|
|||||||
*
|
*
|
||||||
* @see PlotSquared#removePlot(Plot, boolean)
|
* @see PlotSquared#removePlot(Plot, boolean)
|
||||||
* @see #clear(boolean, boolean, Runnable) to simply clear a plot
|
* @see #clear(boolean, boolean, Runnable) to simply clear a plot
|
||||||
|
*
|
||||||
|
* @param whenDone task to run when plot has been deleted. Nullable
|
||||||
|
*
|
||||||
|
* @return success status
|
||||||
*/
|
*/
|
||||||
public boolean deletePlot(final Runnable whenDone) {
|
public boolean deletePlot(final Runnable whenDone) {
|
||||||
if (!this.hasOwner()) {
|
if (!this.hasOwner()) {
|
||||||
@ -1490,6 +1508,8 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loads
|
* @deprecated May cause synchronous chunk loads
|
||||||
|
*
|
||||||
|
* @return Location of center
|
||||||
*/
|
*/
|
||||||
@Deprecated public Location getCenterSynchronous() {
|
@Deprecated public Location getCenterSynchronous() {
|
||||||
Location[] corners = getCorners();
|
Location[] corners = getCorners();
|
||||||
@ -1509,6 +1529,8 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loads
|
* @deprecated May cause synchronous chunk loads
|
||||||
|
*
|
||||||
|
* @return side where players should teleport to
|
||||||
*/
|
*/
|
||||||
@Deprecated public Location getSideSynchronous() {
|
@Deprecated public Location getSideSynchronous() {
|
||||||
CuboidRegion largest = getLargestRegion();
|
CuboidRegion largest = getLargestRegion();
|
||||||
@ -1546,6 +1568,8 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loading
|
* @deprecated May cause synchronous chunk loading
|
||||||
|
*
|
||||||
|
* @return the plot home location
|
||||||
*/
|
*/
|
||||||
@Deprecated public Location getHomeSynchronous() {
|
@Deprecated public Location getHomeSynchronous() {
|
||||||
BlockLoc home = this.getPosition();
|
BlockLoc home = this.getPosition();
|
||||||
@ -1569,6 +1593,8 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the home location for the plot
|
* Return the home location for the plot
|
||||||
|
*
|
||||||
|
* @param result consumer to pass location to when found
|
||||||
*/
|
*/
|
||||||
public void getHome(final Consumer<Location> result) {
|
public void getHome(final Consumer<Location> result) {
|
||||||
BlockLoc home = this.getPosition();
|
BlockLoc home = this.getPosition();
|
||||||
@ -1615,6 +1641,8 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* Gets the default home location for a plot<br>
|
* Gets the default home location for a plot<br>
|
||||||
* - Ignores any home location set for that specific plot
|
* - Ignores any home location set for that specific plot
|
||||||
|
*
|
||||||
|
* @param result consumer to pass location to when found
|
||||||
*/
|
*/
|
||||||
public void getDefaultHome(Consumer<Location> result) {
|
public void getDefaultHome(Consumer<Location> result) {
|
||||||
getDefaultHome(false, result);
|
getDefaultHome(false, result);
|
||||||
@ -1622,6 +1650,10 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loads
|
* @deprecated May cause synchronous chunk loads
|
||||||
|
*
|
||||||
|
* @param member if to get the home for plot members
|
||||||
|
*
|
||||||
|
* @return location of home for members or visitors
|
||||||
*/
|
*/
|
||||||
@Deprecated public Location getDefaultHomeSynchronous(final boolean member) {
|
@Deprecated public Location getDefaultHomeSynchronous(final boolean member) {
|
||||||
Plot plot = this.getBasePlot(false);
|
Plot plot = this.getBasePlot(false);
|
||||||
@ -1927,6 +1959,13 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* Sets components such as border, wall, floor.
|
* Sets components such as border, wall, floor.
|
||||||
* (components are generator specific)
|
* (components are generator specific)
|
||||||
|
*
|
||||||
|
* @param component component to set
|
||||||
|
* @param blocks string of block(s) to set component to
|
||||||
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
*
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
@Deprecated public boolean setComponent(String component, String blocks, QueueCoordinator queue) {
|
@Deprecated public boolean setComponent(String component, String blocks, QueueCoordinator queue) {
|
||||||
BlockBucket parsed = ConfigurationUtil.BLOCK_BUCKET.parseString(blocks);
|
BlockBucket parsed = ConfigurationUtil.BLOCK_BUCKET.parseString(blocks);
|
||||||
@ -1940,6 +1979,8 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the biome of the plot.
|
* Retrieve the biome of the plot.
|
||||||
|
*
|
||||||
|
* @param result consumer to pass biome to when found
|
||||||
*/
|
*/
|
||||||
public void getBiome(Consumer<BiomeType> result) {
|
public void getBiome(Consumer<BiomeType> result) {
|
||||||
this.getCenter(location -> this.worldUtil.getBiome(location.getWorldName(), location.getX(), location.getZ(), result));
|
this.getCenter(location -> this.worldUtil.getBiome(location.getWorldName(), location.getX(), location.getZ(), result));
|
||||||
@ -1949,6 +1990,8 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated May cause synchronous chunk loads
|
* @deprecated May cause synchronous chunk loads
|
||||||
|
*
|
||||||
|
* @return biome at center of plot
|
||||||
*/
|
*/
|
||||||
@Deprecated public BiomeType getBiomeSynchronous() {
|
@Deprecated public BiomeType getBiomeSynchronous() {
|
||||||
final Location location = this.getCenterSynchronous();
|
final Location location = this.getCenterSynchronous();
|
||||||
@ -1957,6 +2000,8 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the top location for the plot.
|
* Returns the top location for the plot.
|
||||||
|
*
|
||||||
|
* @return location of Absolute Top
|
||||||
*/
|
*/
|
||||||
public Location getTopAbs() {
|
public Location getTopAbs() {
|
||||||
return this.getManager().getPlotTopLocAbs(this.id).withWorld(this.getWorldName());
|
return this.getManager().getPlotTopLocAbs(this.id).withWorld(this.getWorldName());
|
||||||
@ -1964,6 +2009,8 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the bottom location for the plot.
|
* Returns the bottom location for the plot.
|
||||||
|
*
|
||||||
|
* @return location of absolute bottom of plot
|
||||||
*/
|
*/
|
||||||
public Location getBottomAbs() {
|
public Location getBottomAbs() {
|
||||||
return this.getManager().getPlotBottomLocAbs(this.id).withWorld(this.getWorldName());
|
return this.getManager().getPlotBottomLocAbs(this.id).withWorld(this.getWorldName());
|
||||||
@ -2003,8 +2050,8 @@ public class Plot {
|
|||||||
* Moves the settings for a plot.
|
* Moves the settings for a plot.
|
||||||
*
|
*
|
||||||
* @param plot the plot to move
|
* @param plot the plot to move
|
||||||
* @param whenDone
|
* @param whenDone task to run when settings have been moved
|
||||||
* @return
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean moveData(Plot plot, Runnable whenDone) {
|
public boolean moveData(Plot plot, Runnable whenDone) {
|
||||||
if (!this.hasOwner()) {
|
if (!this.hasOwner()) {
|
||||||
@ -2100,8 +2147,8 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
|
||||||
* @deprecated in favor of getCorners()[0];<br>
|
* @deprecated in favor of getCorners()[0];<br>
|
||||||
|
* @return bottom corner location
|
||||||
*/
|
*/
|
||||||
// Won't remove as suggestion also points to deprecated method
|
// Won't remove as suggestion also points to deprecated method
|
||||||
@Deprecated public Location getBottom() {
|
@Deprecated public Location getBottom() {
|
||||||
@ -2109,8 +2156,8 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the top corner of the plot
|
|
||||||
* @deprecated in favor of getCorners()[1];
|
* @deprecated in favor of getCorners()[1];
|
||||||
|
* @return the top corner of the plot
|
||||||
*/
|
*/
|
||||||
// Won't remove as suggestion also points to deprecated method
|
// Won't remove as suggestion also points to deprecated method
|
||||||
@Deprecated public Location getTop() {
|
@Deprecated public Location getTop() {
|
||||||
@ -2158,7 +2205,9 @@ public class Plot {
|
|||||||
* Remove a denied player (use DBFunc as well)<br>
|
* Remove a denied player (use DBFunc as well)<br>
|
||||||
* Using the * uuid will remove all users
|
* Using the * uuid will remove all users
|
||||||
*
|
*
|
||||||
* @param uuid
|
* @param uuid uuid of player to remove from denied list
|
||||||
|
*
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean removeDenied(UUID uuid) {
|
public boolean removeDenied(UUID uuid) {
|
||||||
if (uuid == DBFunc.EVERYONE && !denied.contains(uuid)) {
|
if (uuid == DBFunc.EVERYONE && !denied.contains(uuid)) {
|
||||||
@ -2186,7 +2235,9 @@ public class Plot {
|
|||||||
* Remove a helper (use DBFunc as well)<br>
|
* Remove a helper (use DBFunc as well)<br>
|
||||||
* Using the * uuid will remove all users
|
* Using the * uuid will remove all users
|
||||||
*
|
*
|
||||||
* @param uuid
|
* @param uuid uuid of trusted player to remove
|
||||||
|
*
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean removeTrusted(UUID uuid) {
|
public boolean removeTrusted(UUID uuid) {
|
||||||
if (uuid == DBFunc.EVERYONE && !trusted.contains(uuid)) {
|
if (uuid == DBFunc.EVERYONE && !trusted.contains(uuid)) {
|
||||||
@ -2214,7 +2265,9 @@ public class Plot {
|
|||||||
* Remove a trusted user (use DBFunc as well)<br>
|
* Remove a trusted user (use DBFunc as well)<br>
|
||||||
* Using the * uuid will remove all users
|
* Using the * uuid will remove all users
|
||||||
*
|
*
|
||||||
* @param uuid
|
* @param uuid uuid of player to remove
|
||||||
|
*
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean removeMember(UUID uuid) {
|
public boolean removeMember(UUID uuid) {
|
||||||
if (this.members == null) {
|
if (this.members == null) {
|
||||||
@ -2243,6 +2296,8 @@ public class Plot {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Export the plot as a schematic to the configured output directory.
|
* Export the plot as a schematic to the configured output directory.
|
||||||
|
*
|
||||||
|
* @param whenDone task to run when the export has finished
|
||||||
*/
|
*/
|
||||||
public void export(final RunnableVal<Boolean> whenDone) {
|
public void export(final RunnableVal<Boolean> whenDone) {
|
||||||
this.schematicHandler.getCompoundTag(this, new RunnableVal<CompoundTag>() {
|
this.schematicHandler.getCompoundTag(this, new RunnableVal<CompoundTag>() {
|
||||||
@ -2284,7 +2339,7 @@ public class Plot {
|
|||||||
* - The mca files are each 512x512, so depending on the plot size it may also download adjacent plots<br>
|
* - The mca files are each 512x512, so depending on the plot size it may also download adjacent plots<br>
|
||||||
* - Works best when (plot width + road width) % 512 == 0<br>
|
* - Works best when (plot width + road width) % 512 == 0<br>
|
||||||
*
|
*
|
||||||
* @param whenDone
|
* @param whenDone task to run when plot is uploaded
|
||||||
* @see WorldUtil
|
* @see WorldUtil
|
||||||
*/
|
*/
|
||||||
public void uploadWorld(RunnableVal<URL> whenDone) {
|
public void uploadWorld(RunnableVal<URL> whenDone) {
|
||||||
@ -2354,8 +2409,8 @@ public class Plot {
|
|||||||
* - Updates DB<br>
|
* - Updates DB<br>
|
||||||
* - Does not modify terrain<br>
|
* - Does not modify terrain<br>
|
||||||
*
|
*
|
||||||
* @param direction
|
* @param direction direction to merge the plot in
|
||||||
* @param value
|
* @param value if the plot is merged or not
|
||||||
*/
|
*/
|
||||||
public void setMerged(Direction direction, boolean value) {
|
public void setMerged(Direction direction, boolean value) {
|
||||||
if (this.getSettings().setMerged(direction, value)) {
|
if (this.getSettings().setMerged(direction, value)) {
|
||||||
@ -2404,7 +2459,7 @@ public class Plot {
|
|||||||
* ----------<br>
|
* ----------<br>
|
||||||
* Note: Diagonal merging (4-7) must be done by merging the corresponding plots.
|
* Note: Diagonal merging (4-7) must be done by merging the corresponding plots.
|
||||||
*
|
*
|
||||||
* @param merged
|
* @param merged set the plot's merged plots
|
||||||
*/
|
*/
|
||||||
public void setMerged(boolean[] merged) {
|
public void setMerged(boolean[] merged) {
|
||||||
this.getSettings().setMerged(merged);
|
this.getSettings().setMerged(merged);
|
||||||
@ -2424,6 +2479,8 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* Gets the set home location or 0,0,0 if no location is set<br>
|
* Gets the set home location or 0,0,0 if no location is set<br>
|
||||||
* - Does not take the default home location into account
|
* - Does not take the default home location into account
|
||||||
|
*
|
||||||
|
* @return home location
|
||||||
*/
|
*/
|
||||||
public BlockLoc getPosition() {
|
public BlockLoc getPosition() {
|
||||||
return this.getSettings().getPosition();
|
return this.getSettings().getPosition();
|
||||||
@ -2433,6 +2490,8 @@ public class Plot {
|
|||||||
* Check if a plot can be claimed by the provided player.
|
* Check if a plot can be claimed by the provided player.
|
||||||
*
|
*
|
||||||
* @param player the claiming player
|
* @param player the claiming player
|
||||||
|
*
|
||||||
|
* @return if the given player can claim the plot
|
||||||
*/
|
*/
|
||||||
public boolean canClaim(@Nonnull PlotPlayer player) {
|
public boolean canClaim(@Nonnull PlotPlayer player) {
|
||||||
PlotCluster cluster = this.getCluster();
|
PlotCluster cluster = this.getCluster();
|
||||||
@ -2574,7 +2633,7 @@ public class Plot {
|
|||||||
* Merge the plot settings<br>
|
* Merge the plot settings<br>
|
||||||
* - Used when a plot is merged<br>
|
* - Used when a plot is merged<br>
|
||||||
*
|
*
|
||||||
* @param plot
|
* @param plot plot to merge the data from
|
||||||
*/
|
*/
|
||||||
public void mergeData(Plot plot) {
|
public void mergeData(Plot plot) {
|
||||||
final FlagContainer flagContainer1 = this.getFlagContainer();
|
final FlagContainer flagContainer1 = this.getFlagContainer();
|
||||||
@ -2640,8 +2699,8 @@ public class Plot {
|
|||||||
* Gets the plot in a relative location<br>
|
* Gets the plot in a relative location<br>
|
||||||
* Note: May be null if the partial plot area does not include the relative location
|
* Note: May be null if the partial plot area does not include the relative location
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x relative id X
|
||||||
* @param y
|
* @param y relative id Y
|
||||||
* @return Plot
|
* @return Plot
|
||||||
*/
|
*/
|
||||||
public Plot getRelative(int x, int y) {
|
public Plot getRelative(int x, int y) {
|
||||||
@ -2793,7 +2852,7 @@ public class Plot {
|
|||||||
* - This result is cached globally<br>
|
* - This result is cached globally<br>
|
||||||
* - Useful for handling non rectangular shapes
|
* - Useful for handling non rectangular shapes
|
||||||
*
|
*
|
||||||
* @return
|
* @return all regions within the plot
|
||||||
*/
|
*/
|
||||||
@Nonnull public Set<CuboidRegion> getRegions() {
|
@Nonnull public Set<CuboidRegion> getRegions() {
|
||||||
if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) {
|
if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) {
|
||||||
@ -2922,7 +2981,7 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* Attempt to find the largest rectangular region in a plot (as plots can form non rectangular shapes)
|
* Attempt to find the largest rectangular region in a plot (as plots can form non rectangular shapes)
|
||||||
*
|
*
|
||||||
* @return
|
* @return the plot's largest CuboidRegion
|
||||||
*/
|
*/
|
||||||
public CuboidRegion getLargestRegion() {
|
public CuboidRegion getLargestRegion() {
|
||||||
Set<CuboidRegion> regions = this.getRegions();
|
Set<CuboidRegion> regions = this.getRegions();
|
||||||
@ -3085,6 +3144,8 @@ public class Plot {
|
|||||||
*
|
*
|
||||||
* @param component Component to set
|
* @param component Component to set
|
||||||
* @param blocks Pattern to use the generation
|
* @param blocks Pattern to use the generation
|
||||||
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
|
* otherwise writes to the queue but does not enqueue.
|
||||||
* @return True if the component was set successfully
|
* @return True if the component was set successfully
|
||||||
*/
|
*/
|
||||||
public boolean setComponent(String component, Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setComponent(String component, Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
@ -3117,6 +3178,8 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* Merges two plots. <br>- Assumes plots are directly next to each other <br> - saves to DB
|
* Merges two plots. <br>- Assumes plots are directly next to each other <br> - saves to DB
|
||||||
*
|
*
|
||||||
|
* @param lesserPlot the plot to merge into this plot instance
|
||||||
|
* @param removeRoads if roads should be removed during the merge
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
*/
|
*/
|
||||||
@ -3297,9 +3360,9 @@ public class Plot {
|
|||||||
/**
|
/**
|
||||||
* Copy a plot to a location, both physically and the settings
|
* Copy a plot to a location, both physically and the settings
|
||||||
*
|
*
|
||||||
* @param destination
|
* @param destination destination plot
|
||||||
* @param whenDone
|
* @param whenDone task to run when copy is complete
|
||||||
* @return
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean copy(final Plot destination, final Runnable whenDone) {
|
public boolean copy(final Plot destination, final Runnable whenDone) {
|
||||||
PlotId offset = PlotId.of(destination.getId().getX() - this.getId().getX(), destination.getId().getY() - this.getId().getY());
|
PlotId offset = PlotId.of(destination.getId().getX() - this.getId().getX(), destination.getId().getY() - this.getId().getY());
|
||||||
@ -3419,6 +3482,7 @@ public class Plot {
|
|||||||
* and at last, it will look at the default values stored in {@link GlobalFlagContainer}.
|
* and at last, it will look at the default values stored in {@link GlobalFlagContainer}.
|
||||||
*
|
*
|
||||||
* @param flagClass The flag type (Class)
|
* @param flagClass The flag type (Class)
|
||||||
|
* @param <T> the flag value type
|
||||||
* @return The flag value
|
* @return The flag value
|
||||||
*/
|
*/
|
||||||
public <T> T getFlag(final Class<? extends PlotFlag<T, ?>> flagClass) {
|
public <T> T getFlag(final Class<? extends PlotFlag<T, ?>> flagClass) {
|
||||||
@ -3431,6 +3495,8 @@ public class Plot {
|
|||||||
* and at last, it will look at the default values stored in {@link GlobalFlagContainer}.
|
* and at last, it will look at the default values stored in {@link GlobalFlagContainer}.
|
||||||
*
|
*
|
||||||
* @param flag The flag type (Any instance of the flag)
|
* @param flag The flag type (Any instance of the flag)
|
||||||
|
* @param <V> the flag type (Any instance of the flag)
|
||||||
|
* @param <T> the flag's value type
|
||||||
* @return The flag value
|
* @return The flag value
|
||||||
*/
|
*/
|
||||||
public <T, V extends PlotFlag<T, ?>> T getFlag(final V flag) {
|
public <T, V extends PlotFlag<T, ?>> T getFlag(final V flag) {
|
||||||
|
@ -659,6 +659,9 @@ public abstract class PlotArea {
|
|||||||
* Retrieves the plots for the player in this PlotArea.
|
* Retrieves the plots for the player in this PlotArea.
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link #getPlots(UUID)}
|
* @deprecated Use {@link #getPlots(UUID)}
|
||||||
|
*
|
||||||
|
* @param player player to get plots of
|
||||||
|
* @return set of player's plots
|
||||||
*/
|
*/
|
||||||
@Deprecated public Set<Plot> getPlots(@Nonnull final PlotPlayer player) {
|
@Deprecated public Set<Plot> getPlots(@Nonnull final PlotPlayer player) {
|
||||||
return getPlots(player.getUUID());
|
return getPlots(player.getUUID());
|
||||||
@ -737,6 +740,9 @@ public abstract class PlotArea {
|
|||||||
* Session only plot metadata (session is until the server stops).
|
* Session only plot metadata (session is until the server stops).
|
||||||
* <br>
|
* <br>
|
||||||
* For persistent metadata use the flag system
|
* For persistent metadata use the flag system
|
||||||
|
*
|
||||||
|
* @param key metadata key
|
||||||
|
* @param value metadata value
|
||||||
*/
|
*/
|
||||||
public void setMeta(@Nonnull final String key, @Nullable final Object value) {
|
public void setMeta(@Nonnull final String key, @Nullable final Object value) {
|
||||||
if (this.meta == null) {
|
if (this.meta == null) {
|
||||||
@ -754,6 +760,8 @@ public abstract class PlotArea {
|
|||||||
* Get the metadata for a key<br>
|
* Get the metadata for a key<br>
|
||||||
* <br>
|
* <br>
|
||||||
* For persistent metadata use the flag system
|
* For persistent metadata use the flag system
|
||||||
|
* @param key metadata key to get value for
|
||||||
|
* @return metadata value
|
||||||
*/
|
*/
|
||||||
@Nullable public Object getMeta(@Nonnull final String key) {
|
@Nullable public Object getMeta(@Nonnull final String key) {
|
||||||
if (this.meta != null) {
|
if (this.meta != null) {
|
||||||
@ -782,17 +790,12 @@ public abstract class PlotArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an ImmutableMap of PlotId's and Plots in this PlotArea.
|
|
||||||
*/
|
|
||||||
public Map<PlotId, Plot> getPlotsMap() {
|
|
||||||
return ImmutableMap.copyOf(plots);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an ImmutableMap of PlotId's and Plots in this PlotArea.
|
* Returns an ImmutableMap of PlotId's and Plots in this PlotArea.
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link #getPlotsMap()}
|
* @deprecated Poorly implemented. May be removed in future.
|
||||||
|
*
|
||||||
|
* @return map of PlotId against Plot for all plots in this area
|
||||||
*/
|
*/
|
||||||
//todo eventually remove
|
//todo eventually remove
|
||||||
@Deprecated @Nonnull public Map<PlotId, Plot> getPlotsRaw() {
|
@Deprecated @Nonnull public Map<PlotId, Plot> getPlotsRaw() {
|
||||||
@ -1159,6 +1162,7 @@ public abstract class PlotArea {
|
|||||||
* the default values stored in {@link GlobalFlagContainer}.
|
* the default values stored in {@link GlobalFlagContainer}.
|
||||||
*
|
*
|
||||||
* @param flagClass The flag type (Class)
|
* @param flagClass The flag type (Class)
|
||||||
|
* @param <T> The flag value type
|
||||||
* @return The flag value
|
* @return The flag value
|
||||||
*/
|
*/
|
||||||
public <T> T getFlag(final Class<? extends PlotFlag<T, ?>> flagClass) {
|
public <T> T getFlag(final Class<? extends PlotFlag<T, ?>> flagClass) {
|
||||||
@ -1170,6 +1174,8 @@ public abstract class PlotArea {
|
|||||||
* the default values stored in {@link GlobalFlagContainer}.
|
* the default values stored in {@link GlobalFlagContainer}.
|
||||||
*
|
*
|
||||||
* @param flag The flag type (Any instance of the flag)
|
* @param flag The flag type (Any instance of the flag)
|
||||||
|
* @param <V> The flag type (Any instance of the flag)
|
||||||
|
* @param <T> flag valye type
|
||||||
* @return The flag value
|
* @return The flag value
|
||||||
*/
|
*/
|
||||||
public <T, V extends PlotFlag<T, ?>> T getFlag(final V flag) {
|
public <T, V extends PlotFlag<T, ?>> T getFlag(final V flag) {
|
||||||
@ -1183,6 +1189,7 @@ public abstract class PlotArea {
|
|||||||
* the default values stored in {@link GlobalFlagContainer}.
|
* the default values stored in {@link GlobalFlagContainer}.
|
||||||
*
|
*
|
||||||
* @param flagClass The flag type (Class)
|
* @param flagClass The flag type (Class)
|
||||||
|
* @param <T> the flag value type
|
||||||
* @return The flag value
|
* @return The flag value
|
||||||
*/
|
*/
|
||||||
public <T> T getRoadFlag(final Class<? extends PlotFlag<T, ?>> flagClass) {
|
public <T> T getRoadFlag(final Class<? extends PlotFlag<T, ?>> flagClass) {
|
||||||
@ -1194,6 +1201,8 @@ public abstract class PlotArea {
|
|||||||
* the default values stored in {@link GlobalFlagContainer}.
|
* the default values stored in {@link GlobalFlagContainer}.
|
||||||
*
|
*
|
||||||
* @param flag The flag type (Any instance of the flag)
|
* @param flag The flag type (Any instance of the flag)
|
||||||
|
* @param <V> The flag type (Any instance of the flag)
|
||||||
|
* @param <T> flag valye type
|
||||||
* @return The flag value
|
* @return The flag value
|
||||||
*/
|
*/
|
||||||
public <T, V extends PlotFlag<T, ?>> T getRoadFlag(final V flag) {
|
public <T, V extends PlotFlag<T, ?>> T getRoadFlag(final V flag) {
|
||||||
|
@ -117,6 +117,8 @@ public class PlotCluster {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the area (in plots).
|
* Get the area (in plots).
|
||||||
|
*
|
||||||
|
* @return area of plots
|
||||||
*/
|
*/
|
||||||
public int getArea() {
|
public int getArea() {
|
||||||
return (1 + this.pos2.getX() - this.pos1.getX()) * (1 + this.pos2.getY() - this.pos1.getY());
|
return (1 + this.pos2.getX() - this.pos1.getX()) * (1 + this.pos2.getY() - this.pos1.getY());
|
||||||
|
@ -58,6 +58,7 @@ public final class PlotId {
|
|||||||
*
|
*
|
||||||
* @param x The plot x coordinate
|
* @param x The plot x coordinate
|
||||||
* @param y The plot y coordinate
|
* @param y The plot y coordinate
|
||||||
|
* @return a new PlotId at x,y
|
||||||
*/
|
*/
|
||||||
@Nonnull public static PlotId of(final int x, final int y) {
|
@Nonnull public static PlotId of(final int x, final int y) {
|
||||||
return new PlotId(x, y);
|
return new PlotId(x, y);
|
||||||
|
@ -68,8 +68,11 @@ public abstract class PlotManager {
|
|||||||
/**
|
/**
|
||||||
* Completes block changes associated with plot unclaim.
|
* Completes block changes associated with plot unclaim.
|
||||||
*
|
*
|
||||||
|
* @param plot plot to unclaim
|
||||||
|
* @param whenDone task to run when plot is unclaimed
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean unClaimPlot(@Nonnull Plot plot, @Nullable Runnable whenDone, @Nullable QueueCoordinator queue);
|
public abstract boolean unClaimPlot(@Nonnull Plot plot, @Nullable Runnable whenDone, @Nullable QueueCoordinator queue);
|
||||||
|
|
||||||
@ -81,18 +84,23 @@ public abstract class PlotManager {
|
|||||||
*/
|
*/
|
||||||
public abstract Location getSignLoc(@Nonnull Plot plot);
|
public abstract Location getSignLoc(@Nonnull Plot plot);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Plot set functions (return false if you do not support the specific set
|
* Get an array of the plot's component values as string
|
||||||
* method).
|
*
|
||||||
|
* @param plotId plotId to get components of
|
||||||
|
* @return array of plot's component values
|
||||||
*/
|
*/
|
||||||
public abstract String[] getPlotComponents(@Nonnull PlotId plotId);
|
public abstract String[] getPlotComponents(@Nonnull PlotId plotId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the specified components to the specified Pattern on the specified plot.
|
* Set the specified components to the specified Pattern on the specified plot.
|
||||||
*
|
*
|
||||||
|
* @param plotId id of plot to set component to
|
||||||
* @param component FLOOR, WALL, AIR, MAIN, MIDDLE, OUTLINE, BORDER, ALL (floor, air and main).
|
* @param component FLOOR, WALL, AIR, MAIN, MIDDLE, OUTLINE, BORDER, ALL (floor, air and main).
|
||||||
|
* @param blocks Pattern to set component to
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean setComponent(@Nonnull PlotId plotId,
|
public abstract boolean setComponent(@Nonnull PlotId plotId,
|
||||||
@Nonnull String component,
|
@Nonnull String component,
|
||||||
@ -102,48 +110,60 @@ public abstract class PlotManager {
|
|||||||
/**
|
/**
|
||||||
* Create the road east of the plot (not schematic-based)
|
* Create the road east of the plot (not schematic-based)
|
||||||
*
|
*
|
||||||
|
* @param plot plot to create the road for
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean createRoadEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
public abstract boolean createRoadEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the road south of the plot (not schematic-based)
|
* Create the road south of the plot (not schematic-based)
|
||||||
*
|
*
|
||||||
|
* @param plot plot to create the road for
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean createRoadSouth(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
public abstract boolean createRoadSouth(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the south-east corner of the road (intersection, not schematic-based)
|
* Create the south-east corner of the road (intersection, not schematic-based)
|
||||||
*
|
*
|
||||||
|
* @param plot plot to create the road for
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean createRoadSouthEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
public abstract boolean createRoadSouthEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the road to the east of the plot with standard plot blocks (for when merging plots)
|
* Replace the road to the east of the plot with standard plot blocks (for when merging plots)
|
||||||
*
|
*
|
||||||
|
* @param plot plot to remove east road from
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean removeRoadEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
public abstract boolean removeRoadEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the road to the south of the plot with standard plot blocks (for when merging plots)
|
* Replace the road to the south of the plot with standard plot blocks (for when merging plots)
|
||||||
*
|
*
|
||||||
|
* @param plot plot to remove south road from
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean removeRoadSouth(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
public abstract boolean removeRoadSouth(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the road to the south east of the plot (intersection) with standard plot blocks (for when merging plots)
|
* Replace the road to the south east of the plot (intersection) with standard plot blocks (for when merging plots)
|
||||||
*
|
*
|
||||||
|
* @param plot plot to remove south east road intersection from
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean removeRoadSouthEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
public abstract boolean removeRoadSouthEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue);
|
||||||
|
|
||||||
@ -154,6 +174,7 @@ public abstract class PlotManager {
|
|||||||
/**
|
/**
|
||||||
* Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED).
|
* Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED).
|
||||||
*
|
*
|
||||||
|
* @param plotIds list of PlotIds to finish the merge for
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
* @return false if part if the merge failed, otherwise true if successful.
|
* @return false if part if the merge failed, otherwise true if successful.
|
||||||
@ -163,8 +184,10 @@ public abstract class PlotManager {
|
|||||||
/**
|
/**
|
||||||
* Finished off an unlink by resetting the top wall block for unlinked plots
|
* Finished off an unlink by resetting the top wall block for unlinked plots
|
||||||
*
|
*
|
||||||
|
* @param plotIds list of PlotIds to reset the top wall block of
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean finishPlotUnlink(@Nonnull List<PlotId> plotIds, @Nullable QueueCoordinator queue);
|
public abstract boolean finishPlotUnlink(@Nonnull List<PlotId> plotIds, @Nullable QueueCoordinator queue);
|
||||||
|
|
||||||
|
@ -67,9 +67,9 @@ public abstract class CommentInbox {
|
|||||||
* The `whenDone` parameter should be executed when it's done fetching the comments.
|
* The `whenDone` parameter should be executed when it's done fetching the comments.
|
||||||
* The value should be set to List of comments
|
* The value should be set to List of comments
|
||||||
*
|
*
|
||||||
* @param plot
|
* @param plot plot
|
||||||
* @param whenDone
|
* @param whenDone task to run when comments are obtained
|
||||||
* @return
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean getComments(Plot plot, RunnableVal<List<PlotComment>> whenDone);
|
public abstract boolean getComments(Plot plot, RunnableVal<List<PlotComment>> whenDone);
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class ExpireManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the account last joined - first joined (or Long.MAX_VALUE)
|
* Gets the account last joined - first joined (or Long.MAX_VALUE)
|
||||||
*
|
*
|
||||||
* @param uuid
|
* @param uuid player uuid
|
||||||
* @return result
|
* @return result
|
||||||
*/
|
*/
|
||||||
public long getAccountAge(UUID uuid) {
|
public long getAccountAge(UUID uuid) {
|
||||||
|
@ -92,8 +92,8 @@ public class PlotAnalysis {
|
|||||||
* This will set the optimal modifiers for the plot analysis based on the current plot ratings<br>
|
* This will set the optimal modifiers for the plot analysis based on the current plot ratings<br>
|
||||||
* - Will be used to calibrate the threshold for plot clearing
|
* - Will be used to calibrate the threshold for plot clearing
|
||||||
*
|
*
|
||||||
* @param whenDone
|
* @param whenDone task to run when done
|
||||||
* @param threshold
|
* @param threshold threshold
|
||||||
*/
|
*/
|
||||||
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
|
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
|
||||||
if (running) {
|
if (running) {
|
||||||
@ -495,7 +495,9 @@ public class PlotAnalysis {
|
|||||||
/**
|
/**
|
||||||
* Get correlation coefficient.
|
* Get correlation coefficient.
|
||||||
*
|
*
|
||||||
* @return
|
* @param n n
|
||||||
|
* @param sum sum
|
||||||
|
* @return result
|
||||||
*/
|
*/
|
||||||
public static double getCC(int n, int sum) {
|
public static double getCC(int n, int sum) {
|
||||||
return 1 - 6 * (double) sum / (n * (n * n - 1));
|
return 1 - 6 * (double) sum / (n * (n * n - 1));
|
||||||
@ -503,6 +505,9 @@ public class PlotAnalysis {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls {@code Arrays.stream(array).sum()}
|
* Calls {@code Arrays.stream(array).sum()}
|
||||||
|
*
|
||||||
|
* @param array array
|
||||||
|
* @return sum
|
||||||
*/
|
*/
|
||||||
public static int sum(int[] array) {
|
public static int sum(int[] array) {
|
||||||
return Arrays.stream(array).sum();
|
return Arrays.stream(array).sum();
|
||||||
@ -512,8 +517,8 @@ public class PlotAnalysis {
|
|||||||
* A simple array squaring algorithm.
|
* A simple array squaring algorithm.
|
||||||
* - Used for calculating the variance
|
* - Used for calculating the variance
|
||||||
*
|
*
|
||||||
* @param array
|
* @param array array
|
||||||
* @return
|
* @return result
|
||||||
*/
|
*/
|
||||||
public static int[] square(int[] array) {
|
public static int[] square(int[] array) {
|
||||||
array = array.clone();
|
array = array.clone();
|
||||||
@ -526,8 +531,8 @@ public class PlotAnalysis {
|
|||||||
/**
|
/**
|
||||||
* An optimized lossy standard deviation algorithm.
|
* An optimized lossy standard deviation algorithm.
|
||||||
*
|
*
|
||||||
* @param ranks
|
* @param ranks ranks
|
||||||
* @return
|
* @return result
|
||||||
*/
|
*/
|
||||||
public static int[] getSD(int[]... ranks) {
|
public static int[] getSD(int[]... ranks) {
|
||||||
if (ranks.length == 0) {
|
if (ranks.length == 0) {
|
||||||
@ -555,9 +560,8 @@ public class PlotAnalysis {
|
|||||||
* - Input is an array of int with a max size of 102400<br>
|
* - Input is an array of int with a max size of 102400<br>
|
||||||
* - A reduced sample space allows for sorting (and ranking in this case) in linear time
|
* - A reduced sample space allows for sorting (and ranking in this case) in linear time
|
||||||
*
|
*
|
||||||
* @param input
|
* @param input input
|
||||||
* @param input
|
* @return result
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static int[] rank(int[] input) {
|
public static int[] rank(int[] input) {
|
||||||
return rank(input, 102400);
|
return rank(input, 102400);
|
||||||
@ -566,8 +570,9 @@ public class PlotAnalysis {
|
|||||||
/**
|
/**
|
||||||
* An optimized algorithm for ranking a very specific set of inputs
|
* An optimized algorithm for ranking a very specific set of inputs
|
||||||
*
|
*
|
||||||
* @param input
|
* @param input input
|
||||||
* @return
|
* @param size size
|
||||||
|
* @return result
|
||||||
*/
|
*/
|
||||||
public static int[] rank(int[] input, int size) {
|
public static int[] rank(int[] input, int size) {
|
||||||
int[] cache = new int[size];
|
int[] cache = new int[size];
|
||||||
|
@ -128,6 +128,8 @@ public class FlagContainer {
|
|||||||
* Add a flag to the container
|
* Add a flag to the container
|
||||||
*
|
*
|
||||||
* @param flag Flag to add
|
* @param flag Flag to add
|
||||||
|
* @param <T> flag type
|
||||||
|
* @param <V> flag value type
|
||||||
* @see #addAll(Collection) to add multiple flags
|
* @see #addAll(Collection) to add multiple flags
|
||||||
*/
|
*/
|
||||||
public <V, T extends PlotFlag<V, ?>> void addFlag(final T flag) {
|
public <V, T extends PlotFlag<V, ?>> void addFlag(final T flag) {
|
||||||
@ -158,6 +160,9 @@ public class FlagContainer {
|
|||||||
* Remove a flag from the container
|
* Remove a flag from the container
|
||||||
*
|
*
|
||||||
* @param flag Flag to remove
|
* @param flag Flag to remove
|
||||||
|
* @param <T> flag type
|
||||||
|
* @param <V> flag value type
|
||||||
|
* @return value of flag removed
|
||||||
*/
|
*/
|
||||||
public <V, T extends PlotFlag<V, ?>> V removeFlag(final T flag) {
|
public <V, T extends PlotFlag<V, ?>> V removeFlag(final T flag) {
|
||||||
final Object value = this.flagMap.remove(flag.getClass());
|
final Object value = this.flagMap.remove(flag.getClass());
|
||||||
@ -224,6 +229,7 @@ public class FlagContainer {
|
|||||||
* with wildcard generic types.
|
* with wildcard generic types.
|
||||||
*
|
*
|
||||||
* @param flagClass The {@link PlotFlag} class.
|
* @param flagClass The {@link PlotFlag} class.
|
||||||
|
* @return the plot flag
|
||||||
*/
|
*/
|
||||||
public PlotFlag<?, ?> getFlagErased(Class<?> flagClass) {
|
public PlotFlag<?, ?> getFlagErased(Class<?> flagClass) {
|
||||||
final PlotFlag<?, ?> flag = this.flagMap.get(flagClass);
|
final PlotFlag<?, ?> flag = this.flagMap.get(flagClass);
|
||||||
|
@ -62,10 +62,10 @@ public abstract class NumberFlag<N extends Number & Comparable<N>, F extends Plo
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the raw string input to the number type.
|
* Parse the raw string input to the number type.
|
||||||
* Throw a {@link FlagParseException} if the number couldn't be parsed.
|
|
||||||
*
|
*
|
||||||
* @param input the string to parse the number from.
|
* @param input the string to parse the number from.
|
||||||
* @return the parsed number.
|
* @return the parsed number.
|
||||||
|
* @throws FlagParseException if the number couldn't be parsed.
|
||||||
*/
|
*/
|
||||||
@Nonnull protected abstract N parseNumber(String input) throws FlagParseException;
|
@Nonnull protected abstract N parseNumber(String input) throws FlagParseException;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,8 @@ public class AreaBoundDelegateQueueCoordinator extends DelegateQueueCoordinator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the plot area block settings is limited to
|
* Gets the plot area block settings is limited to
|
||||||
|
*
|
||||||
|
* @return PlotArea
|
||||||
*/
|
*/
|
||||||
public PlotArea getArea() {
|
public PlotArea getArea() {
|
||||||
return this.area;
|
return this.area;
|
||||||
|
@ -201,6 +201,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the int[x,z] chunk coordinates where regeneration should start from
|
* Gets the int[x,z] chunk coordinates where regeneration should start from
|
||||||
|
*
|
||||||
|
* @return int[x, z] of regen start
|
||||||
*/
|
*/
|
||||||
public int[] getRegenStart() {
|
public int[] getRegenStart() {
|
||||||
return regenStart;
|
return regenStart;
|
||||||
@ -208,6 +210,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the int[x,z] chunk coordinates where regeneration should finish
|
* Gets the int[x,z] chunk coordinates where regeneration should finish
|
||||||
|
*
|
||||||
|
* @return int[x, z] of regen end
|
||||||
*/
|
*/
|
||||||
public int[] getRegenEnd() {
|
public int[] getRegenEnd() {
|
||||||
return regenEnd;
|
return regenEnd;
|
||||||
@ -215,6 +219,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the queue has a start/end to chunk regeneration
|
* Whether the queue has a start/end to chunk regeneration
|
||||||
|
*
|
||||||
|
* @return if is regenerating queue with int[x,z] start and end
|
||||||
*/
|
*/
|
||||||
public boolean isRegen() {
|
public boolean isRegen() {
|
||||||
return regen;
|
return regen;
|
||||||
@ -222,6 +228,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the map of ChunkCoordinates in {@link BlockVector2} form against the {@link LocalChunk} of cached chunks to be written
|
* Gets the map of ChunkCoordinates in {@link BlockVector2} form against the {@link LocalChunk} of cached chunks to be written
|
||||||
|
*
|
||||||
|
* @return ConcurrentHashMap of chunks to be accessed
|
||||||
*/
|
*/
|
||||||
@Nonnull public ConcurrentHashMap<BlockVector2, LocalChunk> getBlockChunks() {
|
@Nonnull public ConcurrentHashMap<BlockVector2, LocalChunk> getBlockChunks() {
|
||||||
return this.blockChunks;
|
return this.blockChunks;
|
||||||
@ -229,6 +237,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Forces an {@link LocalChunk} into the list of chunks to be written. Overwrites existing chunks in the map
|
* Forces an {@link LocalChunk} into the list of chunks to be written. Overwrites existing chunks in the map
|
||||||
|
*
|
||||||
|
* @param chunk add a LocalChunk to be written to by the queue
|
||||||
*/
|
*/
|
||||||
public final void setChunk(@Nonnull LocalChunk chunk) {
|
public final void setChunk(@Nonnull LocalChunk chunk) {
|
||||||
this.blockChunks.put(BlockVector2.at(chunk.getX(), chunk.getZ()), chunk);
|
this.blockChunks.put(BlockVector2.at(chunk.getX(), chunk.getZ()), chunk);
|
||||||
|
@ -62,6 +62,9 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the world
|
* Set the world
|
||||||
|
*
|
||||||
|
* @param world world
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder inWorld(@Nonnull final World world) {
|
@Nonnull public ChunkCoordinatorBuilder inWorld(@Nonnull final World world) {
|
||||||
this.world = Preconditions.checkNotNull(world, "World may not be null");
|
this.world = Preconditions.checkNotNull(world, "World may not be null");
|
||||||
@ -70,6 +73,9 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a chunk to be accessed
|
* Add a chunk to be accessed
|
||||||
|
*
|
||||||
|
* @param chunkLocation BlockVector2 of chunk to add
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder withChunk(@Nonnull final BlockVector2 chunkLocation) {
|
@Nonnull public ChunkCoordinatorBuilder withChunk(@Nonnull final BlockVector2 chunkLocation) {
|
||||||
this.requestedChunks.add(Preconditions.checkNotNull(chunkLocation, "Chunk location may not be null"));
|
this.requestedChunks.add(Preconditions.checkNotNull(chunkLocation, "Chunk location may not be null"));
|
||||||
@ -78,6 +84,9 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a Collection of chunks to be accessed
|
* Add a Collection of chunks to be accessed
|
||||||
|
*
|
||||||
|
* @param chunkLocations Collection of BlockVector2 to add
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder withChunks(@Nonnull final Collection<BlockVector2> chunkLocations) {
|
@Nonnull public ChunkCoordinatorBuilder withChunks(@Nonnull final Collection<BlockVector2> chunkLocations) {
|
||||||
chunkLocations.forEach(this::withChunk);
|
chunkLocations.forEach(this::withChunk);
|
||||||
@ -86,6 +95,10 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add chunks within a region to be accessed
|
* Add chunks within a region to be accessed
|
||||||
|
*
|
||||||
|
* @param pos1 minimum region location
|
||||||
|
* @param pos2 maximum region location
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder withRegion(@Nonnull Location pos1, @Nonnull Location pos2) {
|
@Nonnull public ChunkCoordinatorBuilder withRegion(@Nonnull Location pos1, @Nonnull Location pos2) {
|
||||||
final int p1x = pos1.getX();
|
final int p1x = pos1.getX();
|
||||||
@ -110,6 +123,9 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the consumer to be used when a chunk is loaded
|
* Set the consumer to be used when a chunk is loaded
|
||||||
|
*
|
||||||
|
* @param chunkConsumer Consumer to be used by the ChunkCoordinator
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder withConsumer(@Nonnull final Consumer<BlockVector2> chunkConsumer) {
|
@Nonnull public ChunkCoordinatorBuilder withConsumer(@Nonnull final Consumer<BlockVector2> chunkConsumer) {
|
||||||
this.chunkConsumer = Preconditions.checkNotNull(chunkConsumer, "Chunk consumer may not be null");
|
this.chunkConsumer = Preconditions.checkNotNull(chunkConsumer, "Chunk consumer may not be null");
|
||||||
@ -118,6 +134,9 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Runnable to run when all chunks have been accessed
|
* Set the Runnable to run when all chunks have been accessed
|
||||||
|
*
|
||||||
|
* @param whenDone task to run when all chunks are accessed
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder withFinalAction(@Nullable final Runnable whenDone) {
|
@Nonnull public ChunkCoordinatorBuilder withFinalAction(@Nullable final Runnable whenDone) {
|
||||||
if (whenDone == null) {
|
if (whenDone == null) {
|
||||||
@ -129,6 +148,9 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the max time taken while iterating over and accessing loaded chunks
|
* Set the max time taken while iterating over and accessing loaded chunks
|
||||||
|
*
|
||||||
|
* @param maxIterationTime max iteration time
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder withMaxIterationTime(final long maxIterationTime) {
|
@Nonnull public ChunkCoordinatorBuilder withMaxIterationTime(final long maxIterationTime) {
|
||||||
Preconditions.checkArgument(maxIterationTime > 0, "Max iteration time must be positive");
|
Preconditions.checkArgument(maxIterationTime > 0, "Max iteration time must be positive");
|
||||||
@ -138,6 +160,9 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the initial batch size to be used for loading chunks
|
* Set the initial batch size to be used for loading chunks
|
||||||
|
*
|
||||||
|
* @param initialBatchSize initial batch size
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder withInitialBatchSize(final int initialBatchSize) {
|
@Nonnull public ChunkCoordinatorBuilder withInitialBatchSize(final int initialBatchSize) {
|
||||||
Preconditions.checkArgument(initialBatchSize > 0, "Initial batch size must be positive");
|
Preconditions.checkArgument(initialBatchSize > 0, "Initial batch size must be positive");
|
||||||
@ -147,6 +172,9 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the consumer to be used to handle {@link Throwable}s
|
* Set the consumer to be used to handle {@link Throwable}s
|
||||||
|
*
|
||||||
|
* @param throwableConsumer consumer to hanble throwables
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder withThrowableConsumer(@Nonnull final Consumer<Throwable> throwableConsumer) {
|
@Nonnull public ChunkCoordinatorBuilder withThrowableConsumer(@Nonnull final Consumer<Throwable> throwableConsumer) {
|
||||||
this.throwableConsumer = Preconditions.checkNotNull(throwableConsumer, "Throwable consumer may not be null");
|
this.throwableConsumer = Preconditions.checkNotNull(throwableConsumer, "Throwable consumer may not be null");
|
||||||
@ -156,6 +184,9 @@ public class ChunkCoordinatorBuilder {
|
|||||||
/**
|
/**
|
||||||
* Set whether the chunks should be allow to unload after being accessed. This should only be used where the chunks are read from
|
* Set whether the chunks should be allow to unload after being accessed. This should only be used where the chunks are read from
|
||||||
* and then written to from a separate queue where they're consequently unloaded.
|
* and then written to from a separate queue where they're consequently unloaded.
|
||||||
|
*
|
||||||
|
* @param unloadAfter if to unload chuns afterwards
|
||||||
|
* @return this ChunkCoordinatorBuilder instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinatorBuilder unloadAfter(final boolean unloadAfter) {
|
@Nonnull public ChunkCoordinatorBuilder unloadAfter(final boolean unloadAfter) {
|
||||||
this.unloadAfter = unloadAfter;
|
this.unloadAfter = unloadAfter;
|
||||||
@ -164,6 +195,8 @@ public class ChunkCoordinatorBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link ChunkCoordinator} instance based on the values in the Builder instance.
|
* Create a new {@link ChunkCoordinator} instance based on the values in the Builder instance.
|
||||||
|
*
|
||||||
|
* @return a new ChunkCoordinator
|
||||||
*/
|
*/
|
||||||
@Nonnull public ChunkCoordinator build() {
|
@Nonnull public ChunkCoordinator build() {
|
||||||
Preconditions.checkNotNull(this.world, "No world was supplied");
|
Preconditions.checkNotNull(this.world, "No world was supplied");
|
||||||
|
@ -45,6 +45,9 @@ public class GlobalBlockQueue {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a new {@link QueueCoordinator} for the given world.
|
* Get a new {@link QueueCoordinator} for the given world.
|
||||||
|
*
|
||||||
|
* @param world world to get new queue for
|
||||||
|
* @return new QueueCoordinator for world
|
||||||
*/
|
*/
|
||||||
@Nonnull public QueueCoordinator getNewQueue(@Nonnull World world) {
|
@Nonnull public QueueCoordinator getNewQueue(@Nonnull World world) {
|
||||||
QueueCoordinator queue = provider.getNewQueue(world);
|
QueueCoordinator queue = provider.getNewQueue(world);
|
||||||
|
@ -54,6 +54,8 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor requires world to indicate any extents given to {@link QueueCoordinator} also need this constructor.
|
* Default constructor requires world to indicate any extents given to {@link QueueCoordinator} also need this constructor.
|
||||||
|
*
|
||||||
|
* @param world world as all queues should have this constructor
|
||||||
*/
|
*/
|
||||||
public QueueCoordinator(@Nullable World world) {
|
public QueueCoordinator(@Nullable World world) {
|
||||||
PlotSquared.platform().getInjector().injectMembers(this);
|
PlotSquared.platform().getInjector().injectMembers(this);
|
||||||
@ -61,6 +63,10 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@link ScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
|
* Get a {@link ScopedQueueCoordinator} limited to the chunk at the specific chunk Coordinates
|
||||||
|
*
|
||||||
|
* @param x chunk x coordinate
|
||||||
|
* @param z chunk z coordinate
|
||||||
|
* @return a new {@link ScopedQueueCoordinator}
|
||||||
*/
|
*/
|
||||||
public ScopedQueueCoordinator getForChunk(int x, int z) {
|
public ScopedQueueCoordinator getForChunk(int x, int z) {
|
||||||
int bx = x << 4;
|
int bx = x << 4;
|
||||||
@ -71,16 +77,22 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of the queue in chunks
|
* Get the size of the queue in chunks
|
||||||
|
*
|
||||||
|
* @return size
|
||||||
*/
|
*/
|
||||||
public abstract int size();
|
public abstract int size();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set when the queue was last modified
|
* Set when the queue was last modified
|
||||||
|
*
|
||||||
|
* @param modified long of system millis
|
||||||
*/
|
*/
|
||||||
public abstract void setModified(long modified);
|
public abstract void setModified(long modified);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the queue should be forced to be synchronous when enqueued.
|
* Returns true if the queue should be forced to be synchronous when enqueued.
|
||||||
|
*
|
||||||
|
* @return is force sync
|
||||||
*/
|
*/
|
||||||
public boolean isForceSync() {
|
public boolean isForceSync() {
|
||||||
return forceSync;
|
return forceSync;
|
||||||
@ -88,6 +100,8 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether the queue should be forced to be synchronous
|
* Set whether the queue should be forced to be synchronous
|
||||||
|
*
|
||||||
|
* @param forceSync force sync or not
|
||||||
*/
|
*/
|
||||||
public void setForceSync(boolean forceSync) {
|
public void setForceSync(boolean forceSync) {
|
||||||
this.forceSync = forceSync;
|
this.forceSync = forceSync;
|
||||||
@ -95,6 +109,8 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Chunk Object set to the queue
|
* Get the Chunk Object set to the queue
|
||||||
|
*
|
||||||
|
* @return chunk object. Usually the implementation-specific chunk (e.g. bukkit Chunk)
|
||||||
*/
|
*/
|
||||||
@Nullable public Object getChunkObject() {
|
@Nullable public Object getChunkObject() {
|
||||||
return chunkObject;
|
return chunkObject;
|
||||||
@ -102,6 +118,8 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a chunk object (e.g. the Bukkit Chunk object) to the queue
|
* Set a chunk object (e.g. the Bukkit Chunk object) to the queue
|
||||||
|
*
|
||||||
|
* @param chunkObject chunk object. Usually the implementation-specific chunk (e.g. bukkit Chunk)
|
||||||
*/
|
*/
|
||||||
public void setChunkObject(@Nonnull Object chunkObject) {
|
public void setChunkObject(@Nonnull Object chunkObject) {
|
||||||
this.chunkObject = chunkObject;
|
this.chunkObject = chunkObject;
|
||||||
@ -114,6 +132,7 @@ public abstract class QueueCoordinator {
|
|||||||
* @param y the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
|
* @param y the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
|
||||||
* @param z the z coordinate from 0 to 15 inclusive
|
* @param z the z coordinate from 0 to 15 inclusive
|
||||||
* @param id the BlockState to set the block to
|
* @param id the BlockState to set the block to
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean setBlock(final int x, final int y, final int z, @Nonnull final BlockState id);
|
public abstract boolean setBlock(final int x, final int y, final int z, @Nonnull final BlockState id);
|
||||||
|
|
||||||
@ -124,6 +143,7 @@ public abstract class QueueCoordinator {
|
|||||||
* @param y the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
|
* @param y the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
|
||||||
* @param z the z coordinate from 0 to 15 inclusive
|
* @param z the z coordinate from 0 to 15 inclusive
|
||||||
* @param id the BaseBlock to set the block to
|
* @param id the BaseBlock to set the block to
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean setBlock(final int x, final int y, final int z, @Nonnull final BaseBlock id);
|
public abstract boolean setBlock(final int x, final int y, final int z, @Nonnull final BaseBlock id);
|
||||||
|
|
||||||
@ -134,6 +154,7 @@ public abstract class QueueCoordinator {
|
|||||||
* @param y the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
|
* @param y the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
|
||||||
* @param z the z coordinate from 0 to 15 inclusive
|
* @param z the z coordinate from 0 to 15 inclusive
|
||||||
* @param pattern the pattern to set the block to
|
* @param pattern the pattern to set the block to
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean setBlock(final int x, final int y, final int z, @Nonnull final Pattern pattern) {
|
public boolean setBlock(final int x, final int y, final int z, @Nonnull final Pattern pattern) {
|
||||||
return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z));
|
return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z));
|
||||||
@ -146,36 +167,59 @@ public abstract class QueueCoordinator {
|
|||||||
* @param y the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
|
* @param y the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
|
||||||
* @param z the z coordinate from 0 to 15 inclusive
|
* @param z the z coordinate from 0 to 15 inclusive
|
||||||
* @param tag the CompoundTag to set the tile to
|
* @param tag the CompoundTag to set the tile to
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean setTile(int x, int y, int z, @Nonnull CompoundTag tag);
|
public abstract boolean setTile(int x, int y, int z, @Nonnull CompoundTag tag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the queue has any tiles being set
|
* Whether the queue has any tiles being set
|
||||||
|
*
|
||||||
|
* @return if setting tiles
|
||||||
*/
|
*/
|
||||||
public abstract boolean isSettingTiles();
|
public abstract boolean isSettingTiles();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a block at the given coordinates.
|
* Get a block at the given coordinates.
|
||||||
|
*
|
||||||
|
* @param x block x
|
||||||
|
* @param y block y
|
||||||
|
* @param z block z
|
||||||
|
* @return WorldEdit BlockState
|
||||||
*/
|
*/
|
||||||
@Nullable public abstract BlockState getBlock(int x, int y, int z);
|
@Nullable public abstract BlockState getBlock(int x, int y, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a biome in XZ. This will likely set to the whole column
|
* Set a biome in XZ. This will likely set to the whole column
|
||||||
|
*
|
||||||
|
* @param x x coordinate
|
||||||
|
* @param z z coordinate
|
||||||
|
* @param biome biome
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
@Deprecated public abstract boolean setBiome(int x, int z, @Nonnull BiomeType biome);
|
@Deprecated public abstract boolean setBiome(int x, int z, @Nonnull BiomeType biome);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a biome in XYZ
|
* Set a biome in XYZ
|
||||||
|
*
|
||||||
|
* @param x x coordinate
|
||||||
|
* @param y y coordinate
|
||||||
|
* @param z z coordinate
|
||||||
|
* @param biome biome
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean setBiome(int x, int y, int z, @Nonnull BiomeType biome);
|
public abstract boolean setBiome(int x, int y, int z, @Nonnull BiomeType biome);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the queue has any biomes to be set
|
* Whether the queue has any biomes to be set
|
||||||
|
*
|
||||||
|
* @return if setting biomes
|
||||||
*/
|
*/
|
||||||
public abstract boolean isSettingBiomes();
|
public abstract boolean isSettingBiomes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add entities to be created
|
* Add entities to be created
|
||||||
|
*
|
||||||
|
* @param entities list of entities to add to queue
|
||||||
*/
|
*/
|
||||||
public void addEntities(@Nonnull List<? extends Entity> entities) {
|
public void addEntities(@Nonnull List<? extends Entity> entities) {
|
||||||
for (Entity e : entities) {
|
for (Entity e : entities) {
|
||||||
@ -185,51 +229,73 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an entity to be created
|
* Add an entity to be created
|
||||||
|
*
|
||||||
|
* @param entity entity to add to queue
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean setEntity(@Nonnull Entity entity);
|
public abstract boolean setEntity(@Nonnull Entity entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of chunks that are added manually. This usually indicated the queue is "read only".
|
* Get the list of chunks that are added manually. This usually indicated the queue is "read only".
|
||||||
|
*
|
||||||
|
* @return list of BlockVector2 of chunks that are to be "read"
|
||||||
*/
|
*/
|
||||||
@Nonnull public abstract List<BlockVector2> getReadChunks();
|
@Nonnull public abstract List<BlockVector2> getReadChunks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a set of {@link BlockVector2} Chunk coordinates to the Read Chunks list
|
* Add a set of {@link BlockVector2} Chunk coordinates to the Read Chunks list
|
||||||
|
*
|
||||||
|
* @param readChunks set of BlockVector2 to add to "read" chunks
|
||||||
*/
|
*/
|
||||||
public abstract void addReadChunks(@Nonnull Set<BlockVector2> readChunks);
|
public abstract void addReadChunks(@Nonnull Set<BlockVector2> readChunks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a {@link BlockVector2} Chunk coordinate to the Read Chunks list
|
* Add a {@link BlockVector2} Chunk coordinate to the Read Chunks list
|
||||||
|
*
|
||||||
|
* @param chunk BlockVector2 to add to "read" chunks
|
||||||
*/
|
*/
|
||||||
public abstract void addReadChunk(@Nonnull BlockVector2 chunk);
|
public abstract void addReadChunk(@Nonnull BlockVector2 chunk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether chunks should be unloaded after being accessed
|
* Whether chunks should be unloaded after being accessed
|
||||||
|
*
|
||||||
|
* @return if is unloading chunks after accessing them
|
||||||
*/
|
*/
|
||||||
public abstract boolean isUnloadAfter();
|
public abstract boolean isUnloadAfter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether chunks should be unloaded after being accessed
|
* Set whether chunks should be unloaded after being accessed
|
||||||
|
*
|
||||||
|
* @param unloadAfter if to unload chunks after being accessed
|
||||||
*/
|
*/
|
||||||
public abstract void setUnloadAfter(boolean unloadAfter);
|
public abstract void setUnloadAfter(boolean unloadAfter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link CuboidRegion} designated for direct regeneration
|
* Get the {@link CuboidRegion} designated for direct regeneration
|
||||||
|
*
|
||||||
|
* @return CuboidRegion to regenerate
|
||||||
*/
|
*/
|
||||||
@Nullable public abstract CuboidRegion getRegenRegion();
|
@Nullable public abstract CuboidRegion getRegenRegion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link CuboidRegion} designated for direct regeneration
|
* Set the {@link CuboidRegion} designated for direct regeneration
|
||||||
|
*
|
||||||
|
* @param regenRegion CuboidRegion to regenerate
|
||||||
*/
|
*/
|
||||||
public abstract void setRegenRegion(@Nonnull CuboidRegion regenRegion);
|
public abstract void setRegenRegion(@Nonnull CuboidRegion regenRegion);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a specific chunk at the chunk coordinates XZ to be regenerated.
|
* Set a specific chunk at the chunk coordinates XZ to be regenerated.
|
||||||
|
*
|
||||||
|
* @param x chunk x
|
||||||
|
* @param z chunk z
|
||||||
*/
|
*/
|
||||||
public abstract void regenChunk(int x, int z);
|
public abstract void regenChunk(int x, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the world the queue is writing to
|
* Get the world the queue is writing to
|
||||||
|
*
|
||||||
|
* @return world of the queue
|
||||||
*/
|
*/
|
||||||
@Nullable public abstract World getWorld();
|
@Nullable public abstract World getWorld();
|
||||||
|
|
||||||
@ -242,6 +308,8 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueue the queue with the {@link GlobalBlockQueue}
|
* Enqueue the queue with the {@link GlobalBlockQueue}
|
||||||
|
*
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean enqueue() {
|
public boolean enqueue() {
|
||||||
return blockQueue.enqueue(this);
|
return blockQueue.enqueue(this);
|
||||||
@ -259,26 +327,38 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the task to be run when all chunks have been accessed
|
* Get the task to be run when all chunks have been accessed
|
||||||
|
*
|
||||||
|
* @return task to be run when queue is complete
|
||||||
*/
|
*/
|
||||||
public abstract Runnable getCompleteTask();
|
public abstract Runnable getCompleteTask();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the task to be run when all chunks have been accessed
|
* Set the task to be run when all chunks have been accessed
|
||||||
|
*
|
||||||
|
* @param whenDone task to be run when queue is complete
|
||||||
*/
|
*/
|
||||||
public abstract void setCompleteTask(@Nullable Runnable whenDone);
|
public abstract void setCompleteTask(@Nullable Runnable whenDone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the chunk consumer set to the queue or null if one is not set
|
* Return the chunk consumer set to the queue or null if one is not set
|
||||||
|
*
|
||||||
|
* @return Consumer to be executed on each chunk in queue
|
||||||
*/
|
*/
|
||||||
@Nullable public abstract Consumer<BlockVector2> getChunkConsumer();
|
@Nullable public abstract Consumer<BlockVector2> getChunkConsumer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Consumer that will
|
* Set the Consumer that will be executed on each chunk in queue
|
||||||
|
*
|
||||||
|
* @param consumer Consumer to be executed on each chunk in queue
|
||||||
*/
|
*/
|
||||||
public abstract void setChunkConsumer(@Nonnull Consumer<BlockVector2> consumer);
|
public abstract void setChunkConsumer(@Nonnull Consumer<BlockVector2> consumer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill a cuboid between two positions with a BlockState
|
* Fill a cuboid between two positions with a BlockState
|
||||||
|
*
|
||||||
|
* @param pos1 1st cuboid position
|
||||||
|
* @param pos2 2nd cuboid position
|
||||||
|
* @param block block to fill
|
||||||
*/
|
*/
|
||||||
public void setCuboid(@Nonnull Location pos1, @Nonnull Location pos2, @Nonnull BlockState block) {
|
public void setCuboid(@Nonnull Location pos1, @Nonnull Location pos2, @Nonnull BlockState block) {
|
||||||
int yMin = Math.min(pos1.getY(), pos2.getY());
|
int yMin = Math.min(pos1.getY(), pos2.getY());
|
||||||
@ -298,6 +378,10 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill a cuboid between two positions with a Pattern
|
* Fill a cuboid between two positions with a Pattern
|
||||||
|
*
|
||||||
|
* @param pos1 1st cuboid position
|
||||||
|
* @param pos2 2nd cuboid position
|
||||||
|
* @param blocks pattern to fill
|
||||||
*/
|
*/
|
||||||
public void setCuboid(@Nonnull Location pos1, @Nonnull Location pos2, @Nonnull Pattern blocks) {
|
public void setCuboid(@Nonnull Location pos1, @Nonnull Location pos2, @Nonnull Pattern blocks) {
|
||||||
int yMin = Math.min(pos1.getY(), pos2.getY());
|
int yMin = Math.min(pos1.getY(), pos2.getY());
|
||||||
@ -317,6 +401,10 @@ public abstract class QueueCoordinator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill a cuboid between two positions with a BiomeType
|
* Fill a cuboid between two positions with a BiomeType
|
||||||
|
*
|
||||||
|
* @param pos1 1st cuboid position
|
||||||
|
* @param pos2 2nd cuboid position
|
||||||
|
* @param biome biome to fill
|
||||||
*/
|
*/
|
||||||
public void setBiomeCuboid(@Nonnull Location pos1, @Nonnull Location pos2, @Nonnull BiomeType biome) {
|
public void setBiomeCuboid(@Nonnull Location pos1, @Nonnull Location pos2, @Nonnull BiomeType biome) {
|
||||||
int yMin = Math.min(pos1.getY(), pos2.getY());
|
int yMin = Math.min(pos1.getY(), pos2.getY());
|
||||||
|
@ -57,6 +57,9 @@ public abstract class QueueProvider {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a queue for the given world
|
* Get a queue for the given world
|
||||||
|
*
|
||||||
|
* @param world world
|
||||||
|
* @return new QueueCoordinator
|
||||||
*/
|
*/
|
||||||
public abstract QueueCoordinator getNewQueue(@Nonnull World world);
|
public abstract QueueCoordinator getNewQueue(@Nonnull World world);
|
||||||
}
|
}
|
||||||
|
@ -207,11 +207,11 @@ public class MathMan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns [x, y, z]
|
* get the x,y,z unit vector from pitch and yaw specified
|
||||||
*
|
*
|
||||||
* @param yaw
|
* @param yaw yaw
|
||||||
* @param pitch
|
* @param pitch pitch
|
||||||
* @return
|
* @return x,y,z unit vector
|
||||||
*/
|
*/
|
||||||
public static float[] getDirection(float yaw, float pitch) {
|
public static float[] getDirection(float yaw, float pitch) {
|
||||||
double pitch_sin = Math.sin(pitch);
|
double pitch_sin = Math.sin(pitch);
|
||||||
@ -234,10 +234,10 @@ public class MathMan {
|
|||||||
/**
|
/**
|
||||||
* Returns [ pitch, yaw ]
|
* Returns [ pitch, yaw ]
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x x
|
||||||
* @param y
|
* @param y y
|
||||||
* @param z
|
* @param z z
|
||||||
* @return
|
* @return pitch and yaw of x,y,z from 0,0,0
|
||||||
*/
|
*/
|
||||||
public static float[] getPitchAndYaw(float x, float y, float z) {
|
public static float[] getPitchAndYaw(float x, float y, float z) {
|
||||||
float distance = sqrtApprox((z * z) + (x * x));
|
float distance = sqrtApprox((z * z) + (x * x));
|
||||||
|
@ -48,6 +48,7 @@ public class Permissions {
|
|||||||
/**
|
/**
|
||||||
* Check if the owner of the profile has a given (global) permission
|
* Check if the owner of the profile has a given (global) permission
|
||||||
*
|
*
|
||||||
|
* @param caller permission holder
|
||||||
* @param permission Permission
|
* @param permission Permission
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
* @return {@code true} if the owner has the given permission, else {@code false}
|
||||||
*/
|
*/
|
||||||
@ -58,6 +59,7 @@ public class Permissions {
|
|||||||
/**
|
/**
|
||||||
* Check if the owner of the profile has a given (global) permission
|
* Check if the owner of the profile has a given (global) permission
|
||||||
*
|
*
|
||||||
|
* @param caller permission holder
|
||||||
* @param permission Permission
|
* @param permission Permission
|
||||||
* @return {@code true} if the owner has the given permission, else {@code false}
|
* @return {@code true} if the owner has the given permission, else {@code false}
|
||||||
*/
|
*/
|
||||||
@ -68,10 +70,10 @@ public class Permissions {
|
|||||||
/**
|
/**
|
||||||
* Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable.
|
* Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player permission holder
|
||||||
* @param permission
|
* @param permission permission
|
||||||
* @param notify
|
* @param notify if to notify the permission holder
|
||||||
* @return
|
* @return if permission is had
|
||||||
*/
|
*/
|
||||||
public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
|
public static boolean hasPermission(PlotPlayer<?> player, String permission, boolean notify) {
|
||||||
if (!hasPermission(player, permission)) {
|
if (!hasPermission(player, permission)) {
|
||||||
|
@ -60,6 +60,8 @@ public class PremiumVerification {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this plugin is premium
|
* Returns true if this plugin is premium
|
||||||
|
*
|
||||||
|
* @return if is premium
|
||||||
*/
|
*/
|
||||||
public static Boolean isPremium() {
|
public static Boolean isPremium() {
|
||||||
return usingPremium == null ? (usingPremium = isPremium(getUserID())) : usingPremium;
|
return usingPremium == null ? (usingPremium = isPremium(getUserID())) : usingPremium;
|
||||||
|
@ -130,7 +130,7 @@ public class ReflectionUtils {
|
|||||||
* @param name name
|
* @param name name
|
||||||
* @param types method parameters. can be Class or RefClass
|
* @param types method parameters. can be Class or RefClass
|
||||||
* @return RefMethod object
|
* @return RefMethod object
|
||||||
* @throws RuntimeException if method not found
|
* @throws NoSuchMethodException if method not found
|
||||||
*/
|
*/
|
||||||
public RefMethod getMethod(String name, Object... types) throws NoSuchMethodException {
|
public RefMethod getMethod(String name, Object... types) throws NoSuchMethodException {
|
||||||
Class[] classes = new Class[types.length];
|
Class[] classes = new Class[types.length];
|
||||||
@ -156,7 +156,7 @@ public class ReflectionUtils {
|
|||||||
*
|
*
|
||||||
* @param name field name
|
* @param name field name
|
||||||
* @return RefField
|
* @return RefField
|
||||||
* @throws RuntimeException if field not found
|
* @throws NoSuchFieldException if field not found
|
||||||
*/
|
*/
|
||||||
public RefField getField(String name) throws NoSuchFieldException {
|
public RefField getField(String name) throws NoSuchFieldException {
|
||||||
try {
|
try {
|
||||||
@ -242,8 +242,8 @@ public class ReflectionUtils {
|
|||||||
*
|
*
|
||||||
* @param params parameters for constructor
|
* @param params parameters for constructor
|
||||||
* @return new object
|
* @return new object
|
||||||
* @throws ReflectiveOperationException
|
* @throws ReflectiveOperationException reflective operation exception
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException illegal argument exception
|
||||||
*/
|
*/
|
||||||
public Object create(Object... params)
|
public Object create(Object... params)
|
||||||
throws ReflectiveOperationException, IllegalArgumentException {
|
throws ReflectiveOperationException, IllegalArgumentException {
|
||||||
|
@ -78,6 +78,9 @@ public abstract class RegionManager {
|
|||||||
* 3 = Mob
|
* 3 = Mob
|
||||||
* 4 = Boat
|
* 4 = Boat
|
||||||
* 5 = Misc
|
* 5 = Misc
|
||||||
|
*
|
||||||
|
* @param plot plot
|
||||||
|
* @return array of counts of entity types
|
||||||
*/
|
*/
|
||||||
public abstract int[] countEntities(Plot plot);
|
public abstract int[] countEntities(Plot plot);
|
||||||
|
|
||||||
@ -98,6 +101,11 @@ public abstract class RegionManager {
|
|||||||
/**
|
/**
|
||||||
* Set a number of cuboids to a certain block between two y values.
|
* Set a number of cuboids to a certain block between two y values.
|
||||||
*
|
*
|
||||||
|
* @param area plot area
|
||||||
|
* @param regions cuboid regions
|
||||||
|
* @param blocks pattern
|
||||||
|
* @param minY y to set from
|
||||||
|
* @param maxY y to set to
|
||||||
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
* @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
|
||||||
* otherwise writes to the queue but does not enqueue.
|
* otherwise writes to the queue but does not enqueue.
|
||||||
* @return true if not enqueued, otherwise whether the created queue enqueued.
|
* @return true if not enqueued, otherwise whether the created queue enqueued.
|
||||||
@ -124,6 +132,7 @@ public abstract class RegionManager {
|
|||||||
/**
|
/**
|
||||||
* Notify any plugins that may want to modify clear behaviour that a clear is occuring
|
* Notify any plugins that may want to modify clear behaviour that a clear is occuring
|
||||||
*
|
*
|
||||||
|
* @param manager plot manager
|
||||||
* @return true if the notified will accept the clear task
|
* @return true if the notified will accept the clear task
|
||||||
*/
|
*/
|
||||||
public boolean notifyClear(PlotManager manager) {
|
public boolean notifyClear(PlotManager manager) {
|
||||||
@ -133,12 +142,21 @@ public abstract class RegionManager {
|
|||||||
/**
|
/**
|
||||||
* Only called when {@link RegionManager#notifyClear(PlotManager)} returns true in specific PlotManagers
|
* Only called when {@link RegionManager#notifyClear(PlotManager)} returns true in specific PlotManagers
|
||||||
*
|
*
|
||||||
|
* @param plot plot
|
||||||
|
* @param whenDone task to run when complete
|
||||||
|
* @param manager plot manager
|
||||||
* @return true if the clear worked. False if someone went wrong so P2 can then handle the clear
|
* @return true if the clear worked. False if someone went wrong so P2 can then handle the clear
|
||||||
*/
|
*/
|
||||||
public abstract boolean handleClear(Plot plot, final Runnable whenDone, PlotManager manager);
|
public abstract boolean handleClear(Plot plot, final Runnable whenDone, PlotManager manager);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy a region to a new location (in the same world)
|
* Copy a region to a new location (in the same world)
|
||||||
|
*
|
||||||
|
* @param pos1 position 1
|
||||||
|
* @param pos2 position 2
|
||||||
|
* @param newPos position to move pos1 to
|
||||||
|
* @param whenDone task to run when complete
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public boolean copyRegion(final Location pos1, final Location pos2, final Location newPos, final Runnable whenDone) {
|
public boolean copyRegion(final Location pos1, final Location pos2, final Location newPos, final Runnable whenDone) {
|
||||||
final int relX = newPos.getX() - pos1.getX();
|
final int relX = newPos.getX() - pos1.getX();
|
||||||
@ -152,14 +170,19 @@ public abstract class RegionManager {
|
|||||||
copyFrom
|
copyFrom
|
||||||
.addReadChunks(new CuboidRegion(BlockVector3.at(pos1.getX(), 0, pos1.getZ()), BlockVector3.at(pos2.getX(), 0, pos2.getZ())).getChunks());
|
.addReadChunks(new CuboidRegion(BlockVector3.at(pos1.getX(), 0, pos1.getZ()), BlockVector3.at(pos2.getX(), 0, pos2.getZ())).getChunks());
|
||||||
copyTo.setCompleteTask(whenDone);
|
copyTo.setCompleteTask(whenDone);
|
||||||
copyFrom.enqueue();
|
return copyFrom.enqueue();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assumptions:<br>
|
* Assumptions:<br>
|
||||||
* - pos1 and pos2 are in the same plot<br>
|
* - pos1 and pos2 are in the same plot<br>
|
||||||
* It can be harmful to the world if parameters outside this scope are provided
|
* It can be harmful to the world if parameters outside this scope are provided
|
||||||
|
*
|
||||||
|
* @param pos1 position 1
|
||||||
|
* @param pos2 position 2
|
||||||
|
* @param ignoreAugment if to bypass synchronisation ish thing
|
||||||
|
* @param whenDone task to run when regeneration completed
|
||||||
|
* @return success or not
|
||||||
*/
|
*/
|
||||||
public abstract boolean regenerateRegion(Location pos1, Location pos2, boolean ignoreAugment, Runnable whenDone);
|
public abstract boolean regenerateRegion(Location pos1, Location pos2, boolean ignoreAugment, Runnable whenDone);
|
||||||
|
|
||||||
|
@ -254,7 +254,10 @@ public abstract class SchematicHandler {
|
|||||||
* @param schematic the schematic object to paste
|
* @param schematic the schematic object to paste
|
||||||
* @param plot plot to paste in
|
* @param plot plot to paste in
|
||||||
* @param xOffset offset x to paste it from plot origin
|
* @param xOffset offset x to paste it from plot origin
|
||||||
|
* @param yOffset offset y to paste it from plot origin
|
||||||
* @param zOffset offset z to paste it from plot origin
|
* @param zOffset offset z to paste it from plot origin
|
||||||
|
* @param autoHeight if to automatically choose height to paste from
|
||||||
|
* @param whenDone task to run when schematic is pasted
|
||||||
*/
|
*/
|
||||||
public void paste(final Schematic schematic,
|
public void paste(final Schematic schematic,
|
||||||
final Plot plot,
|
final Plot plot,
|
||||||
@ -357,6 +360,7 @@ public abstract class SchematicHandler {
|
|||||||
*
|
*
|
||||||
* @param name to check
|
* @param name to check
|
||||||
* @return schematic if found, else null
|
* @return schematic if found, else null
|
||||||
|
* @throws UnsupportedFormatException thrown if schematic format is unsupported
|
||||||
*/
|
*/
|
||||||
public Schematic getSchematic(String name) throws UnsupportedFormatException {
|
public Schematic getSchematic(String name) throws UnsupportedFormatException {
|
||||||
File parent = FileUtils.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.SCHEMATICS);
|
File parent = FileUtils.getFile(PlotSquared.platform().getDirectory(), Settings.Paths.SCHEMATICS);
|
||||||
@ -400,6 +404,7 @@ public abstract class SchematicHandler {
|
|||||||
*
|
*
|
||||||
* @param file to check
|
* @param file to check
|
||||||
* @return schematic if found, else null
|
* @return schematic if found, else null
|
||||||
|
* @throws UnsupportedFormatException thrown if schematic format is unsupported
|
||||||
*/
|
*/
|
||||||
public Schematic getSchematic(File file) throws UnsupportedFormatException {
|
public Schematic getSchematic(File file) throws UnsupportedFormatException {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
|
@ -150,6 +150,8 @@ public final class PlotQuery implements Iterable<Plot> {
|
|||||||
/**
|
/**
|
||||||
* Query for plots based on a search term
|
* Query for plots based on a search term
|
||||||
*
|
*
|
||||||
|
* @param searchTerm search term to use (uuid, plotID, username)
|
||||||
|
*
|
||||||
* @return The query instance
|
* @return The query instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public PlotQuery plotsBySearch(@Nonnull final String searchTerm) {
|
@Nonnull public PlotQuery plotsBySearch(@Nonnull final String searchTerm) {
|
||||||
@ -161,6 +163,8 @@ public final class PlotQuery implements Iterable<Plot> {
|
|||||||
/**
|
/**
|
||||||
* Query with a pre-defined result
|
* Query with a pre-defined result
|
||||||
*
|
*
|
||||||
|
* @param plot to return when Query is searched
|
||||||
|
*
|
||||||
* @return The query instance
|
* @return The query instance
|
||||||
*/
|
*/
|
||||||
@Nonnull public PlotQuery withPlot(@Nonnull final Plot plot) {
|
@Nonnull public PlotQuery withPlot(@Nonnull final Plot plot) {
|
||||||
|
@ -69,6 +69,7 @@ public abstract class TaskManager {
|
|||||||
*
|
*
|
||||||
* @param string String to remove
|
* @param string String to remove
|
||||||
* return {@code true} if the value was stored in the map, or {@code false}
|
* return {@code true} if the value was stored in the map, or {@code false}
|
||||||
|
* @return if string was actually removed
|
||||||
*/
|
*/
|
||||||
public static boolean removeFromTeleportQueue(@Nonnull final String string) {
|
public static boolean removeFromTeleportQueue(@Nonnull final String string) {
|
||||||
return teleportQueue.remove(string);
|
return teleportQueue.remove(string);
|
||||||
|
Loading…
Reference in New Issue
Block a user