Class District

All Implemented Interfaces:
Identifiable, Nameable, Savable

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

    • District Link icon

      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 Link icon

    • toString Link icon

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

      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 Link icon

      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 Link icon

      public void setTown(Town town)
    • hashCode Link icon

      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 Link icon

      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 Link icon

      public Town getTown()
    • toModeString Link icon

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

      public void addTownBlock(TownBlock townBlock)
    • removeTownBlock Link icon

      public void removeTownBlock(TownBlock townBlock)
    • setTownblocks Link icon

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

      public Collection<TownBlock> getTownBlocks()
    • hasTownBlocks Link icon

      public boolean hasTownBlocks()
    • hasTownBlock Link icon

      public boolean hasTownBlock(TownBlock townBlock)
    • save Link icon

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