Class Clan
java.lang.Object
net.sacredlabyrinth.phaed.simpleclans.Clan
- All Implemented Interfaces:
Serializable,Comparable<Clan>
- Author:
- phaed
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an ally to a clan, and the clan to the allyvoidAdds a bulletin board message without announcervoidAdds a bulletin board message without announcer and saves it to the databasevoidAdd a new bb message and announce it to all online members of a clanvoidAdd a new bb message and announce it to all online members of a clanvoidaddBbWithoutSaving(String msg) Adds a bulletin board message without saving it to the databasevoidAdd a new player to the clanvoidAdd a rival to the clan, and the clan to the rivalvoidaddWarringClan(@Nullable ClanPlayer requestPlayer, Clan targetClan) Add a clan to be at war withvoidaddWarringClan(Clan targetClan) booleanCheck whether all leaders of a clan are onlinebooleanallOtherLeadersOnline(String playerName) Deprecated.booleanallOtherLeadersOnline(UUID playerUniqueId) Check whether all leaders, except for the one passed in, are onlinevoidchangeClanTag(String tag) Change a clan's tagvoidclanAnnounce(String playerName, String msg) Announce message to a whole clanvoidclearBb()Clears the bulletin boardintvoidcreateRank(String name) Creates a rankvoiddeleteRank(String name) Deletes a rank with the specified namevoidvoidDemote a leader back to a member of a clanvoiddeposit(double amount, org.bukkit.entity.Player player) Deprecated.deposit(@NotNull BankOperator sender, @NotNull ClanBalanceUpdateEvent.Cause cause, double amount) Deposits money to the clanvoiddisband()voiddisband(@Nullable org.bukkit.command.CommandSender sender, boolean announce, boolean force) Disbands the clanvoiddisplayBb(org.bukkit.entity.Player player) Displays bb to a playervoiddisplayBb(org.bukkit.entity.Player player, int maxSize) Displays bb to a playerbooleanChecks if there are enough leaders online to votebooleanGet all the ally clan's membersReturn a list of all the allies' tags clean (no colors)Deprecated.getAllyString(String sep) Deprecated.getAllyString(String sep, @Nullable org.bukkit.command.CommandSender viewer) Returns a separator delimited string with all the ally clan's colored tagsintGets average weighted kills for the clandoubleReturns the clan's balanceReturns the clan's balance formatted@Nullable org.bukkit.inventory.ItemStackgetBb()Returns a list with the contents of the bulletin boardDeprecated.getColor()Returns the first color in the clan's tagReturns the color tag for this clan@Nullable StringGets the default rank for this clan.Returns the clan's descriptionGet all members that must pay the fee (that excludes leaders and players with the permission to bypass it)getFlags()Return the list of flags and their data as a json stringlongThe founded date in millisecondsThe string representation of the founded date@Nullable org.bukkit.LocationintReturns the number of days the clan has been inactivelongReturns the last used date in millisecondsGet all leaders in the clangetLeadersString(String prefix, String sep) Returns a separator delimited string with all the leadersintReturns the max number of days the clan can be inactive A <= 0 means it won't be purgeddoubleReturns the clan's feeGet all members (leaders, and non-leaders) in the clangetName()Returns the clan's nameGet all non-leader players in the clanGets the online leadersGet all online members (leaders, and non-leaders) in the clan(used internally)(used internally)(used internally)@Nullable RankGets a rank with the specified name or null if not foundgetRanks()Returns the clan's ranksReturns a list of all rival tags clean (no colors)getRivalString(String sep) Deprecated.getRivalString(String sep, @Nullable org.bukkit.command.CommandSender viewer) Returns a separator delimited string with all the rival clan's colored tagsintgetSize()Get total clan sizegetTag()Returns the clan's tag clean (no colors)getTagLabel(boolean isLeader) intintGets total civilian kills for the clanintGets the clan's total KDRfloatGets the clan's total KDRintintGets total neutral kills for the clanintGets total rival kills for the clanReturn a collection of all the warring clansinthashCode()booleanChecks if the clan has the specified rankvoid(used internally)booleanbooleanbooleanCheck if the tag is an allybooleanCheck whether any clan member is onlinebooleanCheck whether this clan allows friendly firebooleanbooleanCheck if a player is a leader of a clanbooleanisLeader(org.bukkit.entity.Player player) Check if a player is a leader of a clanbooleanbooleanCheck if the player is a member of this clanbooleanisMember(org.bukkit.entity.Player player) Check if the player is a member of this clanbooleanChecks if the fee is enabledbooleanbooleanCheck if the tag is a rivalbooleanWhether this clan can be rivaledbooleanTells you if the clan is verified, always returns true if no verification is requiredbooleanReturns whether this clan is warring with another clanbooleanReturns whether this clan is warring with another clanvoidleaderAnnounce(String msg) Announce message to all the leaders of a clanvoidvoidPromote a member to a leader of a clanbooleanCheck whether the clan has crossed the rival limitvoidremoveAlly(Clan ally) Remove an ally from the clan, and the clan from the allyvoidremoveMember(UUID uuid) (used internally)voidremovePlayerFromClan(String playerName) voidremovePlayerFromClan(UUID playerUniqueId) Remove a player from a clanvoidremoveRival(Clan rival) Removes a rival from the clan, the clan from the rivalbooleanremoveWarringClan(Clan clan) Remove a warring clanvoidsetAllowDeposit(boolean allowDeposit) voidsetAllowWithdraw(boolean allowWithdraw) setBalance(@NotNull BankOperator operator, @NotNull ClanBalanceUpdateEvent.Cause cause, BankLogger.Operation operation, double balance) voidsetBanner(@Nullable org.bukkit.inventory.ItemStack banner) voidvoidsetCapeUrl(String capeUrl) Deprecated.voidsetColorTag(String colorTag) (used internally)voidsetDefaultRank(@Nullable String name) Sets the default rank for this clan.voidsetDescription(String description) (used internally)voidRead the list of flags in from a json stringvoidsetFounded(long founded) (used internally)voidsetFriendlyFire(boolean friendlyFire) Sets the friendly fire status of this clan (does not update clan on db)voidsetHomeLocation(@Nullable org.bukkit.Location home) voidsetLastUsed(long lastUsed) (used internally)voidsetMemberFee(double fee) Sets the clan's feevoidsetMemberFeeEnabled(boolean enable) Enables or disables the feevoid(used internally)voidsetPackedAllies(String packedAllies) (used internally)voidsetPackedBb(String packedBb) (used internally)voidsetPackedRivals(String packedRivals) (used internally)voidsetPermanent(boolean permanent) voidSets the clan's ranksvoid(used internally)voidsetVerified(boolean verified) (used internally)toString()voidUpdates last used date to today (does not update clan on db)voidvoidVerify a clanvoidwithdraw(double amount, org.bukkit.entity.Player player) Deprecated.withdraw(@NotNull BankOperator sender, @NotNull ClanBalanceUpdateEvent.Cause cause, double amount) Withdraws money from the clan
-
Constructor Details
-
Clan
public Clan() -
Clan
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<Clan>
-
toString
-
deposit
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.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
Returns the clan's name- Returns:
- the name
-
setName
(used internally)- Parameters:
name- the name to set
-
getDescription
Returns the clan's description- Returns:
- the description or null if it doesn't have one
-
setDescription
(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
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
Returns the clan's tag clean (no colors)- Returns:
- the tag
-
setTag
(used internally)- Parameters:
tag- the tag to set
-
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
Check if the player is a member of this clan- Parameters:
uuid- the Player's UUID- Returns:
- confirmation
-
isMember
-
getBb
Returns a list with the contents of the bulletin board- Returns:
- the bb
-
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
The string representation of the founded date -
setFounded
public void setFounded(long founded) (used internally)- Parameters:
founded- the founded to set
-
getColorTag
Returns the color tag for this clan- Returns:
- the colorTag
-
setColorTag
(used internally)- Parameters:
colorTag- the colorTag to set
-
addBb
Adds a bulletin board message without announcer -
setBb
-
addBbWithoutSaving
Adds a bulletin board message without saving it to the database -
addBb
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
(used internally) -
removeMember
(used internally) -
getSize
public int getSize()Get total clan size -
getRivals
Returns a list of all rival tags clean (no colors)- Returns:
- the rivals
-
isRival
Check if the tag is a rival -
isAlly
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.Returns the cape url for this clan- Returns:
- the capeUrl
-
setCapeUrl
Deprecated.(used internally)- Parameters:
capeUrl- the capeUrl to set
-
getPackedBb
(used internally)- Returns:
- the packedBb
-
setPackedBb
(used internally)- Parameters:
packedBb- the packedBb to set
-
getPackedAllies
(used internally)- Returns:
- the packedAllies
-
setPackedAllies
(used internally)- Parameters:
packedAllies- the packedAllies to set
-
getPackedRivals
(used internally)- Returns:
- the packedRivals
-
setPackedRivals
(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. -
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. -
getLeadersString
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
Check if a player is a leader of a clan- Returns:
- the leaders
-
isLeader
-
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
Get all members (leaders, and non-leaders) in the clan- Returns:
- the members
-
getOnlineMembers
Get all online members (leaders, and non-leaders) in the clan- Returns:
- the members
-
getLeaders
Get all leaders in the clan- Returns:
- the leaders
-
getNonLeaders
Get all non-leader players in the clan- Returns:
- non leaders
-
getAllMembers
Deprecated.usegetMembers()Get all clan's members -
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
Add a new player to the clan -
removePlayerFromClan
-
removePlayerFromClan
Remove a player from a clan -
promote
-
promote
Promote a member to a leader of a clan -
demote
-
demote
Demote a leader back to a member of a clan -
addAlly
Add an ally to a clan, and the clan to the ally -
removeAlly
Remove an ally from the clan, and the clan from the ally -
addRival
Add a rival to the clan, and the clan to the rival -
removeRival
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
Checks if there are enough leaders online to vote- Parameters:
cp- the one to demote- Returns:
- true if there are
-
getOnlineLeaders
Gets the online leaders- Returns:
- the online leaders
-
allLeadersOnline
public boolean allLeadersOnline()Check whether all leaders of a clan are online -
allOtherLeadersOnline
Deprecated.Check whether all leaders, except for the one passed in, are online -
allOtherLeadersOnline
Check whether all leaders, except for the one passed in, are online -
changeClanTag
Change a clan's tag -
clanAnnounce
Announce message to a whole clan -
leaderAnnounce
Announce message to all the leaders of a clan -
addBb
Add a new bb message and announce it to all online members of a clan -
addBb
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 disbandannounce- 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
Returns whether this clan is warring with another clan- Parameters:
tag- the tag of the clan we are at war with
-
isWarring
Returns whether this clan is warring with another clan- Parameters:
clan- the clan we are testing against
-
addWarringClan
Add a clan to be at war with -
addWarringClan
-
removeWarringClan
Remove a warring clan -
getWarringClans
Return a collection of all the warring clans- Returns:
- the clan list
-
getFlags
Return the list of flags and their data as a json string- Returns:
- the flags
-
setFlags
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
-
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
Checks if the clan has the specified rank- Parameters:
name- the rank
-
createRank
Creates a rank -
getRanks
Returns the clan's ranks- Returns:
- the ranks
-
setRanks
Sets the clan's ranks -
deleteRank
Deletes a rank with the specified name -
getRank
Gets a rank with the specified name or null if not found- Parameters:
name- the rank name- Returns:
- a rank or null
-
setDefaultRank
Sets the default rank for this clan.- Parameters:
name- The name of the rank to be set as default
-
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()
-
getMembers()