Class AreaSelectionUtil
java.lang.Object
com.palmergames.bukkit.towny.utils.AreaSelectionUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
filterHomeBlock
(Town town, List<WorldCoord> selection) static List<WorldCoord>
filterInvalidProximityToHomeblock
(List<WorldCoord> selection, Town town) Returns a list containing only townblocks that can be claimed.static List<WorldCoord>
filterInvalidProximityTownBlocks
(List<WorldCoord> selection, Town town) Returns a list containing only townblocks that can be claimed.static List<WorldCoord>
filterOutByBiome
(org.bukkit.entity.Player player, List<WorldCoord> selection, Predicate<WorldCoord> biomeThresholdTest, String errorMsg) static List<WorldCoord>
filterOutOceanBiomeWorldCoords
(org.bukkit.entity.Player player, List<WorldCoord> selection) Returns a List containing only WorldCoords which are not composed of "too much" ocean biomes, with the threshold determined by the config.static List<WorldCoord>
filterOutResidentBlocks
(Resident resident, List<WorldCoord> selection) Returns a List containing only claimed townblocks, which are: - not personally owned by a resident who isn't the given residentstatic List<WorldCoord>
filterOutTownOwnedBlocks
(List<WorldCoord> selection) Returns a list containing only wilderness townblocks.static List<WorldCoord>
filterOutUnwantedBiomeWorldCoords
(org.bukkit.entity.Player player, List<WorldCoord> selection) Returns a List containing only WorldCoords which are not composed of "too much" bad biomes, with the threshold determined by the config.static List<WorldCoord>
filterOutWildernessBlocks
(List<WorldCoord> selection) Returns a List containing only claimed townblocks.static List<WorldCoord>
filterOwnedBlocks
(TownBlockOwner owner, List<WorldCoord> selection) Returns a List containing only claimed townblocks, owned by the given owner.static List<WorldCoord>
filterPlotsByGroup
(PlotGroup group, List<WorldCoord> selection) Gives a list of townblocks that have membership to the specified group.static List<WorldCoord>
filterPlotsForSale
(Resident resident, List<WorldCoord> selection) Gather plots that are for sale only, using a resident to determine whether they can be bought.static List<WorldCoord>
filterPlotsForSale
(List<WorldCoord> selection) Gather plots that are for sale only, currently used only for setting plots to notforsale.static List<WorldCoord>
filterPlotsNotForSale
(List<WorldCoord> selection) Gather plots that are not for sale only.static List<WorldCoord>
filterUnownedBlocks
(TownBlockOwner owner, List<WorldCoord> selection) Returns a List containing only claimed townblocks, which are not owned by the given owner.static int
getAreaSelectPivot
(String[] args) getPlotGroupsFromSelection
(List<WorldCoord> selection) static boolean
isOnEdgeOfOwnership
(TownBlockOwner owner, WorldCoord worldCoord) static boolean
isTooCloseToHomeBlock
(WorldCoord wc, Town town) Is the WorldCoord too close to another town's HomeBlock.static List<WorldCoord>
selectWorldCoordArea
(TownBlockOwner owner, WorldCoord pos, String[] args) Method to select a List<WorldCoord> of coordinates.static List<WorldCoord>
selectWorldCoordArea
(TownBlockOwner owner, WorldCoord pos, String[] args, boolean claim) Method to select a List<WorldCoord> of coordinates.
-
Constructor Details
-
AreaSelectionUtil
public AreaSelectionUtil()
-
-
Method Details
-
selectWorldCoordArea
public static List<WorldCoord> selectWorldCoordArea(TownBlockOwner owner, WorldCoord pos, String[] args) throws TownyException Method to select a List<WorldCoord> of coordinates. Area claims can be either circular or rectangular.- Parameters:
owner
- -TownBlockOwner
making the selection.pos
- - WorldCoord where the selection is being made from.args
- - Subcommands like rect, circle, auto or #.- Returns:
- List<WorldCoord> of
WorldCoord
. - Throws:
TownyException
- - Thrown when invalid subcommands are given.
-
selectWorldCoordArea
public static List<WorldCoord> selectWorldCoordArea(TownBlockOwner owner, WorldCoord pos, String[] args, boolean claim) throws TownyException Method to select a List<WorldCoord> of coordinates. Area claims can be either circular or rectangular.- Parameters:
owner
- -TownBlockOwner
making the selection.pos
- - WorldCoord where the selection is being made from.args
- - Subcommands like rect, circle, auto or #.claim
- - This selection will result in claiming for a resident or town.- Returns:
- List<WorldCoord> of
WorldCoord
. - Throws:
TownyException
- - Thrown when invalid subcommands are given.
-
filterInvalidProximityTownBlocks
public static List<WorldCoord> filterInvalidProximityTownBlocks(List<WorldCoord> selection, Town town) Returns a list containing only townblocks that can be claimed. Filters out townblocks too close to other towns as set in the config.- Parameters:
selection
- - List<WorldCoord> of coordinatestown
- - Town to check distance from- Returns:
- List of
WorldCoord
-
filterInvalidProximityToHomeblock
public static List<WorldCoord> filterInvalidProximityToHomeblock(List<WorldCoord> selection, Town town) Returns a list containing only townblocks that can be claimed. Filters out townblocks too close to other town homeblocks as set in the config.- Parameters:
selection
- List<WorldCoord> of coordinatestown
- Town to check distance from- Returns:
- List of
WorldCoord
-
isTooCloseToHomeBlock
Is the WorldCoord too close to another town's HomeBlock.- Parameters:
wc
- WorldCoord to check distance from.town
- Town whos homeblock we don't have to account for.- Returns:
- true if the WorldCoord is too close to a homeblock.
-
filterOutTownOwnedBlocks
Returns a list containing only wilderness townblocks.- Parameters:
selection
- List of Coordinates (List<WorldCoord>)- Returns:
- List of
WorldCoord
.
-
filterOutWildernessBlocks
Returns a List containing only claimed townblocks.- Parameters:
selection
- List of Coordinates (List<WorldCoord>)- Returns:
- List of
WorldCoord
-
filterOwnedBlocks
Returns a List containing only claimed townblocks, owned by the given owner.- Parameters:
owner
- TownBlockOwner which owns the townblock.selection
- List of Coordinates (List<WorldCoord>)- Returns:
- List of
WorldCoord
owned by the given owner.
-
filterUnownedBlocks
public static List<WorldCoord> filterUnownedBlocks(TownBlockOwner owner, List<WorldCoord> selection) Returns a List containing only claimed townblocks, which are not owned by the given owner.- Parameters:
owner
- TownBlockOwner which owns the townblock.selection
- List of Coordinates (List<WorldCoord>)- Returns:
- List of
WorldCoord
not owned by the given owner.
-
filterHomeBlock
-
filterPlotsByGroup
Gives a list of townblocks that have membership to the specified group.- Parameters:
group
- The plot group to filter against.selection
- The selection of townblocks.- Returns:
- A List of
WorldCoord
that contains the coordinates of townblocks part of the specified group.
-
getPlotGroupsFromSelection
-
filterPlotsForSale
Gather plots that are for sale only, using a resident to determine whether they can be bought.- Parameters:
resident
- Resident who would be buying the plots.selection
- List<WorldCoord> from which to get plots that are for sale.- Returns:
- List<WorldCoord> that are all for sale.
-
filterPlotsForSale
Gather plots that are for sale only, currently used only for setting plots to notforsale.- Parameters:
selection
- List<WorldCoord> from which to get plots that are for sale.- Returns:
- List<WorldCoord> that are all for sale.
-
filterPlotsNotForSale
Gather plots that are not for sale only.- Parameters:
selection
- List<WorldCoord> from which to get plots that are not for sale.- Returns:
- List<WorldCoord> that are all not for sale.
-
filterOutResidentBlocks
public static List<WorldCoord> filterOutResidentBlocks(Resident resident, List<WorldCoord> selection) Returns a List containing only claimed townblocks, which are: - not personally owned by a resident who isn't the given resident- Parameters:
resident
- The Resident to ignore.selection
- List of Coordinates (List<WorldCoord>)- Returns:
- List of townblocks which does not includes townblocks owned by players who aren't the given resident.
-
filterOutUnwantedBiomeWorldCoords
public static List<WorldCoord> filterOutUnwantedBiomeWorldCoords(org.bukkit.entity.Player player, List<WorldCoord> selection) Returns a List containing only WorldCoords which are not composed of "too much" bad biomes, with the threshold determined by the config.- Parameters:
player
- Player trying to claim.selection
- List of WorldCoords.- Returns:
- a List of WorldCoords which have passed the biome requirements.
-
filterOutOceanBiomeWorldCoords
public static List<WorldCoord> filterOutOceanBiomeWorldCoords(org.bukkit.entity.Player player, List<WorldCoord> selection) Returns a List containing only WorldCoords which are not composed of "too much" ocean biomes, with the threshold determined by the config.- Parameters:
player
- Player trying to claim.selection
- List of WorldCoords.- Returns:
- a List of WorldCoords which have passed the biome requirements.
-
filterOutByBiome
public static List<WorldCoord> filterOutByBiome(org.bukkit.entity.Player player, List<WorldCoord> selection, Predicate<WorldCoord> biomeThresholdTest, String errorMsg) -
getAreaSelectPivot
-
isOnEdgeOfOwnership
-