Class Guild

Object
Guild
All Implemented Interfaces:
Serializable, DisplayInterface, Ownage

@Entity public class Guild extends Object implements Serializable, DisplayInterface, Ownage
Author:
maartenl
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public String getName()
      The name of the guild, is also the primary key.
      Returns:
      the name of the guild.
      See Also:
    • setName

      public void setName(String name)
    • getTitle

      public String getTitle()
    • getMainTitle

      public String getMainTitle()
      Description copied from interface: DisplayInterface
      The title as visible on the screen.
      Specified by:
      getMainTitle in interface DisplayInterface
      Returns:
    • setTitle

      public void setTitle(String title)
    • getDaysguilddeath

      public Integer getDaysguilddeath()
    • setDaysguilddeath

      public void setDaysguilddeath(Integer daysguilddeath)
    • getMaxguilddeath

      public Integer getMaxguilddeath()
    • setMaxguilddeath

      public void setMaxguilddeath(Integer maxguilddeath)
    • getMinguildmembers

      public Integer getMinguildmembers()
    • setMinguildmembers

      public void setMinguildmembers(Integer minguildmembers)
    • getMinguildlevel

      public Integer getMinguildlevel()
    • setMinguildlevel

      public void setMinguildlevel(Integer minguildlevel)
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String guilddescription)
    • getHomepage

      public String getHomepage()
    • setHomepage

      public void setHomepage(String guildurl)
    • getActive

      public Boolean getActive()
    • setActive

      public void setActive(Boolean active)
    • getCreation

      public LocalDateTime getCreation()
    • setCreation

      public void setCreation(LocalDateTime creation)
    • getLogonmessage

      public String getLogonmessage()
    • setLogonmessage

      public void setLogonmessage(String logonmessage)
    • getMembers

      public Set<User> getMembers()
    • getActiveMembers

      public Set<User> getActiveMembers()
      All members of the guild actively playing the game as of this moment.
      Returns:
      set of users
    • setMembers

      public void setMembers(SortedSet<User> personCollection)
    • setActiveMembers

      public void setActiveMembers(SortedSet<User> personCollection)
    • getOwner

      public Admin getOwner()
      Description copied from interface: Ownage
      Retrieves the owner, the administrator, of this object. In case this is null, anyone can edit the object.
      Specified by:
      getOwner in interface Ownage
      Returns:
    • setOwner

      public void setOwner(Admin owner)
      Description copied from interface: Ownage
      Sets the owner, the administrator, of this object.
      Specified by:
      setOwner in interface Ownage
      Parameters:
      owner - the owner/administrator of the object. In case this is null, which is allowed, any administrator can edit this object. This is what happens when an object is "disowned".
    • getBoss

      public User getBoss()
      Returns the guildmaster of this guild.
      Returns:
      a Person, the guildmaster. Should not be null, ...ever.
    • setBoss

      public void setBoss(User boss) throws MudException
      Sets the guildmaster of this guild.
      Parameters:
      boss - the new guildmaster. Should never be null.
      Throws:
      MudException - if new guildmaster is null, or not a member of this guild.
    • getGuildrankCollection

      public Collection<Guildrank> getGuildrankCollection()
    • setGuildrankCollection

      public void setGuildrankCollection(SortedSet<Guildrank> guildrankCollection)
    • getColour

      public String getColour()
      Indicates the colour of the guild chat. The default is green.
      Returns:
      String indicating either a hexadecimal value (for example #FFFFFF) or the name of a colour (for example Blue).
    • setColour

      public void setColour(String colour)
      Parameters:
      colour -
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAlarmDescription

      public String getAlarmDescription()
      Returns a description in case the guild is in danger of being purged from the database. This is necessary to make sure there is not a plethora of guilds with few members.

      The following preconditions are in effect:

      • the guild is active
      • there are too few guildmembers (minguildmembers > amountofmembers)
      TODO : remove html tags here, let it return a daysguilddeath or something
      Returns:
      String indicating if there are too few members, usually should be the empty string if all is well.
    • getMember

      public User getMember(String name)
      Searches and returns the person by name in this guild, or null if not found.
      Parameters:
      name - the name of the person to look for.
      Returns:
      a Person.
    • getActiveMember

      public User getActiveMember(String name)
      Searches and returns the person by name in this guild, or null if not found. Only searches for members that are currently playing.
      Parameters:
      name - the name of the person to look for.
      Returns:
      a Person.
    • getImage

      public String getImage()
      Description copied from interface: DisplayInterface
      Returns an url pointing to an image.
      Specified by:
      getImage in interface DisplayInterface
      Returns:
    • setImage

      public void setImage(String image)
      Sets an url pointing to an image.
      Parameters:
      image -
      See Also:
    • getRank

      public Guildrank getRank(int id)
      Returns the rank based on the rank id/guildlevel. In case the rank id does not exist, null will be returned.
      Parameters:
      id - the id of the rank/guildlevel
      Returns:
      the rank in the guild
    • getBody

      public String getBody() throws MudException
      This is primarily used for displaying the current status of the guild to a member of the guild.
      Specified by:
      getBody in interface DisplayInterface
      Returns:
      a string containing the description of the guild.
      Throws:
      MudException
    • addGuildrank

      public boolean addGuildrank(Guildrank rank)
      Adds a guildrank.
      Parameters:
      rank - the rank to add
      Returns:
      true if this set did not already contain the specified element
    • deleteGuildrank

      public boolean deleteGuildrank(Guildrank rank)
      Deletes a guildrank.
      Parameters:
      rank - the rank to delete
      Returns:
      true if this set contained the specified element