com.planet_ink.coffee_mud.Libraries
Class Clans

java.lang.Object
  extended by com.planet_ink.coffee_mud.Libraries.StdLibrary
      extended by com.planet_ink.coffee_mud.Libraries.Clans
All Implemented Interfaces:
CMObject, Tickable, ClanManager, CMLibrary, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class Clans
extends StdLibrary
implements ClanManager

Portions Copyright (c) 2003 Jeremy Vyska Portions Copyright (c) 2004-2018 Bo Zimmerman Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Field Summary
protected  SHashtable<java.lang.String,Clan> all
           
protected  java.util.List<Pair<Clan,java.lang.Integer>> all2
           
protected  ClanManager[] clanLibList
           
protected  java.util.Map<java.lang.String,java.lang.String> clanWebPathMappings
           
protected  long lastGovernmentLoad
           
protected  java.util.Map<java.lang.String,Clan> webPathClanMappings
           
 
Fields inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
isDebugging, name, serviceClient, tickStatus
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BEAMWEAPON, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
 
Constructor Summary
Clans()
           
 
Method Summary
 boolean activate()
          Activates the library.
 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.
 void clanTrophyScan()
           
 ClanGovernment createGovernment(java.lang.String name)
          Creates the new stock government
 ClanGovernment createSampleGovernment()
          Creates, but does not add, a sample government object
protected  int filterMedianLevel(java.util.List<Clan.FullMemberRecord> members)
           
 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.
 java.util.List<Pair<Clan,Clan>> findUncommonRivalrousClans(MOB M1, MOB M2)
           
 void forceTick()
          Force the clans maintenance thread
 java.util.List<Pair<Clan,Clan>> getAllClanPairs(MOB M1, MOB M2)
           
 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(Clan C1, Clan C2)
           
 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
protected  ClanManager[] getOtherClanLibAllHosts()
           
 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.
protected  Clan getTrophyWinner(Clan.Trophy trophy)
           
 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.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
protected  java.lang.String indt(int x)
           
 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(Clan C1, Clan C2, int relation)
           
 boolean isCommonClanRelations(java.lang.String clanID1, java.lang.String clanID2, 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.
protected  boolean isMember(java.util.List<Clan.MemberRecord> members, java.lang.String name)
           
 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 propertiesLoaded()
          This method is called whenever system properties are altered by the user.
 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.
 boolean shutdown()
          Shuts down the library.
 boolean tick(Tickable ticking, int tickID)
          this is the method which is called periodically by the threading engine.
 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 class com.planet_ink.coffee_mud.Libraries.StdLibrary
checkDatabase, compareTo, copyOf, getServiceClient, getTickStatus, initializeClass, L, name, newInstance, setThreadStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary
getServiceClient, L
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

all

protected SHashtable<java.lang.String,Clan> all

all2

protected java.util.List<Pair<Clan,java.lang.Integer>> all2

lastGovernmentLoad

protected long lastGovernmentLoad

webPathClanMappings

protected java.util.Map<java.lang.String,Clan> webPathClanMappings

clanWebPathMappings

protected java.util.Map<java.lang.String,java.lang.String> clanWebPathMappings

clanLibList

protected ClanManager[] clanLibList
Constructor Detail

Clans

public Clans()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, Tech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Overrides:
ID in class StdLibrary
Returns:
the name of this class

isCommonClanRelations

public boolean isCommonClanRelations(Clan C1,
                                     Clan C2,
                                     int relation)

isCommonClanRelations

public boolean isCommonClanRelations(java.lang.String clanID1,
                                     java.lang.String clanID2,
                                     int relation)
Description copied from interface: ClanManager
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.

Specified by:
isCommonClanRelations in interface ClanManager
Parameters:
clanID1 - the first clan to evaluate
clanID2 - 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

public boolean isAtClanWar(MOB M1,
                           MOB M2)
Description copied from interface: ClanManager
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.

Specified by:
isAtClanWar in interface ClanManager
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

checkClanPrivilege

public boolean checkClanPrivilege(MOB mob,
                                  Clan.Function func)
Description copied from interface: ClanManager
Returns whether the given clan set contains a clan that allows the given mob to do the given function in the clan.

Specified by:
checkClanPrivilege in interface ClanManager
Parameters:
mob - the mob to check the clans of
func - the function to check for
Returns:
true if allowed, false otherwise

checkClanPrivilege

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

Specified by:
checkClanPrivilege in interface ClanManager
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

public Pair<Clan,java.lang.Integer> findPrivilegedClan(MOB mob,
                                                       Clan.Function func)
Description copied from interface: ClanManager
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.

Specified by:
findPrivilegedClan in interface ClanManager
Parameters:
mob - the mob to check the clans of
func - the function to check for
Returns:
the clan and role integer

findPrivilegedClans

public java.util.List<Pair<Clan,java.lang.Integer>> findPrivilegedClans(MOB mob,
                                                                        Clan.Function func)
Description copied from interface: ClanManager
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.

Specified by:
findPrivilegedClans in interface ClanManager
Parameters:
mob - the mob to check the clans of
func - the function to check for
Returns:
the clan and role integers

findRivalrousClan

public Clan findRivalrousClan(MOB mob)
Description copied from interface: ClanManager
Searches for a clan in the list that can be rivalrous with other clans. First one found is returned.

Specified by:
findRivalrousClan in interface ClanManager
Parameters:
mob - the mob to check the clans of
Returns:
First clan of the mobs that is rivalrous

findConquerableClan

public Clan findConquerableClan(MOB mob)
Description copied from interface: ClanManager
Searches for a clan in the list that can be conquerable with other clans. First one found is returned.

Specified by:
findConquerableClan in interface ClanManager
Parameters:
mob - the mob to check the clans of
Returns:
First clan of the mobs that is conquerable of others

findCommonRivalrousClans

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

Specified by:
findCommonRivalrousClans in interface ClanManager
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

findRivalrousClans

public java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB mob)
Description copied from interface: ClanManager
Searches for all clans that can be rivalrous with other clans.

Specified by:
findRivalrousClans in interface ClanManager
Parameters:
mob - the mob to check the clans of
Returns:
List of the mobs clans that are rivalrous

findRivalrousClans

public java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB clanSourceMob,
                                                                       MOB filterMob)
Description copied from interface: ClanManager
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.

Specified by:
findRivalrousClans in interface ClanManager
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

findUncommonRivalrousClans

public java.util.List<Pair<Clan,Clan>> findUncommonRivalrousClans(MOB M1,
                                                                  MOB M2)

getAllClanPairs

public java.util.List<Pair<Clan,Clan>> getAllClanPairs(MOB M1,
                                                       MOB M2)

getClanRelations

public int getClanRelations(Clan C1,
                            Clan C2)

getClanRelations

public int getClanRelations(java.lang.String clanID1,
                            java.lang.String clanID2)
Description copied from interface: ClanManager
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.

Specified by:
getClanRelations in interface ClanManager
Parameters:
clanID1 - the first clan to evaluate
clanID2 - the second clan to evaluate
Returns:
the relation code integer
See Also:
Clan.REL_DESCS

findAnyClanRelations

public boolean findAnyClanRelations(MOB M1,
                                    MOB M2,
                                    int relation)
Description copied from interface: ClanManager
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.

Specified by:
findAnyClanRelations in interface ClanManager
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

isAnyCommonClan

public boolean isAnyCommonClan(MOB M1,
                               MOB M2)
Description copied from interface: ClanManager
Returns whether the two mobs share ANY common clans, even non-rivalrous ones.

Specified by:
isAnyCommonClan in interface ClanManager
Parameters:
M1 - first mob
M2 - second mob
Returns:
true if they share a clan, false otherwise

getOtherClanLibAllHosts

protected ClanManager[] getOtherClanLibAllHosts()

getClan

public Clan getClan(java.lang.String id)
Description copied from interface: ClanManager
Returns the Clan object associated with the given clan name

Specified by:
getClan in interface ClanManager
Parameters:
id - the clan name
Returns:
the Clan object associated with the given clan name
See Also:
Clan

getClanAnyHost

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

Specified by:
getClanAnyHost in interface ClanManager
Parameters:
id - the clan name
Returns:
the Clan object associated with the given clan name
See Also:
Clan

findClan

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

Specified by:
findClan in interface ClanManager
Parameters:
id - the clan name
Returns:
the Clan object associated with the given clan name
See Also:
Clan

isMember

protected boolean isMember(java.util.List<Clan.MemberRecord> members,
                           java.lang.String name)

isFamilyOfMembership

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

Specified by:
isFamilyOfMembership in interface ClanManager
Parameters:
M - the mob to evaluate
members - the members of a clan
Returns:
true if the mob is a family member, and false otherwise

clans

public java.util.Enumeration<Clan> clans()
Description copied from interface: ClanManager
Returns an enumeration of all the Clans in the game

Specified by:
clans in interface ClanManager
Returns:
an enumeration of all the Clans in the game

numClans

public int numClans()
Description copied from interface: ClanManager
Returns the number of clans in the game.

Specified by:
numClans in interface ClanManager
Returns:
the number of clans in the game.

addClan

public void addClan(Clan C)
Description copied from interface: ClanManager
Adds the given clan to the games list

Specified by:
addClan in interface ClanManager
Parameters:
C - the clan to add

removeClan

public void removeClan(Clan C)
Description copied from interface: ClanManager
Removes the given clan from the games list

Specified by:
removeClan in interface ClanManager
Parameters:
C - the clan to remove

tickAllClans

public void tickAllClans()
Description copied from interface: ClanManager
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.

Specified by:
tickAllClans in interface ClanManager

clanAnnounceAll

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

Specified by:
clanAnnounceAll in interface ClanManager
Parameters:
msg - the message to send

clansNames

public java.util.Enumeration<java.lang.String> clansNames()
Description copied from interface: ClanManager
Returns a list of all available clans names in the game, as Clan objects.

Specified by:
clansNames in interface ClanManager
Returns:
a list of all available clans names in the game,
See Also:
Clan

clansNamesAllHosts

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

Specified by:
clansNamesAllHosts in interface ClanManager
Returns:
all clan names across all shared map hosts.

clanRoles

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

Specified by:
clanRoles in interface ClanManager
Returns:
all clans and their last-cached accept-positions

translatePrize

public java.lang.String translatePrize(Clan.Trophy trophy)
Description copied from interface: ClanManager
Returns a descriptive name for the given trophy code number.

Specified by:
translatePrize in interface ClanManager
Parameters:
trophy - the trophy code number
Returns:
the descriptive name
See Also:
Clan.Trophy

trophySystemActive

public boolean trophySystemActive()
Description copied from interface: ClanManager
Returns whether this mud has activated its trophy system for clans.

Specified by:
trophySystemActive in interface ClanManager
Returns:
whether this mud has activated its trophy system for clans.

goForward

public boolean goForward(MOB mob,
                         Clan C,
                         java.util.List<java.lang.String> commands,
                         Clan.Function function,
                         boolean voteIfNecessary)
Description copied from interface: ClanManager
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

Specified by:
goForward in interface ClanManager
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

indt

protected java.lang.String indt(int x)

getLastGovernmentLoad

public long getLastGovernmentLoad()
Description copied from interface: ClanManager
Get last time governments were loaded/updated

Specified by:
getLastGovernmentLoad in interface ClanManager
Returns:
time in ms

getGovernmentHelp

public java.lang.String getGovernmentHelp(MOB mob,
                                          java.lang.String named,
                                          boolean exact)
Description copied from interface: ClanManager
Returns help on the government type named, if it is available

Specified by:
getGovernmentHelp in interface ClanManager
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

createSampleGovernment

public ClanGovernment createSampleGovernment()
Description copied from interface: ClanManager
Creates, but does not add, a sample government object

Specified by:
createSampleGovernment in interface ClanManager
Returns:
a sample government object

reSaveGovernmentsXML

public void reSaveGovernmentsXML()
Description copied from interface: ClanManager
Forces the stock governments to be re-saved to clangovernments.xml.

Specified by:
reSaveGovernmentsXML in interface ClanManager

createGovernment

public ClanGovernment createGovernment(java.lang.String name)
Description copied from interface: ClanManager
Creates the new stock government

Specified by:
createGovernment in interface ClanManager
Parameters:
name - governmentname
Returns:
new stock government

removeGovernment

public boolean removeGovernment(ClanGovernment government)
Description copied from interface: ClanManager
Deletes the stock government.. confusing all the clans that currently use it.

Specified by:
removeGovernment in interface ClanManager
Parameters:
government - the government to delete
Returns:
true if it was there to remove, false otherwise

getStockGovernments

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

Specified by:
getStockGovernments in interface ClanManager
Returns:
the clan government object
See Also:
ClanGovernment

getDefaultGovernment

public ClanGovernment getDefaultGovernment()
Description copied from interface: ClanManager
Returns the default government definition object. See /resources/clangovernments.xml Also:

Specified by:
getDefaultGovernment in interface ClanManager
Returns:
the clan government object
See Also:
ClanGovernment

getStockGovernment

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

Specified by:
getStockGovernment in interface ClanManager
Parameters:
typeid - the internal typeid
Returns:
the clan government object
See Also:
ClanGovernment

makeGovernmentXML

public java.lang.String makeGovernmentXML(ClanGovernment gvt)
Description copied from interface: ClanManager
Converts a given clan government object into xml.

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

makeGovernmentXML

public java.lang.String makeGovernmentXML(ClanGovernment[] gvts)
Description copied from interface: ClanManager
Converts a given clan government objects into xml.

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

getClansByCategory

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

Specified by:
getClansByCategory in interface ClanManager
Parameters:
M - the mob to evaluate
category - the clan goverment category
Returns:
the list of clans this mob belongs to

parseGovernmentXML

public ClanGovernment[] parseGovernmentXML(java.lang.StringBuffer xml)
Description copied from interface: ClanManager
Converts xml into clan government objects.

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

getWebPathClanMapping

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

Specified by:
getWebPathClanMapping in interface ClanManager
Parameters:
webPath - a full vfs resource path
Returns:
the clan associated with the path, or null

getClanWebTemplateDir

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

Specified by:
getClanWebTemplateDir in interface ClanManager
Parameters:
webPath - a full vfs resource path
Returns:
the template path associated with the resource path, or null

getWebPathClan

public Clan getWebPathClan(java.lang.String sitePath)
Description copied from interface: ClanManager
Returns the clan which may or may not be assigned to the absolute file path specified.

Specified by:
getWebPathClan in interface ClanManager
Parameters:
sitePath - the absolute path of the web dir assigned to this clan
Returns:
a clan at that path, or NULL for none

clanAnnounce

public void clanAnnounce(MOB mob,
                         java.lang.String msg)
Description copied from interface: ClanManager
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.

Specified by:
clanAnnounce in interface ClanManager
Parameters:
mob - the mob who is announcing the message
msg - string message to send to the clan info channels

filterMedianLevel

protected int filterMedianLevel(java.util.List<Clan.FullMemberRecord> members)

getTrophyWinner

protected Clan getTrophyWinner(Clan.Trophy trophy)

clanTrophyScan

public void clanTrophyScan()

activate

public boolean activate()
Description copied from interface: CMLibrary
Activates the library. This is called after the mud is booted, but before connections are accepted.

Specified by:
activate in interface CMLibrary
Overrides:
activate in class StdLibrary
Returns:
true if activation was successful, false if you're screwed
See Also:
CMLibrary.shutdown()

tick

public boolean tick(Tickable ticking,
                    int tickID)
Description copied from interface: Tickable
this is the method which is called periodically by the threading engine. How often it is called depends on the parameters passed to the threadding engine when it is submitted for thread access. Typically the period is once per TIME_TICK period, but that is determined when the object is submitted to the thread engine.

Specified by:
tick in interface Tickable
Overrides:
tick in class StdLibrary
Parameters:
ticking - a reference to this Tickable object
tickID - the TICKID_ constant describing this periodic call, as defined in Tickable
Returns:
true always, unless this object no longer wishes to ever tick again, in which case false
See Also:
Tickable, ServiceEngine, TickableGroup

shutdown

public boolean shutdown()
Description copied from interface: CMLibrary
Shuts down the library. Called at system shutdown time obviously, but is sometimes called just to reset the library.

Specified by:
shutdown in interface CMLibrary
Overrides:
shutdown in class StdLibrary
Returns:
true if shutdown was successful, false if there's nothing you can do about it
See Also:
CMLibrary.activate()

forceTick

public void forceTick()
Description copied from interface: ClanManager
Force the clans maintenance thread

Specified by:
forceTick in interface ClanManager

propertiesLoaded

public void propertiesLoaded()
Description copied from interface: CMLibrary
This method is called whenever system properties are altered by the user. This allows the library to react to any important properties they monitor.

Specified by:
propertiesLoaded in interface CMLibrary
Overrides:
propertiesLoaded in class StdLibrary