CMPlayers
public interface PlayerLibrary extends CMLibrary
Modifier and Type | Interface | Description |
---|---|---|
static class |
PlayerLibrary.PlayerCode |
The player library can query individual fields from player
characters regardless of whether the player is cached or
not.
|
static class |
PlayerLibrary.PlayerSortCode |
For systems that list users and allow sorting, here
is an enum of the popular sort codes, along with
popular alias for the code names.
|
static interface |
PlayerLibrary.ThinnerPlayer |
The absolute smallest whole view of a player char
is the ThinnerPlayer interface, which requires
the least work pulling from the database,
short of pulling only a single field.
|
static interface |
PlayerLibrary.ThinPlayer |
Sometimes the system does not need the entire mob object
and all associated attributes to make decisions about
a particular player char.
|
idConverter
Modifier and Type | Method | Description |
---|---|---|
boolean |
accountExists(java.lang.String name) |
Returns whether an account of the given name exists
in the database managed by this player lib.
|
boolean |
accountExistsAllHosts(java.lang.String name) |
Returns whether an account of the given name exists
in the database managed by this player lib.
|
java.util.Enumeration<PlayerAccount> |
accounts() |
Returns an enumeration of all player account objects
|
java.util.Enumeration<PlayerAccount> |
accounts(java.lang.String sort,
java.util.Map<java.lang.String,java.lang.Object> cache) |
Returns an enumeration of all account objects, with optional sort field,
and optional cache so that subsequent calls are faster.
|
void |
addAccount(PlayerAccount acct) |
Adds a new account to this player manager, for
caching only.
|
void |
addPlayer(MOB newOne) |
Adds a reference to the given player char mob to this
manager cache.
|
int |
bumpPrideStat(MOB mob,
AccountStats.PrideStat stat,
int amt) |
Given a player who did something that triggers a change in a pride stat, the pride
stat that changed, and the amount it changed by, this will update the pride lists
and return the given value.
|
void |
changePlayersLocation(MOB mob,
Room room) |
Sometimes the list of players in a given room needs to be
determined rather instantly.
|
void |
delPlayer(MOB oneToDel) |
Deletes a reference to a player character mob from the
cache.
|
MOB |
findPlayerOnline(java.lang.String srchStr,
boolean exactOnly) |
Given a player name, or substring for searching,
this will return a player character object that is presently
online and in the game.
|
PlayerAccount |
getAccount(java.lang.String calledThis) |
Returns null or an account of the given name if it
exists in the cache managed by this player lib.
|
PlayerAccount |
getAccountAllHosts(java.lang.String calledThis) |
Returns null or an account of the given name if it
exists in the cache managed by this player lib.
|
PlayerLibrary.PlayerSortCode |
getCharThinSortCode(java.lang.String codeName,
boolean loose) |
Given a possible sort code name, and now exact of a match you want,
this might return a player sort code match.
|
java.lang.String |
getLiegeOfUserAllHosts(java.lang.String userName) |
Given a player name, this will attempt to find the name of the
liege of this player, regardless of whether they've been cached
or not, and checking all user databases that share a map with
the caller.
|
PlayerAccount |
getLoadAccount(java.lang.String calledThis) |
Returns null or an account of the given name if it
exists in the database managed by this player lib.
|
PlayerAccount |
getLoadAccountByEmail(java.lang.String email) |
Returns null or an account of the given email addy if it
exists in the database managed by this player lib.
|
MOB |
getLoadPlayer(java.lang.String last) |
Finds a player character who has the given unique name,
first checking the manager cache, and if not found, goes
to the associated database and loads the character into
the cache and then returns it.
|
MOB |
getLoadPlayerAllHosts(java.lang.String last) |
Finds a player character who has the given unique name,
first checking the manager cache, and if not found, goes
to the associated database and loads the character into
the cache and then returns it.
|
MOB |
getLoadPlayerByEmail(java.lang.String email) |
Finds a player character who has the given email address
(possibly from their account), and loads that character
into the player manager cache and then returns it.
|
MOB |
getPlayer(java.lang.String calledThis) |
Given a player character name, this will search the list
of cached player mobs and return the one with that name.
|
MOB |
getPlayerAllHosts(java.lang.String calledThis) |
Given a player character name, this will search the list
of cached player mobs and return the one with that name.
|
java.util.List<java.lang.String> |
getPlayerLists() |
Returns a list of all player char names
in the database.
|
java.util.List<java.lang.String> |
getPlayerListsAllHosts() |
Returns a list of all player char names from all
databases connected to the same map as this
player manager.
|
java.util.Set<MOB> |
getPlayersHere(Room room) |
Sometimes the list of players in a given room needs to be
determined rather instantly.
|
java.lang.Object |
getPlayerValue(java.lang.String playerName,
PlayerLibrary.PlayerCode code) |
Given a player name, and code representing an attribute of the player
character, this will fetch the value on the player, regardless of
whether they are online or no.
|
java.lang.String |
getSortValue(MOB player,
PlayerLibrary.PlayerSortCode code) |
Given a player character mob, and a sort code, this will
return the sortable string value of that attribute,
|
PlayerLibrary.ThinPlayer |
getThinPlayer(java.lang.String mobName) |
Given a player name, this will construct a ThinPlayer
object if the player char is already cached, or
a new one from the database if not.
|
java.lang.Object |
getThinSortValue(PlayerLibrary.ThinPlayer player,
PlayerLibrary.PlayerSortCode code) |
Given a player character thinplayer obj, and a sort code, this will
return the sortable string value of that attribute,
|
java.util.List<Pair<java.lang.String,java.lang.Integer>> |
getTopPrideAccounts(TimeClock.TimePeriod period,
AccountStats.PrideStat stat) |
Returns the top winning account names and the associated values that got them there, for the given time
period and given pridestat.
|
java.util.List<Pair<java.lang.String,java.lang.Integer>> |
getTopPridePlayers(TimeClock.TimePeriod period,
AccountStats.PrideStat stat) |
Returns the top winning character names and the associated values that got them there, for the given time
period and given pridestat.
|
boolean |
isLoadedPlayer(MOB M) |
Returns whether the given player char mob is currently
cached by this player manager.
|
boolean |
isLoadedPlayer(java.lang.String mobName) |
Returns whether the given player char name is currently
cached by this player manager.
|
boolean |
isSameAccount(MOB player1,
MOB player2) |
Given two player characters, this will return whether they either
share an account.
|
boolean |
isSameAccountIP(MOB player1,
MOB player2) |
Given two player characters, this will return whether they either
share an account, or the same ip address.
|
PlayerLibrary.ThinnerPlayer |
newThinnerPlayer() |
Factory method for a ThinnerPlayer object, so that
new features can be added in the future w/o having
to change many files.
|
int |
numPlayers() |
Returns the number of player character mobs currently
cached by this manager.
|
void |
obliterateAccountOnly(PlayerAccount deadAccount) |
Removes the given player account from the list of protected
names, and then deletes the account from the manager cache, from
the database, and from the world.
|
void |
obliteratePlayer(MOB deadMOB,
boolean deleteAssets,
boolean quiet) |
Obliterates a cached loaded player character from the
database, from the cache, from everything.
|
Pair<java.lang.Long,int[]>[] |
parsePrideStats(java.lang.String[] nextPeriods,
java.lang.String[] prideStats) |
Given an array of timestamps indexed by period ordinals, and previous
pride stat values similarly indexed, this will generate an array
of pairs representing the data.
|
boolean |
playerExists(java.lang.String name) |
Given a player name, this will attempt to find them and
return whether they actually exist regardless of whether
they've been cached or not.
|
boolean |
playerExistsAllHosts(java.lang.String name) |
Given a player name, this will attempt to find them and
return whether they actually exist regardless of whether
they've been cached or not, and checking all user
databases that share a map with the caller.
|
java.util.Enumeration<MOB> |
players() |
Returns an enumeration of all cached players in this
manager.
|
void |
renamePlayer(MOB mob,
java.lang.String oldName) |
Renaming a player is quite involved, as there are so many tables and
objects index by the players names.
|
void |
resetAllPrideStats() |
Causes the pride stats list to be reloaded from the
player database.
|
int |
savePlayers() |
Saves all cached players.
|
void |
setPlayerValue(java.lang.String playerName,
PlayerLibrary.PlayerCode code,
java.lang.Object value) |
Given a player name, and code representing an attribute of the player
character, and a new value appropriate to that code, this will change
the value on the player, regardless of whether they are online or no.
|
java.util.Enumeration<PlayerLibrary.ThinPlayer> |
thinPlayers(java.lang.String sort,
java.util.Map<java.lang.String,java.lang.Object> cache) |
Given a possible player sort code string, and an optional cache of
pre-loaded key pairs, one of which might be "PLAYERLISTVECTOR"+sort,
pointing to a vector of pre-loaded thinplayers, this will return
an enumeration of all players in the game.
|
void |
unloadOfflinePlayer(MOB mob) |
Given a player char mob object, this will ensure that
the char is indeed not currently in the game and, if
so, remove them from the player cache without saving
them.
|
activate, getServiceClient, L, propertiesLoaded, shutdown
copyOf, ID, initializeClass, name, newInstance
PlayerAccount getLoadAccount(java.lang.String calledThis)
calledThis
- the name of the accountgetLoadAccountByEmail(String)
PlayerAccount getLoadAccountByEmail(java.lang.String email)
email
- the email of the accountgetLoadAccount(String)
PlayerAccount getAccount(java.lang.String calledThis)
calledThis
- the name of the accountgetAccountAllHosts(String)
PlayerAccount getAccountAllHosts(java.lang.String calledThis)
calledThis
- the name of the accountgetAccount(String)
void addAccount(PlayerAccount acct)
acct
- the new accountboolean accountExists(java.lang.String name)
name
- the name of the accountaccountExistsAllHosts(String)
boolean accountExistsAllHosts(java.lang.String name)
name
- the name of the accountaccountExists(String)
java.util.Enumeration<PlayerAccount> accounts()
accounts(String, Map)
java.util.Enumeration<PlayerAccount> accounts(java.lang.String sort, java.util.Map<java.lang.String,java.lang.Object> cache)
sort
- null, or AcctThinSortCode namecache
- map that can contain a cashed enum vectoraccounts()
boolean isSameAccount(MOB player1, MOB player2)
player1
- the first player mobplayer2
- the second player mobisSameAccount(MOB, MOB)
,
isSameAccountIP(MOB, MOB)
boolean isSameAccountIP(MOB player1, MOB player2)
player1
- the first player mobplayer2
- the second player mobisSameAccount(MOB, MOB)
,
isSameAccountIP(MOB, MOB)
void obliterateAccountOnly(PlayerAccount deadAccount)
deadAccount
- the account to obliterateint numPlayers()
delPlayer(MOB)
,
addPlayer(MOB)
,
players()
void addPlayer(MOB newOne)
newOne
- the player mob to adddelPlayer(MOB)
,
numPlayers()
,
players()
void delPlayer(MOB oneToDel)
oneToDel
- the player char mob to remove from the cacheaddPlayer(MOB)
,
numPlayers()
,
players()
java.util.Enumeration<MOB> players()
delPlayer(MOB)
,
addPlayer(MOB)
,
numPlayers()
MOB getPlayer(java.lang.String calledThis)
calledThis
- the cached player to getgetPlayerAllHosts(String)
MOB getPlayerAllHosts(java.lang.String calledThis)
calledThis
- the cached player to getgetPlayer(String)
MOB findPlayerOnline(java.lang.String srchStr, boolean exactOnly)
srchStr
- the name, or substring if Not exact onlyexactOnly
- true to only search full names, false for substringMOB getLoadPlayer(java.lang.String last)
last
- the character namegetLoadPlayerByEmail(String)
,
getLoadPlayerAllHosts(String)
MOB getLoadPlayerAllHosts(java.lang.String last)
last
- the character namegetLoadPlayerByEmail(String)
,
getLoadPlayer(String)
MOB getLoadPlayerByEmail(java.lang.String email)
email
- email address to find a player forgetLoadPlayer(String)
,
getLoadPlayerAllHosts(String)
java.util.List<java.lang.String> getPlayerLists()
getPlayerListsAllHosts()
java.util.List<java.lang.String> getPlayerListsAllHosts()
getPlayerLists()
boolean isLoadedPlayer(MOB M)
M
- the player charisLoadedPlayer(String)
boolean isLoadedPlayer(java.lang.String mobName)
mobName
- the player char nameisLoadedPlayer(MOB)
boolean playerExists(java.lang.String name)
name
- the player nameplayerExistsAllHosts(String)
boolean playerExistsAllHosts(java.lang.String name)
name
- the player nameplayerExists(String)
java.lang.String getLiegeOfUserAllHosts(java.lang.String userName)
userName
- the player char namevoid obliteratePlayer(MOB deadMOB, boolean deleteAssets, boolean quiet)
deadMOB
- the player char mob objectdeleteAssets
- true to send retirement msg to the world and kill player dataquiet
- true to do this silently, false otherwisevoid renamePlayer(MOB mob, java.lang.String oldName)
mob
- the player char who has been renamedoldName
- the previous namevoid unloadOfflinePlayer(MOB mob)
mob
- the player char to unloadint savePlayers()
PlayerLibrary.ThinnerPlayer newThinnerPlayer()
PlayerLibrary.ThinnerPlayer
PlayerLibrary.ThinPlayer getThinPlayer(java.lang.String mobName)
mobName
- the char namePlayerLibrary.ThinPlayer
,
newThinnerPlayer()
,
thinPlayers(String, Map)
java.util.Enumeration<PlayerLibrary.ThinPlayer> thinPlayers(java.lang.String sort, java.util.Map<java.lang.String,java.lang.Object> cache)
sort
- "", or a player sort code namecache
- null, or a map that might have a prior listPlayerLibrary.PlayerSortCode
,
PlayerLibrary.ThinPlayer
,
getThinPlayer(String)
,
newThinnerPlayer()
PlayerLibrary.PlayerSortCode getCharThinSortCode(java.lang.String codeName, boolean loose)
codeName
- the possible code nameloose
- true for startswith matches, false for exactPlayerLibrary.PlayerSortCode
,
PlayerLibrary.ThinPlayer
,
getSortValue(MOB, PlayerSortCode)
,
getThinSortValue(ThinPlayer, PlayerSortCode)
,
getThinPlayer(String)
java.lang.Object getThinSortValue(PlayerLibrary.ThinPlayer player, PlayerLibrary.PlayerSortCode code)
player
- the character thinplayer objcode
- the code for the value to returnPlayerLibrary.PlayerSortCode
,
PlayerLibrary.ThinPlayer
,
getSortValue(MOB, PlayerSortCode)
,
getCharThinSortCode(String, boolean)
,
getThinPlayer(String)
java.lang.String getSortValue(MOB player, PlayerLibrary.PlayerSortCode code)
player
- the character mobcode
- the code for the value to returnPlayerLibrary.PlayerSortCode
,
getThinSortValue(ThinPlayer, PlayerSortCode)
,
getCharThinSortCode(String, boolean)
java.lang.Object getPlayerValue(java.lang.String playerName, PlayerLibrary.PlayerCode code)
playerName
- player character namecode
- PlayerCode to fetchPlayerLibrary.PlayerCode
,
setPlayerValue(String, PlayerCode, Object)
void setPlayerValue(java.lang.String playerName, PlayerLibrary.PlayerCode code, java.lang.Object value)
playerName
- player character namecode
- PlayerCode to changevalue
- the new valuePlayerLibrary.PlayerCode
,
getPlayerValue(String, PlayerCode)
java.util.Set<MOB> getPlayersHere(Room room)
room
- the room curious aboutchangePlayersLocation(MOB, Room)
void changePlayersLocation(MOB mob, Room room)
mob
- the player to keep trackingroom
- the room the player is in, or null to remove him altogthergetPlayersHere(Room)
void resetAllPrideStats()
getTopPrideAccounts(com.planet_ink.coffee_mud.Common.interfaces.TimeClock.TimePeriod, com.planet_ink.coffee_mud.Common.interfaces.AccountStats.PrideStat)
,
#see PlayerLibrary#bumpPrideStat(MOB, com.planet_ink.coffee_mud.Common.interfaces.AccountStats.PrideStat, int)
,
parsePrideStats(String[], String[])
Pair<java.lang.Long,int[]>[] parsePrideStats(java.lang.String[] nextPeriods, java.lang.String[] prideStats)
nextPeriods
- the timestamps by periodprideStats
- the previous stat values by periodgetTopPrideAccounts(com.planet_ink.coffee_mud.Common.interfaces.TimeClock.TimePeriod, com.planet_ink.coffee_mud.Common.interfaces.AccountStats.PrideStat)
,
#see PlayerLibrary#bumpPrideStat(MOB, com.planet_ink.coffee_mud.Common.interfaces.AccountStats.PrideStat, int)
,
resetAllPrideStats()
int bumpPrideStat(MOB mob, AccountStats.PrideStat stat, int amt)
mob
- the player char who did somethingstat
- the pride stat reflecting what they didamt
- the amount to change the stat by + or -getTopPrideAccounts(com.planet_ink.coffee_mud.Common.interfaces.TimeClock.TimePeriod, com.planet_ink.coffee_mud.Common.interfaces.AccountStats.PrideStat)
,
getTopPridePlayers(com.planet_ink.coffee_mud.Common.interfaces.TimeClock.TimePeriod, com.planet_ink.coffee_mud.Common.interfaces.AccountStats.PrideStat)
,
parsePrideStats(String[], String[])
,
resetAllPrideStats()
java.util.List<Pair<java.lang.String,java.lang.Integer>> getTopPridePlayers(TimeClock.TimePeriod period, AccountStats.PrideStat stat)
period
- the time period to get the top character forstat
- the pridestat to find winners for#see PlayerLibrary#bumpPrideStat(MOB, com.planet_ink.coffee_mud.Common.interfaces.AccountStats.PrideStat, int)
,
parsePrideStats(String[], String[])
,
resetAllPrideStats()
java.util.List<Pair<java.lang.String,java.lang.Integer>> getTopPrideAccounts(TimeClock.TimePeriod period, AccountStats.PrideStat stat)
period
- the time period to get the top accounts forstat
- the pridestat to find winners for#see PlayerLibrary#bumpPrideStat(MOB, com.planet_ink.coffee_mud.Common.interfaces.AccountStats.PrideStat, int)
,
parsePrideStats(String[], String[])
,
resetAllPrideStats()