Add %volume% variable to get the number of blocks in a region

- Works properly for polygon regions
This commit is contained in:
Thijs Wiefferink 2017-10-05 12:20:03 +02:00
parent 07194f07da
commit e073438862
3 changed files with 17 additions and 0 deletions

View File

@ -96,6 +96,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
public static final String tagWidth = "width"; // x-axis
public static final String tagHeight = "height"; // y-axis
public static final String tagDepth = "depth"; // z-axis
public static final String tagVolume = "volume"; // Number of blocks in the region (accounting for polygon regions)
public static final String tagTimeLeft = "timeleft";
public static final String tagClicker = "clicker";
public static final String tagResellPrice = "resellprice";
@ -516,6 +517,19 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
return economy.getProvider();
}
/**
* Get the Vault permissions provider.
* @return Vault permissions provider
*/
public net.milkbowl.vault.permission.Permission getPermissionProvider() {
RegisteredServiceProvider<net.milkbowl.vault.permission.Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider == null || permissionProvider.getProvider() == null) {
error("There is no permission plugin that supports Vault, make sure you have a Vault-compatible permissions plugin installed");
return null;
}
return permissionProvider.getProvider();
}
/**
* Method to get the FileManager (loads/save regions and can be used to get regions).
* @return The fileManager

View File

@ -578,6 +578,8 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
return getLandlordName();
case AreaShop.tagLandlordUUID:
return getLandlord();
case AreaShop.tagVolume:
return getRegion().volume();
// Date/time
case AreaShop.tagEpoch:

View File

@ -136,6 +136,7 @@ maximumTries: 50000
# %untilshort% The end time of a rent formatted as configured with 'timeFormatSign'.
# %width% The width of the region (number of blocks on the x-axis).
# %depth% The depth of the region (number of blocks on the z-axis).
# %volume% The number of blocks in a region (accounting for polygon shaped regions).
# %height% The height of the region (number of blocks on the y-axis).
# %timeleft% The time left on the rent (uses the unit of time that fits best, minutes used from 121 seconds till 120 minutes).
# %clicker% The name of the player that clicked the sign (only to be used in the signProfiles section).