com.planet_ink.coffee_mud.Libraries
Class CMPlayers

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

public class CMPlayers
extends StdLibrary
implements PlayerLibrary


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.PlayerLibrary
PlayerLibrary.ThinnerPlayer, PlayerLibrary.ThinPlayer
 
Field Summary
protected  SVector<PlayerAccount> accountsList
           
protected  boolean allAccountsLoaded
           
protected  long[] autoPurgeDaysLevels
           
protected  int autoPurgeHash
           
protected static java.util.List<Pair<java.lang.String,java.lang.Integer>> emptyPride
           
protected  PlayerLibrary[] playerLibList
           
protected  CrossRefTreeMap<MOB,Room> playerLocations
           
protected  SVector<MOB> playersList
           
protected  long[] prePurgeLevels
           
protected static int PRIDE_TOP_SIZE
           
protected  java.util.List<Pair<java.lang.String,java.lang.Integer>>[][] topAccounts
           
protected  java.util.List<Pair<java.lang.String,java.lang.Integer>>[][] topPlayers
           
protected  long[] topPrideExpiration
           
 
Fields inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
isDebugging, name, serviceClient, tickStatus
 
Fields inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.PlayerLibrary
ACCOUNT_THIN_SORT_CODES, CHAR_THIN_SORT_CODES, CHAR_THIN_SORT_CODES2
 
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
CMPlayers()
           
 
Method Summary
 boolean accountExists(java.lang.String name)
           
 boolean accountExistsAllHosts(java.lang.String name)
           
 java.util.Enumeration<PlayerAccount> accounts()
           
 java.util.Enumeration<PlayerAccount> accounts(java.lang.String sort, java.util.Map<java.lang.String,java.lang.Object> cache)
           
 boolean activate()
          Activates the library.
 void addAccount(PlayerAccount acct)
           
 void addPlayer(MOB newOne)
           
protected  void adjustTopPrideStats(java.util.List<Pair<java.lang.String,java.lang.Integer>>[][] topWhat, java.lang.String name, AccountStats.PrideStat stat, AccountStats astats)
           
 int bumpPrideStat(MOB mob, AccountStats.PrideStat stat, int amt)
           
 void changePlayersLocation(MOB mob, Room room)
           
 void delPlayer(MOB oneToDel)
           
 MOB findPlayerOnline(java.lang.String srchStr, boolean exactOnly)
           
 void forceTick()
           
 PlayerAccount getAccount(java.lang.String calledThis)
           
 PlayerAccount getAccountAllHosts(java.lang.String calledThis)
           
 int getAccountThinSortCode(java.lang.String codeName, boolean loose)
           
 int getCharThinSortCode(java.lang.String codeName, boolean loose)
           
 PlayerAccount getLoadAccount(java.lang.String calledThis)
           
 PlayerAccount getLoadAccountByEmail(java.lang.String email)
           
 MOB getLoadPlayer(java.lang.String last)
           
 MOB getLoadPlayerByEmail(java.lang.String email)
           
protected  PlayerLibrary[] getOtherPlayerLibAllHosts()
           
 MOB getPlayer(java.lang.String calledThis)
           
 MOB getPlayerAllHosts(java.lang.String calledThis)
           
 java.util.List<java.lang.String> getPlayerLists()
           
 java.util.List<java.lang.String> getPlayerListsAllHosts()
           
 java.util.Set<MOB> getPlayersHere(Room room)
           
 java.lang.String getThinSortValue(PlayerAccount account, int code)
           
 java.lang.String getThinSortValue(PlayerLibrary.ThinPlayer player, int code)
           
 java.util.List<Pair<java.lang.String,java.lang.Integer>> getTopPrideAccounts(TimeClock.TimePeriod period, AccountStats.PrideStat stat)
           
 java.util.List<Pair<java.lang.String,java.lang.Integer>> getTopPridePlayers(TimeClock.TimePeriod period, AccountStats.PrideStat stat)
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 boolean isLoadedPlayer(MOB M)
           
 boolean isLoadedPlayer(java.lang.String mobName)
           
 boolean isSameAccount(MOB player1, MOB player2)
           
 boolean isSameAccountIP(MOB player1, MOB player2)
           
 int numPlayers()
           
 void obliterateAccountOnly(PlayerAccount deadAccount)
           
 void obliteratePlayer(MOB deadMOB, boolean deleteAssets, boolean quiet)
           
 Pair<java.lang.Long,int[]>[] parsePrideStats(java.lang.String[] nextPeriods, java.lang.String[] prideStats)
           
 boolean playerExists(java.lang.String name)
           
 boolean playerExistsAllHosts(java.lang.String name)
           
 java.util.Enumeration<MOB> players()
           
 void renamePlayer(MOB mob, java.lang.String oldName)
           
 int savePlayers()
           
 boolean shutdown()
          Shuts down the library.
 java.util.Enumeration<PlayerLibrary.ThinPlayer> thinPlayers(java.lang.String sort, java.util.Map<java.lang.String,java.lang.Object> cache)
           
 boolean tick(Tickable ticking, int tickID)
          this is the method which is called periodically by the threading engine.
 void unloadOfflinePlayer(MOB mob)
           
 
Methods inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
checkDatabase, compareTo, copyOf, getServiceClient, getTickStatus, initializeClass, L, name, newInstance, propertiesLoaded, 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, propertiesLoaded
 
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

playersList

protected SVector<MOB> playersList

accountsList

protected SVector<PlayerAccount> accountsList

allAccountsLoaded

protected boolean allAccountsLoaded

playerLocations

protected CrossRefTreeMap<MOB,Room> playerLocations

autoPurgeDaysLevels

protected long[] autoPurgeDaysLevels

prePurgeLevels

protected long[] prePurgeLevels

autoPurgeHash

protected int autoPurgeHash

playerLibList

protected PlayerLibrary[] playerLibList

PRIDE_TOP_SIZE

protected static final int PRIDE_TOP_SIZE
See Also:
Constant Field Values

topPrideExpiration

protected final long[] topPrideExpiration

topPlayers

protected final java.util.List<Pair<java.lang.String,java.lang.Integer>>[][] topPlayers

topAccounts

protected final java.util.List<Pair<java.lang.String,java.lang.Integer>>[][] topAccounts

emptyPride

protected static final java.util.List<Pair<java.lang.String,java.lang.Integer>> emptyPride
Constructor Detail

CMPlayers

public CMPlayers()
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

numPlayers

public int numPlayers()
Specified by:
numPlayers in interface PlayerLibrary

addPlayer

public void addPlayer(MOB newOne)
Specified by:
addPlayer in interface PlayerLibrary

delPlayer

public void delPlayer(MOB oneToDel)
Specified by:
delPlayer in interface PlayerLibrary

getPlayersHere

public java.util.Set<MOB> getPlayersHere(Room room)
Specified by:
getPlayersHere in interface PlayerLibrary

changePlayersLocation

public void changePlayersLocation(MOB mob,
                                  Room room)
Specified by:
changePlayersLocation in interface PlayerLibrary

getLoadPlayerByEmail

public MOB getLoadPlayerByEmail(java.lang.String email)
Specified by:
getLoadPlayerByEmail in interface PlayerLibrary

unloadOfflinePlayer

public void unloadOfflinePlayer(MOB mob)
Specified by:
unloadOfflinePlayer in interface PlayerLibrary

isSameAccount

public boolean isSameAccount(MOB player1,
                             MOB player2)
Specified by:
isSameAccount in interface PlayerLibrary

isSameAccountIP

public boolean isSameAccountIP(MOB player1,
                               MOB player2)
Specified by:
isSameAccountIP in interface PlayerLibrary

getLoadAccount

public PlayerAccount getLoadAccount(java.lang.String calledThis)
Specified by:
getLoadAccount in interface PlayerLibrary

addAccount

public void addAccount(PlayerAccount acct)
Specified by:
addAccount in interface PlayerLibrary

getLoadAccountByEmail

public PlayerAccount getLoadAccountByEmail(java.lang.String email)
Specified by:
getLoadAccountByEmail in interface PlayerLibrary

getAccount

public PlayerAccount getAccount(java.lang.String calledThis)
Specified by:
getAccount in interface PlayerLibrary

getOtherPlayerLibAllHosts

protected PlayerLibrary[] getOtherPlayerLibAllHosts()

getAccountAllHosts

public PlayerAccount getAccountAllHosts(java.lang.String calledThis)
Specified by:
getAccountAllHosts in interface PlayerLibrary

getPlayerLists

public java.util.List<java.lang.String> getPlayerLists()
Specified by:
getPlayerLists in interface PlayerLibrary

getPlayerListsAllHosts

public java.util.List<java.lang.String> getPlayerListsAllHosts()
Specified by:
getPlayerListsAllHosts in interface PlayerLibrary

getPlayer

public MOB getPlayer(java.lang.String calledThis)
Specified by:
getPlayer in interface PlayerLibrary

getPlayerAllHosts

public MOB getPlayerAllHosts(java.lang.String calledThis)
Specified by:
getPlayerAllHosts in interface PlayerLibrary

getLoadPlayer

public MOB getLoadPlayer(java.lang.String last)
Specified by:
getLoadPlayer in interface PlayerLibrary

accountExists

public boolean accountExists(java.lang.String name)
Specified by:
accountExists in interface PlayerLibrary

accountExistsAllHosts

public boolean accountExistsAllHosts(java.lang.String name)
Specified by:
accountExistsAllHosts in interface PlayerLibrary

isLoadedPlayer

public boolean isLoadedPlayer(MOB M)
Specified by:
isLoadedPlayer in interface PlayerLibrary

isLoadedPlayer

public boolean isLoadedPlayer(java.lang.String mobName)
Specified by:
isLoadedPlayer in interface PlayerLibrary

playerExists

public boolean playerExists(java.lang.String name)
Specified by:
playerExists in interface PlayerLibrary

playerExistsAllHosts

public boolean playerExistsAllHosts(java.lang.String name)
Specified by:
playerExistsAllHosts in interface PlayerLibrary

players

public java.util.Enumeration<MOB> players()
Specified by:
players in interface PlayerLibrary

accounts

public java.util.Enumeration<PlayerAccount> accounts()
Specified by:
accounts in interface PlayerLibrary

getTopPridePlayers

public java.util.List<Pair<java.lang.String,java.lang.Integer>> getTopPridePlayers(TimeClock.TimePeriod period,
                                                                                   AccountStats.PrideStat stat)
Specified by:
getTopPridePlayers in interface PlayerLibrary

getTopPrideAccounts

public java.util.List<Pair<java.lang.String,java.lang.Integer>> getTopPrideAccounts(TimeClock.TimePeriod period,
                                                                                    AccountStats.PrideStat stat)
Specified by:
getTopPrideAccounts in interface PlayerLibrary

bumpPrideStat

public int bumpPrideStat(MOB mob,
                         AccountStats.PrideStat stat,
                         int amt)
Specified by:
bumpPrideStat in interface PlayerLibrary

adjustTopPrideStats

protected void adjustTopPrideStats(java.util.List<Pair<java.lang.String,java.lang.Integer>>[][] topWhat,
                                   java.lang.String name,
                                   AccountStats.PrideStat stat,
                                   AccountStats astats)

renamePlayer

public void renamePlayer(MOB mob,
                         java.lang.String oldName)
Specified by:
renamePlayer in interface PlayerLibrary

obliteratePlayer

public void obliteratePlayer(MOB deadMOB,
                             boolean deleteAssets,
                             boolean quiet)
Specified by:
obliteratePlayer in interface PlayerLibrary

obliterateAccountOnly

public void obliterateAccountOnly(PlayerAccount deadAccount)
Specified by:
obliterateAccountOnly in interface PlayerLibrary

savePlayers

public int savePlayers()
Specified by:
savePlayers in interface PlayerLibrary

getThinSortValue

public java.lang.String getThinSortValue(PlayerLibrary.ThinPlayer player,
                                         int code)
Specified by:
getThinSortValue in interface PlayerLibrary

getThinSortValue

public java.lang.String getThinSortValue(PlayerAccount account,
                                         int code)

getCharThinSortCode

public int getCharThinSortCode(java.lang.String codeName,
                               boolean loose)
Specified by:
getCharThinSortCode in interface PlayerLibrary

getAccountThinSortCode

public int getAccountThinSortCode(java.lang.String codeName,
                                  boolean loose)

thinPlayers

public java.util.Enumeration<PlayerLibrary.ThinPlayer> thinPlayers(java.lang.String sort,
                                                                   java.util.Map<java.lang.String,java.lang.Object> cache)
Specified by:
thinPlayers in interface PlayerLibrary

parsePrideStats

public Pair<java.lang.Long,int[]>[] parsePrideStats(java.lang.String[] nextPeriods,
                                                    java.lang.String[] prideStats)
Specified by:
parsePrideStats in interface PlayerLibrary

findPlayerOnline

public MOB findPlayerOnline(java.lang.String srchStr,
                            boolean exactOnly)
Specified by:
findPlayerOnline in interface PlayerLibrary

accounts

public java.util.Enumeration<PlayerAccount> accounts(java.lang.String sort,
                                                     java.util.Map<java.lang.String,java.lang.Object> cache)
Specified by:
accounts in interface PlayerLibrary

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()
Specified by:
forceTick in interface PlayerLibrary