Class PlotGroup
java.lang.Object
com.palmergames.bukkit.towny.object.Loadable
com.palmergames.bukkit.towny.object.TownyObject
com.palmergames.bukkit.towny.object.ObjectGroup
com.palmergames.bukkit.towny.object.PlotGroup
- All Implemented Interfaces:
Identifiable, Nameable, Permissible, Savable, TownBlockOwner
- Author:
- Suneet Tipirneni (Siris) A simple class which encapsulates the grouping of townblocks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetaData(@NotNull CustomDataField<?> md) Add a specific metadata to this TownyObject.voidaddPlotPrice(double pPrice) voidaddTownBlock(TownBlock townBlock) Adds a townblock to the list of existing townblocks.voidaddTrustedResident(Resident resident) booleanexists()An internal method used to determine if an object exists in the TownyUniverse's maps.intintgetObjectDataMap(SerializationContext context) Gets the permissions of the object.doublegetPrice()@Nullable ResidentgetTown()Gets the unmodifiable collection of townblocks.booleanbooleanhasTownBlock(TownBlock townBlock) Checks whether object has townblock or not.booleanbooleanhasTrustedResident(Resident resident) booleanbooleanvoidputPermissionOverride(Resident resident, PermissionData permissionData) voidremoveMetaData(@NotNull CustomDataField<?> md) Remove a specific metadata from the TownyObject.voidremovePermissionOverride(Resident resident) voidremoveTownBlock(TownBlock townBlock) Removes townblock from the list of existing townblocks.voidremoveTrustedResident(Resident resident) voidsave()Schedules the object to be saved to the database.voidOverride the name change method to internally rehash the plot group map.voidsetPermissionOverrides(Map<Resident, PermissionData> permissionOverrides) voidsetPermissions(TownyPermission permissions) voidsetPermissions(String line) The the permissions of this object.voidsetPrice(double price) voidsetResident(Resident resident) voidvoidsetTownblocks(List<TownBlock> townBlocks) voidsetTrustedResidents(Set<Resident> trustedResidents) toString()Store plot group in format "name,id,town,price"Methods inherited from class ObjectGroup
equals, getUUID, hashCode, setUUIDMethods inherited from class TownyObject
addMetaData, getMetadata, getMetadata, getMetadata, getName, getTreeDepth, getTreeString, hasMeta, hasMeta, hasMeta, removeMetaData, removeMetaData, removeMetaDataMethods inherited from class Loadable
getOrDefault, getOrDefault, getOrDefault, getOrDefault, getOrDefault, getSplitter, getTownBlockForSaving, hasData, parseLocationForSaving, parseNationFromDB, parseNationsFromDB, parseResidentsFromDB, parseSpawnLocationFromDB, parseTownBlockFromDB, parseTownFromDB, parseTownsFromDB, serializeMetadata, toList, toUUIDArray, toUUIDListMethods inherited from interface Nameable
formattedName, getFormattedName, getName
-
Constructor Details
-
PlotGroup
-
-
Method Details
-
toString
Store plot group in format "name,id,town,price"- Overrides:
toStringin classObjectGroup- Returns:
- The string in the format described.
-
exists
public boolean exists()Description copied from class:TownyObjectAn internal method used to determine if an object exists in the TownyUniverse's maps.- Specified by:
existsin classTownyObject- Returns:
- true if this TownyObject exists.
-
setName
Override the name change method to internally rehash the plot group map.- Overrides:
setNamein classTownyObject- Parameters:
name- The name of the group.
-
setTown
-
getTown
-
toModeString
- Returns:
- The qualified resident mode string.
-
isForSale
public boolean isForSale() -
getPrice
public double getPrice() -
setResident
-
getResident
-
hasResident
public boolean hasResident() -
addTownBlock
Description copied from interface:TownBlockOwnerAdds a townblock to the list of existing townblocks.- Specified by:
addTownBlockin interfaceTownBlockOwner- Parameters:
townBlock- The townblock to add.
-
removeTownBlock
Description copied from interface:TownBlockOwnerRemoves townblock from the list of existing townblocks.- Specified by:
removeTownBlockin interfaceTownBlockOwner- Parameters:
townBlock- The townblock to remove.
-
setTownblocks
-
getTownBlocks
Description copied from interface:TownBlockOwnerGets the unmodifiable collection of townblocks.- Specified by:
getTownBlocksin interfaceTownBlockOwner- Returns:
- The townblocks this object contains.
-
hasTownBlocks
public boolean hasTownBlocks() -
hasTownBlock
Description copied from interface:TownBlockOwnerChecks whether object has townblock or not.- Specified by:
hasTownBlockin interfaceTownBlockOwner- Parameters:
townBlock- The townblock to check for.- Returns:
- A boolean indicating if it was found or not.
-
setPrice
public void setPrice(double price) -
addPlotPrice
public void addPlotPrice(double pPrice) -
setPermissions
Description copied from interface:PermissibleThe the permissions of this object.- Specified by:
setPermissionsin interfacePermissible- Parameters:
line- The String line representation of the permissions.
-
getPermissions
Description copied from interface:PermissibleGets the permissions of the object.- Specified by:
getPermissionsin interfacePermissible- Returns:
TownyPermissionthe permissions of the object.
-
setPermissions
-
getTownBlockType
-
save
-
getObjectDataMap
@Internal public Map<String,Object> getObjectDataMap(SerializationContext context) throws ObjectSaveException - Specified by:
getObjectDataMapin interfaceSavable- Parameters:
context- SerializationContext with information.- Returns:
- a Map which stores keys and values, meant to be written to a database.
- Throws:
ObjectSaveException- when something cannot be saved.
-
load
-
setTrustedResidents
-
getTrustedResidents
-
setPermissionOverrides
-
getPermissionOverrides
-
hasTrustedResident
-
addTrustedResident
-
removeTrustedResident
-
putPermissionOverride
-
removePermissionOverride
-
getMinTownMembershipDays
public int getMinTownMembershipDays() -
getMaxTownMembershipDays
public int getMaxTownMembershipDays() -
addMetaData
Description copied from class:TownyObjectAdd a specific metadata to this TownyObject. Overrides existing metadata of the same key. Most implementations will save the object after this method is called.- Overrides:
addMetaDatain classTownyObject- Parameters:
md- CustomDataField to add.
-
removeMetaData
Description copied from class:TownyObjectRemove a specific metadata from the TownyObject. The metadata does not need to be the same instance of the one added, but must have the same key. Most implementations will save the TownyObject after removing the metadata.- Overrides:
removeMetaDatain classTownyObject- Parameters:
md- CustomDataField to remove.
-