java.lang.Object
net.sacredlabyrinth.phaed.simpleclans.Clan
All Implemented Interfaces:
Serializable, Comparable<Clan>

public class Clan extends Object implements Serializable, Comparable<Clan>
Author:
phaed
See Also:
  • Constructor Details

    • Clan

      public Clan()
    • Clan

      public Clan(String tag, String name, boolean verified)
  • Method Details

    • hashCode

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

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Clan other)
      Specified by:
      compareTo in interface Comparable<Clan>
    • toString

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

      @Deprecated public void deposit(double amount, org.bukkit.entity.Player player)
      Deprecated.
      Deposits money to the clan
    • deposit

      public EconomyResponse deposit(@NotNull @NotNull BankOperator sender, @NotNull @NotNull ClanBalanceUpdateEvent.Cause cause, double amount)
      Deposits money to the clan
    • withdraw

      @Deprecated public void withdraw(double amount, org.bukkit.entity.Player player)
      Deprecated.
      Withdraws money from the clan
    • withdraw

      public EconomyResponse withdraw(@NotNull @NotNull BankOperator sender, @NotNull @NotNull ClanBalanceUpdateEvent.Cause cause, double amount)
      Withdraws money from the clan
    • getName

      public String getName()
      Returns the clan's name
      Returns:
      the name
    • setName

      public void setName(String name)
      (used internally)
      Parameters:
      name - the name to set
    • getDescription

      public String getDescription()
      Returns the clan's description
      Returns:
      the description or null if it doesn't have one
    • setDescription

      public void setDescription(String description)
      (used internally)
    • setMemberFee

      public void setMemberFee(double fee)
      Sets the clan's fee
    • getMemberFee

      public double getMemberFee()
      Returns the clan's fee
      Returns:
      the fee
    • getBalance

      public double getBalance()
      Returns the clan's balance
      Returns:
      the balance
    • getBalanceFormatted

      public String getBalanceFormatted()
      Returns the clan's balance formatted
      Returns:
      the balance formatted
    • setBalance

      public EconomyResponse setBalance(@NotNull @NotNull BankOperator operator, @NotNull @NotNull ClanBalanceUpdateEvent.Cause cause, @NotNull BankLogger.Operation operation, double balance)
    • getTag

      public String getTag()
      Returns the clan's tag clean (no colors)
      Returns:
      the tag
    • setTag

      public void setTag(String tag)
      (used internally)
      Parameters:
      tag - the tag to set
    • getColor

      public String getColor()
      Returns the first color in the clan's tag
      Returns:
      the color code or an empty string if there is no color
    • getLastUsed

      public long getLastUsed()
      Returns the last used date in milliseconds
      Returns:
      the lastUsed
    • updateLastUsed

      public void updateLastUsed()
      Updates last used date to today (does not update clan on db)
    • getInactiveDays

      public int getInactiveDays()
      Returns the number of days the clan has been inactive
    • getMaxInactiveDays

      public int getMaxInactiveDays()
      Returns the max number of days the clan can be inactive A <= 0 means it won't be purged
    • setLastUsed

      public void setLastUsed(long lastUsed)
      (used internally)
      Parameters:
      lastUsed - the lastUsed to set
    • isFriendlyFire

      public boolean isFriendlyFire()
      Check whether this clan allows friendly fire
      Returns:
      the friendlyFire
    • setFriendlyFire

      public void setFriendlyFire(boolean friendlyFire)
      Sets the friendly fire status of this clan (does not update clan on db)
      Parameters:
      friendlyFire - the friendlyFire to set
    • isMember

      public boolean isMember(org.bukkit.entity.Player player)
      Check if the player is a member of this clan
      Parameters:
      player - the Player
      Returns:
      confirmation
    • isMember

      public boolean isMember(UUID uuid)
      Check if the player is a member of this clan
      Parameters:
      uuid - the Player's UUID
      Returns:
      confirmation
    • isMember

      public boolean isMember(String playerName)
    • getBb

      public List<String> getBb()
      Returns a list with the contents of the bulletin board
      Returns:
      the bb
    • getAllies

      public List<String> getAllies()
      Return a list of all the allies' tags clean (no colors)
      Returns:
      the allies
    • getFounded

      public long getFounded()
      The founded date in milliseconds
      Returns:
      the founded
    • getFoundedString

      public String getFoundedString()
      The string representation of the founded date
    • setFounded

      public void setFounded(long founded)
      (used internally)
      Parameters:
      founded - the founded to set
    • getColorTag

      public String getColorTag()
      Returns the color tag for this clan
      Returns:
      the colorTag
    • setColorTag

      public void setColorTag(String colorTag)
      (used internally)
      Parameters:
      colorTag - the colorTag to set
    • addBb

      public void addBb(String msg)
      Adds a bulletin board message without announcer
    • setBb

      public void setBb(List<String> bb)
    • addBbWithoutSaving

      public void addBbWithoutSaving(String msg)
      Adds a bulletin board message without saving it to the database
    • addBb

      public void addBb(String msg, boolean updateLastUsed)
      Adds a bulletin board message without announcer and saves it to the database
      Parameters:
      updateLastUsed - should the clan's last used time be updated as well?
    • clearBb

      public void clearBb()
      Clears the bulletin board
    • importMember

      public void importMember(ClanPlayer cp)
      (used internally)
    • removeMember

      public void removeMember(UUID uuid)
      (used internally)
    • getSize

      public int getSize()
      Get total clan size
    • getRivals

      public List<String> getRivals()
      Returns a list of all rival tags clean (no colors)
      Returns:
      the rivals
    • isRival

      public boolean isRival(String tag)
      Check if the tag is a rival
    • isAlly

      public boolean isAlly(String tag)
      Check if the tag is an ally
    • isVerified

      public boolean isVerified()
      Tells you if the clan is verified, always returns true if no verification is required
    • setVerified

      public void setVerified(boolean verified)
      (used internally)
      Parameters:
      verified - the verified to set
    • isPermanent

      public boolean isPermanent()
    • setPermanent

      public void setPermanent(boolean permanent)
    • getCapeUrl

      @Deprecated public String getCapeUrl()
      Deprecated.
      Returns the cape url for this clan
      Returns:
      the capeUrl
    • setCapeUrl

      @Deprecated public void setCapeUrl(String capeUrl)
      Deprecated.
      (used internally)
      Parameters:
      capeUrl - the capeUrl to set
    • getPackedBb

      public String getPackedBb()
      (used internally)
      Returns:
      the packedBb
    • setPackedBb

      public void setPackedBb(String packedBb)
      (used internally)
      Parameters:
      packedBb - the packedBb to set
    • getPackedAllies

      public String getPackedAllies()
      (used internally)
      Returns:
      the packedAllies
    • setPackedAllies

      public void setPackedAllies(String packedAllies)
      (used internally)
      Parameters:
      packedAllies - the packedAllies to set
    • getPackedRivals

      public String getPackedRivals()
      (used internally)
      Returns:
      the packedRivals
    • setPackedRivals

      public void setPackedRivals(String packedRivals)
      (used internally)
      Parameters:
      packedRivals - the packedRivals to set
    • getAllyString

      public String getAllyString(String sep, @Nullable @Nullable org.bukkit.command.CommandSender viewer)
      Returns a separator delimited string with all the ally clan's colored tags
    • getAllyString

      @Deprecated public String getAllyString(String sep)
    • getRivalString

      public String getRivalString(String sep, @Nullable @Nullable org.bukkit.command.CommandSender viewer)
      Returns a separator delimited string with all the rival clan's colored tags
    • getRivalString

      @Deprecated public String getRivalString(String sep)
    • getLeadersString

      public String getLeadersString(String prefix, String sep)
      Returns a separator delimited string with all the leaders
      Returns:
      the formatted leaders string
    • isLeader

      public boolean isLeader(org.bukkit.entity.Player player)
      Check if a player is a leader of a clan
      Returns:
      the leaders
    • isLeader

      public boolean isLeader(UUID playerUniqueId)
      Check if a player is a leader of a clan
      Returns:
      the leaders
    • isLeader

      public boolean isLeader(String playerName)
    • getFeePayers

      public Set<ClanPlayer> getFeePayers()
      Get all members that must pay the fee (that excludes leaders and players with the permission to bypass it)
      Returns:
      the fee payers
    • getMembers

      public List<ClanPlayer> getMembers()
      Get all members (leaders, and non-leaders) in the clan
      Returns:
      the members
    • getOnlineMembers

      public List<ClanPlayer> getOnlineMembers()
      Get all online members (leaders, and non-leaders) in the clan
      Returns:
      the members
    • getLeaders

      public List<ClanPlayer> getLeaders()
      Get all leaders in the clan
      Returns:
      the leaders
    • getNonLeaders

      public List<ClanPlayer> getNonLeaders()
      Get all non-leader players in the clan
      Returns:
      non leaders
    • getAllMembers

      @Deprecated public List<ClanPlayer> getAllMembers()
      Deprecated.
      Get all clan's members
    • getAllAllyMembers

      public Set<ClanPlayer> getAllAllyMembers()
      Get all the ally clan's members
    • getTotalKDR

      public float getTotalKDR()
      Gets the clan's total KDR
    • getTotalDeaths

      public int getTotalDeaths()
      Gets the clan's total KDR
    • getAverageWK

      public int getAverageWK()
      Gets average weighted kills for the clan
    • getTotalKills

      public int getTotalKills()
    • getTotalRival

      public int getTotalRival()
      Gets total rival kills for the clan
    • getTotalNeutral

      public int getTotalNeutral()
      Gets total neutral kills for the clan
    • getTotalCivilian

      public int getTotalCivilian()
      Gets total civilian kills for the clan
    • getTotalAlly

      public int getTotalAlly()
    • reachedRivalLimit

      public boolean reachedRivalLimit()
      Check whether the clan has crossed the rival limit
    • addPlayerToClan

      public void addPlayerToClan(ClanPlayer cp)
      Add a new player to the clan
    • removePlayerFromClan

      public void removePlayerFromClan(String playerName)
    • removePlayerFromClan

      public void removePlayerFromClan(UUID playerUniqueId)
      Remove a player from a clan
    • promote

      public void promote(String playerName)
    • promote

      public void promote(UUID playerUniqueId)
      Promote a member to a leader of a clan
    • demote

      public void demote(String playerName)
    • demote

      public void demote(UUID playerUniqueId)
      Demote a leader back to a member of a clan
    • addAlly

      public void addAlly(Clan ally)
      Add an ally to a clan, and the clan to the ally
    • removeAlly

      public void removeAlly(Clan ally)
      Remove an ally from the clan, and the clan from the ally
    • addRival

      public void addRival(Clan rival)
      Add a rival to the clan, and the clan to the rival
    • removeRival

      public void removeRival(Clan rival)
      Removes a rival from the clan, the clan from the rival
    • verifyClan

      public void verifyClan()
      Verify a clan
    • isAnyOnline

      public boolean isAnyOnline()
      Check whether any clan member is online
    • enoughLeadersOnlineToDemote

      public boolean enoughLeadersOnlineToDemote(ClanPlayer cp)
      Checks if there are enough leaders online to vote
      Parameters:
      cp - the one to demote
      Returns:
      true if there are
    • getOnlineLeaders

      public List<ClanPlayer> getOnlineLeaders()
      Gets the online leaders
      Returns:
      the online leaders
    • allLeadersOnline

      public boolean allLeadersOnline()
      Check whether all leaders of a clan are online
    • allOtherLeadersOnline

      @Deprecated public boolean allOtherLeadersOnline(String playerName)
      Deprecated.
      Check whether all leaders, except for the one passed in, are online
    • allOtherLeadersOnline

      public boolean allOtherLeadersOnline(UUID playerUniqueId)
      Check whether all leaders, except for the one passed in, are online
    • changeClanTag

      public void changeClanTag(String tag)
      Change a clan's tag
    • clanAnnounce

      public void clanAnnounce(String playerName, String msg)
      Announce message to a whole clan
    • leaderAnnounce

      public void leaderAnnounce(String msg)
      Announce message to all the leaders of a clan
    • addBb

      public void addBb(String announcerName, String msg)
      Add a new bb message and announce it to all online members of a clan
    • addBb

      public void addBb(String announcerName, String msg, boolean updateLastUsed)
      Add a new bb message and announce it to all online members of a clan
    • displayBb

      public void displayBb(org.bukkit.entity.Player player)
      Displays bb to a player
    • displayBb

      public void displayBb(org.bukkit.entity.Player player, int maxSize)
      Displays bb to a player
      Parameters:
      maxSize - amount of lines to display
    • disband

      public void disband(@Nullable @Nullable org.bukkit.command.CommandSender sender, boolean announce, boolean force)
      Disbands the clan
      Parameters:
      sender - who is trying to disband
      announce - should it be announced?
      force - should it be force disbanded?
    • disband

      public void disband()
    • isUnrivable

      public boolean isUnrivable()
      Whether this clan can be rivaled
    • isWarring

      public boolean isWarring(String tag)
      Returns whether this clan is warring with another clan
      Parameters:
      tag - the tag of the clan we are at war with
    • isWarring

      public boolean isWarring(Clan clan)
      Returns whether this clan is warring with another clan
      Parameters:
      clan - the clan we are testing against
    • addWarringClan

      public void addWarringClan(@Nullable @Nullable ClanPlayer requestPlayer, Clan targetClan)
      Add a clan to be at war with
    • addWarringClan

      public void addWarringClan(Clan targetClan)
    • removeWarringClan

      public boolean removeWarringClan(Clan clan)
      Remove a warring clan
    • getWarringClans

      public List<Clan> getWarringClans()
      Return a collection of all the warring clans
      Returns:
      the clan list
    • getFlags

      public String getFlags()
      Return the list of flags and their data as a json string
      Returns:
      the flags
    • setFlags

      public void setFlags(String flagString)
      Read the list of flags in from a json string
      Parameters:
      flagString - the flags to set
    • validateWarring

      public void validateWarring()
    • setHomeLocation

      public void setHomeLocation(@Nullable @Nullable org.bukkit.Location home)
    • getHomeLocation

      @Nullable public @Nullable org.bukkit.Location getHomeLocation()
    • getTagLabel

      public String getTagLabel(boolean isLeader)
    • isMemberFeeEnabled

      public boolean isMemberFeeEnabled()
      Checks if the fee is enabled
      Returns:
      true if enabled
    • setMemberFeeEnabled

      public void setMemberFeeEnabled(boolean enable)
      Enables or disables the fee
    • isAllowWithdraw

      public boolean isAllowWithdraw()
      Returns:
      the allowWithdraw
    • setAllowWithdraw

      public void setAllowWithdraw(boolean allowWithdraw)
      Parameters:
      allowWithdraw - the allowWithdraw to set
    • isAllowDeposit

      public boolean isAllowDeposit()
      Returns:
      the allowDeposit
    • setAllowDeposit

      public void setAllowDeposit(boolean allowDeposit)
      Parameters:
      allowDeposit - the allowDeposit to set
    • hasRank

      public boolean hasRank(@Nullable @Nullable String name)
      Checks if the clan has the specified rank
      Parameters:
      name - the rank
    • createRank

      public void createRank(String name)
      Creates a rank
    • getRanks

      public List<Rank> getRanks()
      Returns the clan's ranks
      Returns:
      the ranks
    • setRanks

      public void setRanks(@Nullable @Nullable List<Rank> ranks)
      Sets the clan's ranks
    • deleteRank

      public void deleteRank(String name)
      Deletes a rank with the specified name
    • getRank

      @Nullable public @Nullable Rank getRank(@Nullable @Nullable String name)
      Gets a rank with the specified name or null if not found
      Parameters:
      name - the rank name
      Returns:
      a rank or null
    • setDefaultRank

      public void setDefaultRank(@Nullable @Nullable String name)
      Sets the default rank for this clan.
      Parameters:
      name - The name of the rank to be set as default
    • getDefaultRank

      @Nullable public @Nullable String getDefaultRank()
      Gets the default rank for this clan.
      Returns:
      The default rank or null if there is no default
    • setBanner

      public void setBanner(@Nullable @Nullable org.bukkit.inventory.ItemStack banner)
    • getBanner

      @Nullable public @Nullable org.bukkit.inventory.ItemStack getBanner()