com.planet_ink.coffee_mud.Libraries.interfaces
Interface ClanManager

All Superinterfaces:
java.lang.Cloneable, CMLibrary, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
Clans

public interface ClanManager
extends CMLibrary

This library manages the list of Clans in the game, and helps administer their most basic functions.

See Also:
Clan

Method Summary
 void addClan(Clan C)
          Adds the given clan to the games list
 boolean checkClanPrivilege(MOB mob, Clan.Function func)
          Returns whether the given clan set contains a clan that allows the given mob to do the given function in the clan.
 boolean checkClanPrivilege(MOB mob, java.lang.String clanID, Clan.Function func)
          Returns whether the given mob belongs to the given clan, and if so, whether they can do the given function in the clan.
 void clanAnnounce(MOB mob, java.lang.String msg)
          Makes an announcement to the clan announcement channel from the given mob.
 void clanAnnounceAll(java.lang.String msg)
          Sends a message to the games official CLAN chat channel.
 java.lang.Iterable<Pair<Clan,java.lang.Integer>> clanRoles()
          Returns all clans and their last-cached accept-positions The auto-positions may be inaccurate.
 java.util.Enumeration<Clan> clans()
          Returns an enumeration of all the Clans in the game
 java.util.Enumeration<java.lang.String> clansNames()
          Returns a list of all available clans names in the game, as Clan objects.
 java.util.Enumeration<java.lang.String> clansNamesAllHosts()
          Returns a list of all available clan names for all clan managers that share a single map.
 ClanGovernment createGovernment(java.lang.String name)
          Creates the new stock government
 ClanGovernment createSampleGovernment()
          Creates, but does not add, a sample government object
 boolean findAnyClanRelations(MOB M1, MOB M2, int relation)
          This method is used to determine the basic relationship between two mobs clans.
 Clan findClan(java.lang.String id)
          Returns the Clan object associated with the given clan name, or if the name is not found, the name that most closely matches it.
 java.util.List<Triad<Clan,java.lang.Integer,java.lang.Integer>> findCommonRivalrousClans(MOB mob1, MOB mob2)
          Searches for all clans that can be rivalrous with other clans that are commonly shared between two mobs, along with their two roles
 Clan findConquerableClan(MOB mob)
          Searches for a clan in the list that can be conquerable with other clans.
 Pair<Clan,java.lang.Integer> findPrivilegedClan(MOB mob, Clan.Function func)
          If the given mob belongs to a clan, and if they can do the given function in a clan, this will return that clan object and the integer.
 java.util.List<Pair<Clan,java.lang.Integer>> findPrivilegedClans(MOB mob, Clan.Function func)
          If the given mob belongs to a clan, and if they can do the given function in a clan, this will return those clan objects and their role integer.
 Clan findRivalrousClan(MOB mob)
          Searches for a clan in the list that can be rivalrous with other clans.
 java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB mob)
          Searches for all clans that can be rivalrous with other clans.
 java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB clanSourceMob, MOB filterMob)
          Returns a list of clans that the source mob belongs to which the filter mob does NOT also belong.
 void forceTick()
          Force the clans maintenance thread
 Clan getClan(java.lang.String id)
          Returns the Clan object associated with the given clan name
 Clan getClanAnyHost(java.lang.String id)
          Returns the Clan object associated with the given clan name from any host sharing the same map as the caller.
 int getClanRelations(java.lang.String clanID1, java.lang.String clanID2)
          This method is used to determine the basic relationship between two clans.
 java.util.List<Pair<Clan,java.lang.Integer>> getClansByCategory(MOB M, java.lang.String category)
          Returns the list of clans this mob belongs to in the given category.
 java.lang.String getClanWebTemplateDir(java.lang.String webPath)
          Returns the template vfs path associated with a given specific web path.
 ClanGovernment getDefaultGovernment()
          Returns the default government definition object.
 java.lang.String getGovernmentHelp(MOB mob, java.lang.String named, boolean exact)
          Returns help on the government type named, if it is available
 long getLastGovernmentLoad()
          Get last time governments were loaded/updated
 ClanGovernment getStockGovernment(int typeid)
          Returns a government definition object of the given internal stock clangovernments.xml id.
 ClanGovernment[] getStockGovernments()
          Returns all government definition objects from internal stock clangovernments.xml file.
 Clan getWebPathClan(java.lang.String sitePath)
          Returns the clan which may or may not be assigned to the absolute file path specified.
 Clan getWebPathClanMapping(java.lang.String webPath)
          Returns the clan associated with a given specific web path.
 boolean goForward(MOB mob, Clan C, java.util.List<java.lang.String> commands, Clan.Function function, boolean voteIfNecessary)
          Examines the given command string, which is based on the given clan function code.
 boolean isAnyCommonClan(MOB M1, MOB M2)
          Returns whether the two mobs share ANY common clans, even non-rivalrous ones.
 boolean isAtClanWar(MOB M1, MOB M2)
          This method is used to determine the basic relationship between two clan members.
 boolean isCommonClanRelations(java.lang.String clanName1, java.lang.String clanName2, int relation)
          This method is used to determine the basic relationship between two clans.
 boolean isFamilyOfMembership(MOB M, java.util.List<Clan.MemberRecord> members)
          Returns whether the given MOB is a member of any of the families represented by the given list of clan members.
 java.lang.String makeGovernmentXML(ClanGovernment gvt)
          Converts a given clan government object into xml.
 java.lang.String makeGovernmentXML(ClanGovernment[] gvts)
          Converts a given clan government objects into xml.
 int numClans()
          Returns the number of clans in the game.
 ClanGovernment[] parseGovernmentXML(java.lang.StringBuffer xml)
          Converts xml into clan government objects.
 void removeClan(Clan C)
          Removes the given clan from the games list
 boolean removeGovernment(ClanGovernment government)
          Deletes the stock government..
 void reSaveGovernmentsXML()
          Forces the stock governments to be re-saved to clangovernments.xml.
 void tickAllClans()
          Forces all clans to go through their maintenance process, which normally only occurs infrequently.
 java.lang.String translatePrize(Clan.Trophy trophy)
          Returns a descriptive name for the given trophy code number.
 boolean trophySystemActive()
          Returns whether this mud has activated its trophy system for clans.
 
Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary
activate, getServiceClient, L, propertiesLoaded, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

clansNames

java.util.Enumeration<java.lang.String> clansNames()
Returns a list of all available clans names in the game, as Clan objects.

Returns:
a list of all available clans names in the game,
See Also:
Clan

clansNamesAllHosts

java.util.Enumeration<java.lang.String> clansNamesAllHosts()
Returns a list of all available clan names for all clan managers that share a single map. This is for multi-host muds.

Returns:
all clan names across all shared map hosts.

numClans

int numClans()
Returns the number of clans in the game.

Returns:
the number of clans in the game.

isCommonClanRelations

boolean isCommonClanRelations(java.lang.String clanName1,
                              java.lang.String clanName2,
                              int relation)
This method is used to determine the basic relationship between two clans. The two clans are evaluated, based on their declared relationship to each other, and the relations they inherit from allys. It is then compared with the passed in relationship constant. If they match, true is returned, and false otherwise.

Parameters:
clanName1 - the first clan to evaluate
clanName2 - the second clan to evaluate
relation - the clan relation to compare to
Returns:
true if the common relationship matches the given relation, and false otherwise
See Also:
Clan.REL_DESCS

isAtClanWar

boolean isAtClanWar(MOB M1,
                    MOB M2)
This method is used to determine the basic relationship between two clan members. The two mobs first rivalrous clans are evaluated, based on their declared relationship to each other, and the relations they inherit from allys. It is then compared with the passed the War status. If they match, true is returned, and false otherwise.

Parameters:
M1 - the first mobs first rivalrous clan to evaluate
M2 - the second mobs first rivalrous clan to evaluate
Returns:
true if the common relationship matches war, and false otherwise
See Also:
Clan.REL_DESCS

isAnyCommonClan

boolean isAnyCommonClan(MOB M1,
                        MOB M2)
Returns whether the two mobs share ANY common clans, even non-rivalrous ones.

Parameters:
M1 - first mob
M2 - second mob
Returns:
true if they share a clan, false otherwise

findAnyClanRelations

boolean findAnyClanRelations(MOB M1,
                             MOB M2,
                             int relation)
This method is used to determine the basic relationship between two mobs clans. The two sets of clans are evaluated, based on their declared relationship to each other, and the relations they inherit from allys. This relationship is then checked against the given relation. If any pairing matches the relation, true is returned.

Parameters:
M1 - the first mob whose clans to evaluate
M2 - the second mob whose clans to evaluate
relation - the relation to look for
Returns:
true if any clans relate in the given way, false otherwise
See Also:
Clan.REL_DESCS

getClanRelations

int getClanRelations(java.lang.String clanID1,
                     java.lang.String clanID2)
This method is used to determine the basic relationship between two clans. The two clans are evaluated, based on their declared relationship to each other, and the relations they inherit from allys. This relationship is then returned as a relation constant number.

Parameters:
clanID1 - the first clan to evaluate
clanID2 - the second clan to evaluate
Returns:
the relation code integer
See Also:
Clan.REL_DESCS

getLastGovernmentLoad

long getLastGovernmentLoad()
Get last time governments were loaded/updated

Returns:
time in ms

getWebPathClan

Clan getWebPathClan(java.lang.String sitePath)
Returns the clan which may or may not be assigned to the absolute file path specified.

Parameters:
sitePath - the absolute path of the web dir assigned to this clan
Returns:
a clan at that path, or NULL for none

checkClanPrivilege

boolean checkClanPrivilege(MOB mob,
                           Clan.Function func)
Returns whether the given clan set contains a clan that allows the given mob to do the given function in the clan.

Parameters:
mob - the mob to check the clans of
func - the function to check for
Returns:
true if allowed, false otherwise

checkClanPrivilege

boolean checkClanPrivilege(MOB mob,
                           java.lang.String clanID,
                           Clan.Function func)
Returns whether the given mob belongs to the given clan, and if so, whether they can do the given function in the clan.

Parameters:
mob - the mob to look for privileges for
clanID - the clanID to check for to check for
func - the function to check for
Returns:
true if allowed, false otherwise

findPrivilegedClan

Pair<Clan,java.lang.Integer> findPrivilegedClan(MOB mob,
                                                Clan.Function func)
If the given mob belongs to a clan, and if they can do the given function in a clan, this will return that clan object and the integer.

Parameters:
mob - the mob to check the clans of
func - the function to check for
Returns:
the clan and role integer

findPrivilegedClans

java.util.List<Pair<Clan,java.lang.Integer>> findPrivilegedClans(MOB mob,
                                                                 Clan.Function func)
If the given mob belongs to a clan, and if they can do the given function in a clan, this will return those clan objects and their role integer.

Parameters:
mob - the mob to check the clans of
func - the function to check for
Returns:
the clan and role integers

findRivalrousClans

java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB clanSourceMob,
                                                                MOB filterMob)
Returns a list of clans that the source mob belongs to which the filter mob does NOT also belong. The clans will be rivalrous only.

Parameters:
clanSourceMob - the mob to source the clan list from
filterMob - the mob to use to filter out source clans
Returns:
the clan and role integers

findCommonRivalrousClans

java.util.List<Triad<Clan,java.lang.Integer,java.lang.Integer>> findCommonRivalrousClans(MOB mob1,
                                                                                         MOB mob2)
Searches for all clans that can be rivalrous with other clans that are commonly shared between two mobs, along with their two roles

Parameters:
mob1 - the first mob to check the clans of
mob2 - the second mob to check the clans of
Returns:
potentially rivalrous clans and the mobs roles in them

findRivalrousClan

Clan findRivalrousClan(MOB mob)
Searches for a clan in the list that can be rivalrous with other clans. First one found is returned.

Parameters:
mob - the mob to check the clans of
Returns:
First clan of the mobs that is rivalrous

findConquerableClan

Clan findConquerableClan(MOB mob)
Searches for a clan in the list that can be conquerable with other clans. First one found is returned.

Parameters:
mob - the mob to check the clans of
Returns:
First clan of the mobs that is conquerable of others

findRivalrousClans

java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB mob)
Searches for all clans that can be rivalrous with other clans.

Parameters:
mob - the mob to check the clans of
Returns:
List of the mobs clans that are rivalrous

getClan

Clan getClan(java.lang.String id)
Returns the Clan object associated with the given clan name

Parameters:
id - the clan name
Returns:
the Clan object associated with the given clan name
See Also:
Clan

getClanAnyHost

Clan getClanAnyHost(java.lang.String id)
Returns the Clan object associated with the given clan name from any host sharing the same map as the caller.

Parameters:
id - the clan name
Returns:
the Clan object associated with the given clan name
See Also:
Clan

findClan

Clan findClan(java.lang.String id)
Returns the Clan object associated with the given clan name, or if the name is not found, the name that most closely matches it.

Parameters:
id - the clan name
Returns:
the Clan object associated with the given clan name
See Also:
Clan

clans

java.util.Enumeration<Clan> clans()
Returns an enumeration of all the Clans in the game

Returns:
an enumeration of all the Clans in the game

clanRoles

java.lang.Iterable<Pair<Clan,java.lang.Integer>> clanRoles()
Returns all clans and their last-cached accept-positions The auto-positions may be inaccurate.

Returns:
all clans and their last-cached accept-positions

addClan

void addClan(Clan C)
Adds the given clan to the games list

Parameters:
C - the clan to add

removeClan

void removeClan(Clan C)
Removes the given clan from the games list

Parameters:
C - the clan to remove

getWebPathClanMapping

Clan getWebPathClanMapping(java.lang.String webPath)
Returns the clan associated with a given specific web path. It is derived from the clanwebsites entry in coffeemud.ini file.

Parameters:
webPath - a full vfs resource path
Returns:
the clan associated with the path, or null

getClanWebTemplateDir

java.lang.String getClanWebTemplateDir(java.lang.String webPath)
Returns the template vfs path associated with a given specific web path. It is derived from the clanwebsites entry in coffeemud.ini file.

Parameters:
webPath - a full vfs resource path
Returns:
the template path associated with the resource path, or null

tickAllClans

void tickAllClans()
Forces all clans to go through their maintenance process, which normally only occurs infrequently. This does things like handle automatic promotions, manage votes, and clean out inactive clans.


clanAnnounceAll

void clanAnnounceAll(java.lang.String msg)
Sends a message to the games official CLAN chat channel. This is normally for messages that may interest all clans.

Parameters:
msg - the message to send

translatePrize

java.lang.String translatePrize(Clan.Trophy trophy)
Returns a descriptive name for the given trophy code number.

Parameters:
trophy - the trophy code number
Returns:
the descriptive name
See Also:
Clan.Trophy

trophySystemActive

boolean trophySystemActive()
Returns whether this mud has activated its trophy system for clans.

Returns:
whether this mud has activated its trophy system for clans.

isFamilyOfMembership

boolean isFamilyOfMembership(MOB M,
                             java.util.List<Clan.MemberRecord> members)
Returns whether the given MOB is a member of any of the families represented by the given list of clan members.

Parameters:
M - the mob to evaluate
members - the members of a clan
Returns:
true if the mob is a family member, and false otherwise

getClansByCategory

java.util.List<Pair<Clan,java.lang.Integer>> getClansByCategory(MOB M,
                                                                java.lang.String category)
Returns the list of clans this mob belongs to in the given category.

Parameters:
M - the mob to evaluate
category - the clan goverment category
Returns:
the list of clans this mob belongs to

getGovernmentHelp

java.lang.String getGovernmentHelp(MOB mob,
                                   java.lang.String named,
                                   boolean exact)
Returns help on the government type named, if it is available

Parameters:
mob - the viewer of the government type
named - the possible name of the government
exact - true to only match exact, or false otherwise
Returns:
null, or the help for the government named

getStockGovernment

ClanGovernment getStockGovernment(int typeid)
Returns a government definition object of the given internal stock clangovernments.xml id. See /resources/clangovernments.xml Also:

Parameters:
typeid - the internal typeid
Returns:
the clan government object
See Also:
ClanGovernment

getDefaultGovernment

ClanGovernment getDefaultGovernment()
Returns the default government definition object. See /resources/clangovernments.xml Also:

Returns:
the clan government object
See Also:
ClanGovernment

createSampleGovernment

ClanGovernment createSampleGovernment()
Creates, but does not add, a sample government object

Returns:
a sample government object

getStockGovernments

ClanGovernment[] getStockGovernments()
Returns all government definition objects from internal stock clangovernments.xml file. See /resources/clangovernments.xml Also:

Returns:
the clan government object
See Also:
ClanGovernment

makeGovernmentXML

java.lang.String makeGovernmentXML(ClanGovernment gvt)
Converts a given clan government object into xml.

Parameters:
gvt - the clan government object
Returns:
the xml
See Also:
ClanGovernment, makeGovernmentXML(com.planet_ink.coffee_mud.Common.interfaces.ClanGovernment[]), parseGovernmentXML(StringBuffer)

makeGovernmentXML

java.lang.String makeGovernmentXML(ClanGovernment[] gvts)
Converts a given clan government objects into xml.

Parameters:
gvts - the clan government objects
Returns:
the xml
See Also:
ClanGovernment, makeGovernmentXML(com.planet_ink.coffee_mud.Common.interfaces.ClanGovernment), parseGovernmentXML(StringBuffer)

parseGovernmentXML

ClanGovernment[] parseGovernmentXML(java.lang.StringBuffer xml)
Converts xml into clan government objects.

Parameters:
xml - the xml
Returns:
the clan government objects
See Also:
ClanGovernment, makeGovernmentXML(com.planet_ink.coffee_mud.Common.interfaces.ClanGovernment), makeGovernmentXML(com.planet_ink.coffee_mud.Common.interfaces.ClanGovernment[])

reSaveGovernmentsXML

void reSaveGovernmentsXML()
Forces the stock governments to be re-saved to clangovernments.xml.


createGovernment

ClanGovernment createGovernment(java.lang.String name)
Creates the new stock government

Parameters:
name - governmentname
Returns:
new stock government

removeGovernment

boolean removeGovernment(ClanGovernment government)
Deletes the stock government.. confusing all the clans that currently use it.

Parameters:
government - the government to delete
Returns:
true if it was there to remove, false otherwise

clanAnnounce

void clanAnnounce(MOB mob,
                  java.lang.String msg)
Makes an announcement to the clan announcement channel from the given mob. These are channels marked in the coffeemud.ini file as receiving clan info messages. These messages are only seen by the authors clan members.

Parameters:
mob - the mob who is announcing the message
msg - string message to send to the clan info channels

goForward

boolean goForward(MOB mob,
                  Clan C,
                  java.util.List<java.lang.String> commands,
                  Clan.Function function,
                  boolean voteIfNecessary)
Examines the given command string, which is based on the given clan function code. If the given Clan requires a vote to accomplish it, the vote will be created. If the given clan forbids the given mob from performing the given function, or from even starting a vote on it, the method will return false. If the mob is allowed to perform

Parameters:
mob - the player who wants to perform the function
C - the clan that the player belongs to
commands - the command list describing the function that wants to be executed
function - the function code described by the commands list
voteIfNecessary - true to start a vote if one is needed, false to just return true.
Returns:
true to execute the given command, and false not to.
See Also:
Clan.Function.ACCEPT

forceTick

void forceTick()
Force the clans maintenance thread