Class PlotGroup

All Implemented Interfaces:
Identifiable, Nameable, Permissible, Savable, TownBlockOwner

public class PlotGroup extends ObjectGroup implements TownBlockOwner, Savable
Author:
Suneet Tipirneni (Siris) A simple class which encapsulates the grouping of townblocks.
  • Constructor Details

    • PlotGroup

      public PlotGroup(UUID id, String name, Town town)
      Parameters:
      id - A unique identifier for the group id.
      name - An alias for the id used for player in-game interaction via commands.
      town - The town that this group is owned by.
  • Method Details

    • toString

      public String toString()
      Store plot group in format "name,id,town,price"
      Overrides:
      toString in class ObjectGroup
      Returns:
      The string in the format described.
    • exists

      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 class TownyObject
      Returns:
      true if this TownyObject exists.
    • setName

      public void setName(String name)
      Override the name change method to internally rehash the plot group map.
      Overrides:
      setName in class TownyObject
      Parameters:
      name - The name of the group.
    • setTown

      public void setTown(Town town)
    • getTown

      public Town getTown()
    • toModeString

      public String toModeString()
      Returns:
      The qualified resident mode string.
    • isForSale

      public boolean isForSale()
    • getPrice

      public double getPrice()
    • setResident

      public void setResident(Resident resident)
    • getResident

      @Nullable public @Nullable Resident getResident()
    • hasResident

      public boolean hasResident()
    • addTownBlock

      public void addTownBlock(TownBlock townBlock)
      Description copied from interface: TownBlockOwner
      Adds a townblock to the list of existing townblocks.
      Specified by:
      addTownBlock in interface TownBlockOwner
      Parameters:
      townBlock - The townblock to add.
    • removeTownBlock

      public void removeTownBlock(TownBlock townBlock)
      Description copied from interface: TownBlockOwner
      Removes townblock from the list of existing townblocks.
      Specified by:
      removeTownBlock in interface TownBlockOwner
      Parameters:
      townBlock - The townblock to remove.
    • setTownblocks

      public void setTownblocks(List<TownBlock> townBlocks)
    • getTownBlocks

      public Collection<TownBlock> getTownBlocks()
      Description copied from interface: TownBlockOwner
      Gets the unmodifiable collection of townblocks.
      Specified by:
      getTownBlocks in interface TownBlockOwner
      Returns:
      The townblocks this object contains.
    • hasTownBlocks

      public boolean hasTownBlocks()
    • hasTownBlock

      public boolean hasTownBlock(TownBlock townBlock)
      Description copied from interface: TownBlockOwner
      Checks whether object has townblock or not.
      Specified by:
      hasTownBlock in interface TownBlockOwner
      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

      public void setPermissions(String line)
      Description copied from interface: Permissible
      The the permissions of this object.
      Specified by:
      setPermissions in interface Permissible
      Parameters:
      line - The String line representation of the permissions.
    • getPermissions

      public TownyPermission getPermissions()
      Description copied from interface: Permissible
      Gets the permissions of the object.
      Specified by:
      getPermissions in interface Permissible
      Returns:
      TownyPermission the permissions of the object.
    • setPermissions

      public void setPermissions(TownyPermission permissions)
    • getTownBlockType

      public TownBlockType getTownBlockType()
    • save

      public void save()
      Description copied from interface: Savable
      Schedules the object to be saved to the database.
      Specified by:
      save in interface Savable
    • getObjectDataMap

      @Internal public Map<String,Object> getObjectDataMap(SerializationContext context) throws ObjectSaveException
      Specified by:
      getObjectDataMap in interface Savable
      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

      @Internal public boolean load(Map<String,String> groupAsMap)
    • setTrustedResidents

      public void setTrustedResidents(Set<Resident> trustedResidents)
    • getTrustedResidents

      public Set<Resident> getTrustedResidents()
    • setPermissionOverrides

      public void setPermissionOverrides(Map<Resident, PermissionData> permissionOverrides)
    • getPermissionOverrides

      public Map<Resident, PermissionData> getPermissionOverrides()
    • hasTrustedResident

      public boolean hasTrustedResident(Resident resident)
    • addTrustedResident

      public void addTrustedResident(Resident resident)
    • removeTrustedResident

      public void removeTrustedResident(Resident resident)
    • putPermissionOverride

      public void putPermissionOverride(Resident resident, PermissionData permissionData)
    • removePermissionOverride

      public void removePermissionOverride(Resident resident)
    • getMinTownMembershipDays

      public int getMinTownMembershipDays()
    • getMaxTownMembershipDays

      public int getMaxTownMembershipDays()
    • addMetaData

      public void addMetaData(@NotNull @NotNull CustomDataField<?> md)
      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 class TownyObject
      Parameters:
      md - CustomDataField to add.
    • removeMetaData

      public void removeMetaData(@NotNull @NotNull CustomDataField<?> md)
      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 class TownyObject
      Parameters:
      md - CustomDataField to remove.