Class District

All Implemented Interfaces:
Identifiable, Nameable, Savable

public class District extends ObjectGroup implements Nameable, Savable
Author:
LlmDl
  • Constructor Details

    • District

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

    • toString

      public String toString()
      Store district 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 district map.
      Overrides:
      setName in class TownyObject
      Parameters:
      name - The name of the district.
    • setTown

      public void setTown(Town town)
    • hashCode

      public int hashCode()
      Description copied from class: ObjectGroup
      Get hashcode for object group name. The reason we hash the name and not the UUID is for quicker common access from commands.
      Overrides:
      hashCode in class ObjectGroup
      Returns:
      name hashcode
    • equals

      public boolean equals(Object obj)
      Description copied from class: ObjectGroup
      Determines whether a group is equivalent or not.
      Overrides:
      equals in class ObjectGroup
      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

      public Town getTown()
    • toModeString

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

      public void addTownBlock(TownBlock townBlock)
    • removeTownBlock

      public void removeTownBlock(TownBlock townBlock)
    • setTownblocks

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

      public Collection<TownBlock> getTownBlocks()
    • hasTownBlocks

      public boolean hasTownBlocks()
    • hasTownBlock

      public boolean hasTownBlock(TownBlock townBlock)
    • save

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