Class TownBlock
java.lang.Object
com.palmergames.bukkit.towny.object.TownyObject
com.palmergames.bukkit.towny.object.TownBlock
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMetaData
(@NotNull CustomDataField<?> md) Add a specific metadata to this TownyObject.void
addTrustedResident
(Resident resident) void
addTrustedResidents
(List<Resident> residents) void
clear()
boolean
void
boolean
exists()
An internal method used to determine if an object exists in the TownyUniverse's maps.long
getCoord()
getData()
getJail()
int
int
double
double
@Nullable Resident
Relatively safe to use after testinghasResident()
.getTown()
@Nullable TownBlockOwner
Returns the TownBlockOwner: a resident (if the plot is personally-owned,) or the Town that owns the townblock.@Nullable Town
Relatively safe to use after confirminghasTown()
is true orTownyAPI.isWilderness(org.bukkit.Location)
is false.getType()
getWorld()
int
getX()
int
getZ()
boolean
int
hashCode()
boolean
boolean
boolean
boolean
boolean
hasResident
(Resident resident) boolean
hasTown()
boolean
hasTrustedResident
(Resident resident) boolean
Have the permissions been manually changed.boolean
boolean
boolean
isJail()
boolean
boolean
isOwner
(@NotNull TownBlockOwner owner) boolean
isTaxed()
void
void
removeMetaData
(@NotNull CustomDataField<?> md) Remove a specific metadata from the TownyObject.void
boolean
Removes the current resident as owner in this plot, while calling the appropriate eventsvoid
removeTrustedResident
(Resident resident) void
save()
Schedules the object to be saved to the database.void
setChanged
(boolean isChanged) Flag the permissions as changed.void
setClaimedAt
(long claimedAt) void
setDistrict
(District district) void
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.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.void
void
setOutpost
(boolean outpost) void
setPermissionOverrides
(Map<Resident, PermissionData> permissionOverrides) void
setPermissions
(String line) void
setPlotObjectGroup
(PlotGroup group) void
setPlotPrice
(double price) boolean
setResident
(@Nullable Resident resident) Changes the owner of the plot to the given resident.boolean
setResident
(@Nullable Resident resident, boolean callEvent) Changes the owner of the plot to the given resident.void
setTaxed
(boolean value) void
void
void
setTrustedResidents
(Set<Resident> trustedResidents) void
setType
(@Nullable TownBlockType type) void
setType
(TownBlockType type, Resident resident) void
void
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.toString()
Methods inherited from class com.palmergames.bukkit.towny.object.TownyObject
addMetaData, getMetadata, getMetadata, getMetadata, getName, getTreeDepth, getTreeString, hasMeta, hasMeta, hasMeta, removeMetaData, removeMetaData, removeMetaData
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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, ornull
to 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, ornull
to 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:
setName
in classTownyObject
-
getX
public int getX() -
getZ
public int getZ() -
getCoord
-
getWorldCoord
-
getWorld
-
equals
-
hashCode
public int hashCode() -
clear
public void clear() -
toString
- Overrides:
toString
in classTownyObject
-
isJail
public boolean isJail() -
getJail
-
setJail
-
addMetaData
Description copied from class:TownyObject
Add 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:
addMetaData
in classTownyObject
- Parameters:
md
- CustomDataField to add.
-
removeMetaData
Description copied from class:TownyObject
Remove 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:
removeMetaData
in 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:Savable
Schedules 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() -
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:TownyObject
An internal method used to determine if an object exists in the TownyUniverse's maps.- Specified by:
exists
in classTownyObject
- Returns:
- true if this TownyObject exists.
-