Class TownBlock
java.lang.Object
com.palmergames.bukkit.towny.object.TownyObject
com.palmergames.bukkit.towny.object.TownBlock
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetaData(@NotNull CustomDataField<?> md) Add a specific metadata to this TownyObject.voidaddTrustedResident(Resident resident) voidaddTrustedResidents(List<Resident> residents) voidclear()booleanvoidvoidevictOwnerFromTownBlock(boolean forsale) booleanexists()An internal method used to determine if an object exists in the TownyUniverse's maps.longgetCoord()getData()getJail()intintdoubledouble@Nullable ResidentRelatively safe to use after testinghasResident().getTown()@Nullable TownBlockOwnerReturns the TownBlockOwner: a resident (if the plot is personally-owned,) or the Town that owns the townblock.@Nullable TownRelatively safe to use after confirminghasTown()is true orTownyAPI.isWilderness(org.bukkit.Location)is false.getType()getWorld()intgetX()intgetZ()booleaninthashCode()booleanbooleanbooleanbooleanbooleanhasResident(Resident resident) booleanhasTown()booleanhasTrustedResident(Resident resident) booleanHave the permissions been manually changed.booleanbooleanbooleanisJail()booleanbooleanisOwner(@NotNull TownBlockOwner owner) booleanisTaxed()voidvoidremoveMetaData(@NotNull CustomDataField<?> md) Remove a specific metadata from the TownyObject.voidbooleanRemoves the current resident as owner in this plot, while calling the appropriate eventsvoidremoveTrustedResident(Resident resident) voidsave()Schedules the object to be saved to the database.voidsetChanged(boolean isChanged) Flag the permissions as changed.voidsetClaimedAt(long claimedAt) voidsetDistrict(District district) voidvoidsetMaxTownMembershipDays(int maxTownMembershipDays) Sets the maximum number of days that a town member can be a part of the town before they unable to claim the plot personally using /plot claim.voidsetMinTownMembershipDays(int minTownMembershipDays) Sets the number of days that a town member must be a part of the town before they can claim the plot personally using /plot claim.voidvoidsetOutpost(boolean outpost) voidsetPermissionOverrides(Map<Resident, PermissionData> permissionOverrides) voidsetPermissions(String line) voidsetPlotObjectGroup(PlotGroup group) voidsetPlotPrice(double price) booleansetResident(@Nullable Resident resident) Changes the owner of the plot to the given resident.booleansetResident(@Nullable Resident resident, boolean callEvent) Changes the owner of the plot to the given resident.voidsetTaxed(boolean value) voidvoidvoidsetTrustedResidents(Set<Resident> trustedResidents) voidsetType(@Nullable TownBlockType type) voidsetType(TownBlockType type, Resident resident) voidvoidTests whether a Resident's Town membership age (join date) is too high or low, preventing them from claiming this TownBlock personally with /plot claim.toString()Methods inherited from class com.palmergames.bukkit.towny.object.TownyObject
addMetaData, getMetadata, getMetadata, getMetadata, getName, getTreeDepth, getTreeString, hasMeta, hasMeta, hasMeta, removeMetaData, removeMetaData, removeMetaDataMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.palmergames.bukkit.towny.object.Nameable
getFormattedName
-
Field Details
-
permissions
-
isChanged
protected boolean isChanged
-
-
Constructor Details
-
TownBlock
-
TownBlock
-
-
Method Details
-
setTown
-
setTown
-
getTown
- Throws:
NotRegisteredException
-
getTownOrNull
Relatively safe to use after confirminghasTown()is true orTownyAPI.isWilderness(org.bukkit.Location)is false.- Returns:
- Town who owns the TownBlock or null.
-
hasTown
public boolean hasTown() -
removeResident
public boolean removeResident()Removes the current resident as owner in this plot, while calling the appropriate events- Returns:
- Whether the resident (if any) was successfully removed as owner.
-
setResident
Changes the owner of the plot to the given resident.- Parameters:
resident- The resident to give ownership to, ornullto give ownership back to the town.- Returns:
- Whether the resident (if any) was successfully removed as owner.
-
setResident
Changes the owner of the plot to the given resident.- Parameters:
resident- The resident to give ownership to, ornullto give ownership back to the town.callEvent- Whether to call the related plot events or not, this is used by Towny to avoid calling events from database loading.- Returns:
- Whether the resident (if any) was successfully removed as owner.
-
getResident
- Throws:
NotRegisteredException
-
getResidentOrNull
Relatively safe to use after testinghasResident().- Returns:
- Resident who personally owns the TownBlock or null.
-
hasResident
public boolean hasResident() -
isOwner
-
setPlotPrice
public void setPlotPrice(double price) -
getPlotPrice
public double getPlotPrice() -
isForSale
public boolean isForSale() -
isTaxed
public boolean isTaxed() -
setTaxed
public void setTaxed(boolean value) -
getPlotTax
public double getPlotTax() -
setPermissions
-
getPermissions
-
isChanged
public boolean isChanged()Have the permissions been manually changed.- Returns:
- the isChanged
-
setChanged
public void setChanged(boolean isChanged) Flag the permissions as changed.- Parameters:
isChanged- the isChanged to set
-
isOutpost
public boolean isOutpost()- Returns:
- the outpost
-
setOutpost
public void setOutpost(boolean outpost) - Parameters:
outpost- the outpost to set
-
getType
-
getTypeName
-
setType
-
setType
-
setType
- Parameters:
type- The TownBlockType to set this plot to.resident- The Resident who is trying to set the type.- Throws:
TownyException- If this townblock has a pvp toggle cooldown.
-
isHomeBlock
public boolean isHomeBlock() -
setName
- Overrides:
setNamein classTownyObject
-
getX
public int getX() -
getZ
public int getZ() -
getCoord
-
getWorldCoord
-
getWorld
-
equals
-
hashCode
public int hashCode() -
clear
public void clear() -
toString
- Overrides:
toStringin classTownyObject
-
isJail
public boolean isJail() -
getJail
-
setJail
-
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.
-
hasPlotObjectGroup
public boolean hasPlotObjectGroup() -
getPlotObjectGroup
-
removePlotObjectGroup
public void removePlotObjectGroup() -
setPlotObjectGroup
-
hasDistrict
public boolean hasDistrict() -
getDistrict
-
removeDistrict
public void removeDistrict() -
setDistrict
-
save
public void save()Description copied from interface:SavableSchedules the object to be saved to the database. -
getClaimedAt
public long getClaimedAt() -
setClaimedAt
public void setClaimedAt(long claimedAt) -
getPermissionOverrides
-
addTrustedResidents
-
getTrustedResidents
-
hasTrustedResident
-
addTrustedResident
-
removeTrustedResident
-
hasResident
-
setTrustedResidents
-
setPermissionOverrides
-
getTownBlockOwner
Returns the TownBlockOwner: a resident (if the plot is personally-owned,) or the Town that owns the townblock.- Returns:
- TownBlockOwner or null (highly unlikely.)
-
getData
-
evictOwnerFromTownBlock
public void evictOwnerFromTownBlock() -
evictOwnerFromTownBlock
public void evictOwnerFromTownBlock(boolean forsale) -
testTownMembershipAgePreventsThisClaimOrThrow
Tests whether a Resident's Town membership age (join date) is too high or low, preventing them from claiming this TownBlock personally with /plot claim.- Parameters:
resident- Resident who wants to buy the TownBlock.- Throws:
TownyException- thrown with error message when the Resident is not allowed to claim the land.
-
hasMinTownMembershipDays
public boolean hasMinTownMembershipDays()- Returns:
- does this plot have a min number of days the player has to be a member of the town, before they can claim?
-
getMinTownMembershipDays
public int getMinTownMembershipDays()- Returns:
- how many days a town member has to be a part of the town in order to claim this plot personally using /plot claim.
-
setMinTownMembershipDays
public void setMinTownMembershipDays(int minTownMembershipDays) Sets the number of days that a town member must be a part of the town before they can claim the plot personally using /plot claim.- Parameters:
minTownMembershipDays- days they have to be a part of the town for, before they can claim.
-
hasMaxTownMembershipDays
public boolean hasMaxTownMembershipDays()- Returns:
- does this plot have a max number of days the player can be a member of the town, before they cannot claim?
-
getMaxTownMembershipDays
public int getMaxTownMembershipDays()- Returns:
- how the maximum number of days a town member can be a part of the town before they are unable to claim this plot personally using /plot claim.
-
setMaxTownMembershipDays
public void setMaxTownMembershipDays(int maxTownMembershipDays) Sets the maximum number of days that a town member can be a part of the town before they unable to claim the plot personally using /plot claim.- Parameters:
maxTownMembershipDays- days they can be a part of the town for, until they cannot claim.
-
exists
@Internal 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.
-