Class District
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.District
- All Implemented Interfaces:
Identifiable, Nameable, Savable
- Author:
- LlmDl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetaData(@NotNull CustomDataField<?> md) Add a specific metadata to this TownyObject.voidaddTownBlock(TownBlock townBlock) booleanDetermines whether a group is equivalent or not.booleanexists()An internal method used to determine if an object exists in the TownyUniverse's maps.getObjectDataMap(SerializationContext context) getTown()inthashCode()Get hashcode for object group name.booleanhasTownBlock(TownBlock townBlock) booleanbooleanvoidremoveMetaData(@NotNull CustomDataField<?> md) Remove a specific metadata from the TownyObject.voidremoveTownBlock(TownBlock townBlock) voidsave()Schedules the object to be saved to the database.voidOverride the name change method to internally rehash the district map.voidvoidsetTownblocks(List<TownBlock> townBlocks) toString()Store district in format "name,id,town,price"Methods inherited from class ObjectGroup
getUUID, 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
-
District
-
-
Method Details
-
toString
Store district 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 district map.- Overrides:
setNamein classTownyObject- Parameters:
name- The name of the district.
-
setTown
-
hashCode
public int hashCode()Description copied from class:ObjectGroupGet hashcode for object group name. The reason we hash the name and not the UUID is for quicker common access from commands.- Overrides:
hashCodein classObjectGroup- Returns:
- name hashcode
-
equals
Description copied from class:ObjectGroupDetermines whether a group is equivalent or not.- Overrides:
equalsin classObjectGroup- Parameters:
obj- The group to be compared- Returns:
- Returns true if the id (UUID) of the group matches the given group object. False otherwise.
-
getTown
-
toModeString
- Returns:
- The qualified resident mode string.
-
addTownBlock
-
removeTownBlock
-
setTownblocks
-
getTownBlocks
-
hasTownBlocks
public boolean hasTownBlocks() -
hasTownBlock
-
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.
-
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
-