CMCommon, Session, CMObject, Modifiable, CMRunnable, java.lang.Cloneable, java.lang.Comparable<CMObject>, java.lang.Runnablepublic class DefaultSession extends java.lang.Object implements Session
| Modifier and Type | Class | Description |
|---|---|---|
static class |
DefaultSession.LoginLogoutThread |
Session.InputCallback, Session.SessionFilter, Session.SessionStatus, Session.TickingCallback| Modifier and Type | Field | Description |
|---|---|---|
protected PlayerAccount |
acct |
|
protected long |
activeMillis |
|
protected java.lang.String |
afkMessage |
|
protected long |
afkTime |
|
protected boolean |
bNextByteIs255 |
|
protected com.planet_ink.coffee_mud.Common.DefaultSession.SesInputStream |
charWriter |
|
protected boolean[] |
clientTelnetCodes |
|
protected java.lang.String[] |
clookup |
|
protected boolean |
connectionComplete |
|
protected java.lang.StringBuffer |
curPrevMsg |
|
protected ColorLibrary.ColorState |
currentColor |
|
protected boolean |
debugBinInput |
|
protected java.lang.StringBuffer |
debugBinInputBuf |
|
protected boolean |
debugBinOutput |
|
protected boolean |
debugStrInput |
|
protected boolean |
debugStrOutput |
|
protected java.lang.StringBuffer |
fakeInput |
|
protected java.util.Map<java.lang.String,java.lang.Long> |
gmcpPings |
|
protected java.util.Map<java.lang.String,java.lang.Double> |
gmcpSupports |
|
protected java.lang.String |
groupName |
|
protected java.util.LinkedList<java.util.List<java.lang.String>> |
history |
|
protected java.io.BufferedReader |
in |
|
protected int |
inMaxBytesPerChar |
|
protected java.lang.StringBuffer |
input |
|
protected Session.InputCallback |
inputCallback |
|
protected boolean |
killFlag |
|
protected long |
lastBlahCheck |
|
protected ColorLibrary.ColorState |
lastColor |
|
protected java.lang.String |
lastColorStr |
|
protected long |
lastIACIn |
|
protected long |
lastKeystroke |
|
protected long |
lastLoopTop |
|
protected long |
lastNPCFight |
|
protected long |
lastPKFight |
|
protected long |
lastStart |
|
protected long |
lastStateChangeMs |
|
protected long |
lastStop |
|
protected java.lang.String |
lastStr |
|
protected boolean |
lastWasCR |
|
protected boolean |
lastWasLF |
|
protected java.util.concurrent.atomic.AtomicBoolean |
lastWasPrompt |
|
protected long |
lastWriteTime |
|
protected boolean[] |
loggingOutObj |
|
protected CharCreationLibrary.LoginSession |
loginSession |
|
protected java.util.Stack<ColorLibrary.ColorState> |
markedColors |
|
protected boolean |
mcpDisabled |
|
protected java.lang.String[] |
mcpKey |
|
protected java.util.Map<java.lang.String,java.lang.String> |
mcpKeyPairs |
|
protected java.util.Map<java.lang.String,float[]> |
mcpSupported |
|
protected long |
milliTotal |
|
protected MOB |
mob |
|
protected static int |
MSDPPINGINTERVAL |
|
protected java.util.Map<java.lang.Object,java.lang.Object> |
msdpReportables |
|
protected java.util.Set<java.lang.String> |
mxpSupportSet |
|
protected java.util.Map<java.lang.String,java.lang.String> |
mxpVersionInfo |
|
protected boolean |
needPrompt |
|
protected long |
nextMsdpPing |
|
protected long |
onlineTime |
|
protected java.io.PrintWriter |
out |
|
protected static char[] |
PINGCHARS |
|
protected static int |
PINGTIMEOUT |
|
protected java.util.List<java.lang.String> |
prevMsgs |
|
protected long |
promptLastShown |
|
protected byte[] |
promptSuffix |
|
protected java.io.InputStream |
rawin |
|
protected java.io.OutputStream |
rawout |
|
protected boolean[] |
serverTelnetCodes |
|
protected java.util.List<Session> |
snoops |
|
protected int |
snoopSuspensionStack |
|
protected java.net.Socket |
sock |
|
protected java.util.concurrent.atomic.AtomicBoolean |
sockObj |
|
protected static int |
SOTIMEOUT |
|
protected int |
spamStack |
|
protected Session.SessionStatus |
status |
|
protected boolean |
suspendCommandLine |
|
protected java.util.Set<java.lang.Integer> |
telnetSupportSet |
|
protected int |
terminalHeight |
|
protected java.lang.String |
terminalType |
|
protected int |
terminalWidth |
|
protected java.util.List<Session.SessionFilter> |
textFilters |
|
protected char |
threadGroupChar |
|
protected long |
tickTotal |
|
protected static java.lang.String |
TIMEOUT_MSG |
|
protected long |
userLoginTime |
|
protected boolean |
waiting |
|
protected java.util.concurrent.locks.ReentrantLock |
writeLock |
|
protected long |
writeStartTime |
idConverterMAX_PREVMSGS, MSDP_ARRAY_CLOSE, MSDP_ARRAY_OPEN, MSDP_CHARSET, MSDP_TABLE_CLOSE, MSDP_TABLE_OPEN, MSDP_VAL, MSDP_VAR, TELNET_AARD, TELNET_ANSI, TELNET_ANSI16, TELNET_ATCP, TELNET_AYT, TELNET_BINARY, TELNET_COMPRESS, TELNET_COMPRESS2, TELNET_DESCS, TELNET_DO, TELNET_DONT, TELNET_EC, TELNET_ECHO, TELNET_GA, TELNET_GMCP, TELNET_IAC, TELNET_LINEMODE, TELNET_LINEMODE_MODE, TELNET_LINEMODE_MODEMASK_ACK, TELNET_LINEMODE_MODEMASK_EDIT, TELNET_LINEMODE_MODEMASK_TRAPSIG, TELNET_LINEMODE_SLC, TELNET_LINEMODE_SLC_ACK, TELNET_LINEMODE_SLC_AO, TELNET_LINEMODE_SLC_AYT, TELNET_LINEMODE_SLC_BRK, TELNET_LINEMODE_SLC_CANTCHANGE, TELNET_LINEMODE_SLC_DEFAULT, TELNET_LINEMODE_SLC_EOF, TELNET_LINEMODE_SLC_EOR, TELNET_LINEMODE_SLC_IP, TELNET_LINEMODE_SLC_NOSUPPORT, TELNET_LINEMODE_SLC_SUSP, TELNET_LINEMODE_SLC_VALUE, TELNET_LINEMODE_SLC_XOFF, TELNET_LINEMODE_SLC_XON, TELNET_LOGOUT, TELNET_MSDP, TELNET_MSP, TELNET_MSSP, TELNET_MXP, TELNET_NAWS, TELNET_NOP, TELNET_SB, TELNET_SE, TELNET_SUPRESS_GO_AHEAD, TELNET_TERMTYPE, TELNET_TOGGLE_FLOW_CONTROL, TELNET_WILL, TELNET_WONT, TELNETBYTES_END_SB, TELNETBYTES_GMCP_HEAD, TELNETGABYTES| Constructor | Description |
|---|---|
DefaultSession() |
| Modifier and Type | Method | Description |
|---|---|---|
long |
activeTimeMillis() |
Returns the number of milliseconds this runnable
has been running.
|
boolean |
addSessionFilter(Session.SessionFilter filter) |
Adds a new text filter to this session, which can
modify any text immediately before it is sent
to the user.
|
protected java.lang.String |
applyFilters(Physical src,
Environmental trg,
Environmental tol,
java.lang.String msg,
boolean noWrap) |
|
boolean |
autoLogin(java.lang.String name,
java.lang.String password) |
If the session is in a non-logged in state (or even if it
is), this will automatically login the user with the given
name and password, and switch the session to the main loop.
|
java.lang.String |
blockingIn() |
|
java.lang.String |
blockingIn(long maxTime,
boolean filter) |
Blocks the current thread until the user attached to this session
hits ENTER, returning the characters they enter.
|
void |
changeTelnetMode(int telnetCode,
boolean onOff) |
Change telnet mode by sending the appropriate command to the clients client.
|
void |
changeTelnetModeBackwards(int telnetCode,
boolean onOff) |
|
void |
changeTelnetModeBackwards(java.io.OutputStream out,
int telnetCode,
boolean onOff) |
|
java.lang.String |
choose(java.lang.String Message,
java.lang.String Choices,
java.lang.String Default) |
Prompts the user to enter one character responses from a set of
valid choices.
|
java.lang.String |
choose(java.lang.String Message,
java.lang.String Choices,
java.lang.String Default,
long maxTime) |
Prompts the user to enter one character responses from a set of
valid choices.
|
java.lang.String |
choose(java.lang.String promptMsg,
java.lang.String choices,
java.lang.String def,
long maxTime,
java.util.List<java.lang.String> paramsOut) |
Prompts the user to enter one character responses from a set of
valid choices.
|
protected void |
clearInputBuffer(long maxTime) |
|
protected void |
closeSocks(java.lang.String finalMsg) |
|
void |
colorOnlyPrint(java.lang.String msg) |
Lower-Medium-level text output method.
|
void |
colorOnlyPrint(java.lang.String msg,
boolean noCache) |
Lower-Medium-level text output method.
|
void |
colorOnlyPrintln(java.lang.String msg) |
Lower-Medium-level text output method.
|
void |
colorOnlyPrintln(java.lang.String msg,
boolean noCache) |
Lower-Medium-level text output method.
|
int |
compareTo(CMObject o) |
|
protected void |
compress2Off() |
|
boolean |
confirm(java.lang.String Message,
java.lang.String Default) |
Prompts the user to enter Y or N, and returns what they
enter.
|
boolean |
confirm(java.lang.String Message,
java.lang.String Default,
long maxTime) |
Prompts the user to enter Y or N, and returns what they
enter.
|
CMObject |
copyOf() |
Similar to Cloneable.clone(), but does its best to make sure that
any internal objects to this class are also copyOfed.
|
protected void |
doProtocolPings() |
|
protected void |
errorOut(java.lang.Exception t) |
|
protected void |
flagTextDisplayed() |
|
java.lang.String |
getAddress() |
Gets the current telnet clients ip address.
|
java.lang.String |
getAfkMessage() |
Returns the reason given by the user that they are AFK.
|
boolean |
getClientTelnetMode(int telnetCode) |
Gets a client telnet mode flag.
|
java.lang.String[] |
getColorCodes() |
Returns a list of standard/foreground telnet coded strings
indexed by coffeemud color code.
|
ColorLibrary.ColorState |
getCurrentColor() |
Returns the current color code.
|
int |
getGroupID() |
The group identifier for this runnable, which may be used
for executor selection
|
java.lang.String |
getGroupName() |
Returns the group name to which this session belongs
|
java.util.Enumeration<java.util.List<java.lang.String>> |
getHistory() |
Returns the entire command history cached by this session.
|
long |
getIdleMillis() |
Gets the number of milliseconds since a user entry was registered by this session
|
long |
getInputLoopTime() |
Returns the last time in milliseconds that this session began its input loop.
|
ColorLibrary.ColorState |
getLastColor() |
Returns the previous current color code.
|
java.util.List<java.lang.String> |
getLastMsgs() |
Returns a list of the last several message strings received by this user.
|
long |
getLastNPCFight() |
Gets the milliseconds timestamp since this user last registered a npc fight.
|
long |
getLastPKFight() |
Gets the milliseconds timestamp since this user last registered a pk fight.
|
long |
getMillisOnline() |
Gets the milliseconds elapsed since this user came online.
|
int |
getPageBreak() |
|
java.util.List<java.lang.String> |
getPreviousCMD() |
Returns a pre-parsed, pre-filtered list of strings
representing the last command entered by the user
through this session.
|
int |
getSaveStatIndex() |
Returns the index into the stat codes array where extra savable fields begins.
|
boolean |
getServerTelnetMode(int telnetCode) |
Gets a server telnet mode flag.
|
long |
getStartTime() |
Either the time this runnable did start running, or
will start running, depending on whether it's scheduled
|
java.lang.String |
getStat(java.lang.String code) |
An alternative means of retreiving the values of those fields on this object which are modifiable at
run-time by builders.
|
java.lang.String[] |
getStatCodes() |
Returns an array of the string names of those fields which are modifiable on this object at run-time by
builders.
|
Session.SessionStatus |
getStatus() |
Gets the tick/thread status of this session object.
|
java.lang.String |
getTerminalType() |
Gets the terminal type the user has
|
long |
getTotalMillis() |
Gets the total milliseconds consumed by this session objects thread.
|
long |
getTotalTicks() |
Gets the total number of ticks consumed by this session object thread.
|
int |
getWrap() |
Gets the column number for engine word-wrapping.
|
protected long |
getWriteStartTime() |
|
void |
handleEscape() |
|
void |
handleIAC() |
|
void |
handleSubOption(int optionCode,
char[] suboptionData,
int dataSize) |
|
char |
hotkey(long maxWait) |
Waits the given milliseconds for a key to be pressed, after which
it returns that key, or \0 if nothing pressed.
|
java.lang.String |
ID() |
The CoffeeMud Java Class ID shared by all instances of
this object.
|
void |
initializeClass() |
Called ONCE after all objects are loaded, but before the map is read in
during initialization.
|
void |
initializeSession(java.net.Socket s,
java.lang.String groupName,
java.lang.String introTextStr) |
Negotiates various telnet options (or attempts to), and
prints the introTextStr to the user.
|
void |
initTelnetMode(int attributesBitmap) |
Initializes a telnet mode between this session and the connected client by negotiating
certain fundamental flags, like ANSI, MXP, and MSP.
|
boolean |
isAfk() |
Returns whether this mob/session is currently Away From Keyboard
|
boolean |
isAllowedMcp(java.lang.String packageName,
float version) |
Returns true if this client supports the given package at the
given version.
|
boolean |
isAllowedMxp(java.lang.String tagString) |
Returns true if the given max tag will be accepted by the client.
|
boolean |
isBeingSnoopedBy(Session S) |
Checks to see if the given session is snooping on this one.
|
boolean |
isFake() |
Returns true if this session is merely a placeholder,
and does not represent an actual user connection.
|
boolean |
isLockedUpWriting() |
Checks whether this session is currently over its
time limit trying to write data to its socket.
|
boolean |
isPendingLogin(java.lang.String otherLoginName) |
Returns whether this session is engaged in a login/account
menu transaction.
|
boolean |
isRunning() |
Whether this session is currently actively interacting with the user in
some way -- whether this session currently has "thread time".
|
boolean |
isStat(java.lang.String code) |
An alternative means of retreiving the values of those fields on this object which are modifiable at
run-time by builders.
|
boolean |
isStopped() |
Returns whether this session is done, or slated to be done.
|
boolean |
isWaitingForInput() |
Returns whether this session is waiting for input
|
void |
loginSystem() |
|
void |
logout(boolean removeMOB) |
Allows the user to select a different character, taking them back to the login
prompt, or to the account character listing screen, whichever is appropriate.
|
void |
logoutFinal() |
|
void |
mainLoop() |
|
MOB |
mob() |
Returns the player MOB attached to this session object.
|
java.lang.String |
name() |
The displayable name of this object.
|
void |
negotiateTelnetMode(int telnetCode) |
Change telnet mode by negotiating the command to the clients client.
|
CMObject |
newInstance() |
Returns a new instance of this class.
|
protected int |
nonBlockingIn(boolean appendInputFlag) |
|
void |
onlyPrint(java.lang.String msg) |
Low level text output method.
|
void |
onlyPrint(java.lang.String msg,
boolean noCache) |
Low level text output method.
|
ColorLibrary.ColorState |
popMarkedColor() |
Returns the marked color code.
|
void |
print(Physical src,
Environmental trg,
Environmental tol,
java.lang.String msg) |
Medium-level text output method.
|
void |
print(java.lang.String msg) |
Medium-level text output method.
|
void |
println(Physical src,
Environmental trg,
Environmental tol,
java.lang.String msg) |
Medium-level text output method.
|
void |
println(java.lang.String msg) |
Medium-level text output method.
|
void |
prompt(Session.InputCallback callBack) |
Puts the session into an input state, returning immediately.
|
java.lang.String |
prompt(java.lang.String Message) |
Prompts the user to enter a string, and then returns what
the enter.
|
java.lang.String |
prompt(java.lang.String Message,
long maxTime) |
Prompts the user to enter a string, and then returns what
the enter.
|
java.lang.String |
prompt(java.lang.String Message,
java.lang.String Default) |
Prompts the user to enter a string, and then returns what
the enter.
|
java.lang.String |
prompt(java.lang.String Message,
java.lang.String Default,
long maxTime) |
Prompts the user to enter a string, and then returns what
the enter.
|
void |
promptPrint(java.lang.String msg) |
Medium-level text output method.
|
void |
pushMarkedColor(ColorLibrary.ColorState newColor) |
Sets the marked color code.
|
void |
rawBytesOut(java.io.OutputStream out,
byte[] bytes) |
|
void |
rawCharsOut(char c) |
|
void |
rawCharsOut(char[] chars) |
Lowest level user-output method.
|
void |
rawCharsOut(java.io.PrintWriter out,
char[] chars) |
|
void |
rawCharsOut(java.lang.String c) |
|
void |
rawOut(java.lang.String msg) |
Lowest level user-output method.
|
void |
rawPrint(java.lang.String msg) |
Low level line-output method.
|
void |
rawPrintln(java.lang.String msg) |
Low level line-output method.
|
int |
readByte() |
|
int |
readChar() |
|
java.lang.String |
readlineContinue() |
Blocks for a short amount of time, returning an input
string only if the user happens to have hit enter.
|
void |
run() |
|
void |
safeRawPrint(java.lang.String msg) |
Low level line-output method.
|
void |
safeRawPrintln(java.lang.String msg) |
Low level line-output method.
|
boolean |
sendGMCPEvent(java.lang.String eventName,
java.lang.String json) |
Potentially sends the GMCP event of the given name with the given json
doc.
|
boolean |
sendMcpCommand(java.lang.String packageCommand,
java.lang.String parms) |
Sends a properly formatted MCP command to the session, if it or its package is supported.
|
protected boolean |
sessionMCPCheck(java.lang.StringBuilder inStr) |
|
void |
setAccount(PlayerAccount account) |
Sets the player acount attached to this session object.
|
void |
setAfkFlag(boolean truefalse) |
Sets whether this mob/session is currently Away From Keyboard
|
void |
setAFKMessage(java.lang.String str) |
Returns the reason given by the user that they are AFK.
|
void |
setBeingSnoopedBy(Session session,
boolean onOff) |
Notifies this session that the given session is snooping it.
|
void |
setClientTelnetMode(int telnetCode,
boolean onOff) |
Sets a client telnet mode flag.
|
void |
setCurrentColor(ColorLibrary.ColorState newColor) |
Sets the current color code.
|
void |
setFakeInput(java.lang.String input) |
Send this session fake input as if the user had typed it in.
|
void |
setGroupName(java.lang.String group) |
Sets the group name to which this session belongs
|
void |
setIdleTimers() |
Resets the internal idle timers.
|
void |
setInputLoopTime() |
Sets the last time in milliseconds that this session began its input loop.
|
void |
setKillFlag(boolean truefalse) |
|
void |
setLastColor(ColorLibrary.ColorState newColor) |
Returns the previous current color code.
|
void |
setLastNPCFight() |
Sets now as the milliseconds timestamp since this user last registered a npc fight.
|
void |
setLastPKFight() |
Sets now as the milliseconds timestamp since this user last registered a pk fight.
|
protected boolean |
setLoggedInState(CharCreationLibrary.LoginResult loginResult) |
|
void |
setMob(MOB newmob) |
Sets the player MOB attached to this session object.
|
protected void |
setPreviousCmd(java.util.List<java.lang.String> cmds) |
|
void |
setPromptFlag(boolean truefalse) |
Notifies this session to output the users prompt
again once it has reached a suitable lapse in
text output.
|
void |
setServerTelnetMode(int telnetCode,
boolean onOff) |
Sets a server telnet mode flag.
|
void |
setStat(java.lang.String code,
java.lang.String val) |
An alternative means of setting the values of those fields on this object which are modifiable at
run-time by builders.
|
void |
setStatus(Session.SessionStatus newStatus) |
Sets the tick/thread status of this session object.
|
void |
showPrompt() |
|
void |
snoopSupportPrint(java.lang.String msg,
boolean noCache) |
|
int |
snoopSuspension(int change) |
Increments or decrements the snoop suspension counter
by the given amount.
|
void |
stdPrint(Physical src,
Environmental trg,
Environmental tol,
java.lang.String msg) |
Higher-level line output method.
|
void |
stdPrint(java.lang.String msg) |
Higher-level line output method.
|
void |
stdPrintln(Physical src,
Environmental trg,
Environmental tol,
java.lang.String msg) |
Higher-level line output method.
|
void |
stdPrintln(java.lang.String msg) |
Higher-level line output method.
|
void |
stopSession(boolean removeMOB,
boolean dropSession,
boolean killThread) |
Force the current player to logoff, end the session, and/or kill the thread.
|
void |
wraplessPrint(java.lang.String msg) |
Medium-level text output method.
|
void |
wraplessPrintln(java.lang.String msg) |
Medium-level text output method.
|
protected static final int SOTIMEOUT
protected static final int PINGTIMEOUT
protected static final int MSDPPINGINTERVAL
protected static final char[] PINGCHARS
protected static final java.lang.String TIMEOUT_MSG
protected final java.util.Set<java.lang.Integer> telnetSupportSet
protected final java.util.Set<java.lang.String> mxpSupportSet
protected final java.util.Map<java.lang.String,java.lang.String> mxpVersionInfo
protected final java.util.Map<java.lang.Object,java.lang.Object> msdpReportables
protected final java.util.Map<java.lang.String,java.lang.Double> gmcpSupports
protected final java.util.Map<java.lang.String,java.lang.Long> gmcpPings
protected final java.lang.String[] mcpKey
protected final java.util.Map<java.lang.String,java.lang.String> mcpKeyPairs
protected final boolean mcpDisabled
protected final java.util.Map<java.lang.String,float[]> mcpSupported
protected final java.util.concurrent.atomic.AtomicBoolean sockObj
protected final java.util.LinkedList<java.util.List<java.lang.String>> history
protected java.lang.String groupName
protected Session.SessionStatus status
protected volatile long lastStateChangeMs
protected int snoopSuspensionStack
protected java.net.Socket sock
protected com.planet_ink.coffee_mud.Common.DefaultSession.SesInputStream charWriter
protected int inMaxBytesPerChar
protected java.io.BufferedReader in
protected java.io.PrintWriter out
protected java.io.InputStream rawin
protected java.io.OutputStream rawout
protected MOB mob
protected PlayerAccount acct
protected boolean killFlag
protected boolean needPrompt
protected long afkTime
protected java.lang.String afkMessage
protected java.lang.StringBuffer input
protected java.lang.StringBuffer fakeInput
protected boolean waiting
protected java.lang.String[] clookup
protected java.lang.String lastColorStr
protected java.lang.String lastStr
protected int spamStack
protected java.util.List<Session> snoops
protected java.util.List<java.lang.String> prevMsgs
protected java.lang.StringBuffer curPrevMsg
protected boolean lastWasCR
protected boolean lastWasLF
protected boolean suspendCommandLine
protected boolean[] serverTelnetCodes
protected boolean[] clientTelnetCodes
protected java.lang.String terminalType
protected int terminalWidth
protected int terminalHeight
protected long writeStartTime
protected boolean bNextByteIs255
protected boolean connectionComplete
protected java.util.concurrent.locks.ReentrantLock writeLock
protected CharCreationLibrary.LoginSession loginSession
protected boolean[] loggingOutObj
protected byte[] promptSuffix
protected ColorLibrary.ColorState currentColor
protected ColorLibrary.ColorState lastColor
protected long lastStart
protected long lastStop
protected long lastLoopTop
protected long nextMsdpPing
protected long userLoginTime
protected long onlineTime
protected long activeMillis
protected long lastPKFight
protected long lastNPCFight
protected long lastBlahCheck
protected long milliTotal
protected long tickTotal
protected long lastKeystroke
protected volatile long lastIACIn
protected long promptLastShown
protected char threadGroupChar
protected volatile long lastWriteTime
protected boolean debugStrInput
protected boolean debugStrOutput
protected boolean debugBinOutput
protected boolean debugBinInput
protected java.lang.StringBuffer debugBinInputBuf
protected final java.util.Stack<ColorLibrary.ColorState> markedColors
protected java.util.concurrent.atomic.AtomicBoolean lastWasPrompt
protected java.util.List<Session.SessionFilter> textFilters
protected volatile Session.InputCallback inputCallback
public java.lang.String ID()
CMObjectpublic java.lang.String name()
CMObjectname in interface CMObjectEnvironmental.Name()public CMObject newInstance()
CMObjectnewInstance in interface CMObjectpublic void initializeClass()
CMObjectinitializeClass in interface CMObjectpublic boolean isFake()
Sessionpublic CMObject copyOf()
CMObjectpublic int compareTo(CMObject o)
compareTo in interface java.lang.Comparable<CMObject>public void setStatus(Session.SessionStatus newStatus)
SessionsetStatus in interface SessionnewStatus - the tick statusSession.SessionStatuspublic long getStartTime()
CMRunnablegetStartTime in interface CMRunnablepublic int getGroupID()
CMRunnablegetGroupID in interface CMRunnablepublic boolean isAllowedMcp(java.lang.String packageName,
float version)
SessionisAllowedMcp in interface SessionpackageName - the package to checkversion - the version of the package to checkpublic boolean sendMcpCommand(java.lang.String packageCommand,
java.lang.String parms)
SessionsendMcpCommand in interface SessionpackageCommand - the fully formed commandparms - the variable parameters, already well formedpublic void initializeSession(java.net.Socket s,
java.lang.String groupName,
java.lang.String introTextStr)
SessioninitializeSession in interface Sessions - the socket the user connected fromgroupName - the name of the thread group the session goes tointroTextStr - introductory text string (Hello!)protected void compress2Off()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getGroupName()
SessiongetGroupName in interface Sessionpublic void setGroupName(java.lang.String group)
SessionsetGroupName in interface Sessiongroup - the thread group namepublic void setFakeInput(java.lang.String input)
SessionsetFakeInput in interface Sessioninput - text to send.public void setServerTelnetMode(int telnetCode,
boolean onOff)
SessionsetServerTelnetMode in interface SessiontelnetCode - the telnet codeonOff - true to turn on, false to turn off the flagSession.TELNET_ANSI,
Session.getServerTelnetMode(int)public boolean getServerTelnetMode(int telnetCode)
SessiongetServerTelnetMode in interface SessiontelnetCode - the telnet codeSession.TELNET_ANSI,
Session.setServerTelnetMode(int, boolean)public void setClientTelnetMode(int telnetCode,
boolean onOff)
SessionsetClientTelnetMode in interface SessiontelnetCode - the telnet codeonOff - true to turn on, false to turn off the flagSession.TELNET_ANSI,
Session.getClientTelnetMode(int)public boolean getClientTelnetMode(int telnetCode)
SessiongetClientTelnetMode in interface SessiontelnetCode - the telnet codeSession.TELNET_ANSI,
Session.setClientTelnetMode(int, boolean)public boolean isAllowedMxp(java.lang.String tagString)
SessionisAllowedMxp in interface SessiontagString - the tag to checkpublic boolean sendGMCPEvent(java.lang.String eventName,
java.lang.String json)
SessionsendGMCPEvent in interface SessioneventName - the event name, like comm.channeljson - the json doc, like {"blah":"BLAH"}public void changeTelnetMode(int telnetCode,
boolean onOff)
SessionchangeTelnetMode in interface SessiontelnetCode - the telnet codeonOff - true to turn on, false to turn off the flagSession.TELNET_ANSI,
Session.TELNET_ANSI16,
Session.setClientTelnetMode(int, boolean),
Session.setServerTelnetMode(int, boolean)public void changeTelnetModeBackwards(int telnetCode,
boolean onOff)
throws java.io.IOException
java.io.IOExceptionpublic void changeTelnetModeBackwards(java.io.OutputStream out,
int telnetCode,
boolean onOff)
throws java.io.IOException
java.io.IOExceptionpublic void negotiateTelnetMode(int telnetCode)
SessionnegotiateTelnetMode in interface SessiontelnetCode - the telnet codeSession.TELNET_ANSI,
Session.TELNET_ANSI16,
Session.setClientTelnetMode(int, boolean),
Session.setServerTelnetMode(int, boolean)public void initTelnetMode(int attributesBitmap)
SessioninitTelnetMode in interface SessionattributesBitmap - the mobbitmap the bitmap of mob flags to use as a guide in negotiationMOB.getAttributesBitmap(),
MOB.Attrib,
Session.changeTelnetMode(int, boolean)public ColorLibrary.ColorState getCurrentColor()
SessiongetCurrentColor in interface Sessionpublic void setCurrentColor(ColorLibrary.ColorState newColor)
SessionsetCurrentColor in interface SessionnewColor - the color to change it topublic ColorLibrary.ColorState getLastColor()
SessiongetLastColor in interface Sessionpublic void setLastColor(ColorLibrary.ColorState newColor)
SessionsetLastColor in interface SessionnewColor - the color to change it topublic ColorLibrary.ColorState popMarkedColor()
SessionpopMarkedColor in interface Sessionpublic void pushMarkedColor(ColorLibrary.ColorState newColor)
SessionpushMarkedColor in interface SessionnewColor - the color to change it topublic long getTotalMillis()
SessiongetTotalMillis in interface Sessionpublic long getIdleMillis()
SessiongetIdleMillis in interface SessionSession.setIdleTimers()public long getTotalTicks()
SessiongetTotalTicks in interface Sessionpublic long getMillisOnline()
SessiongetMillisOnline in interface Sessionpublic long getInputLoopTime()
SessiongetInputLoopTime in interface SessionSession.setInputLoopTime()public void setInputLoopTime()
SessionsetInputLoopTime in interface SessionSession.getInputLoopTime()public long getLastPKFight()
SessiongetLastPKFight in interface SessionSession.setLastPKFight(),
Session.setLastNPCFight()public void setLastPKFight()
SessionsetLastPKFight in interface SessionSession.getLastPKFight(),
Session.getLastNPCFight()public long getLastNPCFight()
SessiongetLastNPCFight in interface SessionSession.setLastPKFight(),
Session.setLastNPCFight()public void setLastNPCFight()
SessionsetLastNPCFight in interface SessionSession.getLastPKFight(),
Session.getLastNPCFight()public java.util.List<java.lang.String> getLastMsgs()
SessiongetLastMsgs in interface Sessionpublic java.lang.String getTerminalType()
SessiongetTerminalType in interface Sessionpublic MOB mob()
Sessionmob in interface SessionSession.setMob(MOB)public void setMob(MOB newmob)
SessionsetMob in interface Sessionnewmob - the player MOB attached to this session object.Session.mob()public void setAccount(PlayerAccount account)
SessionsetAccount in interface Sessionaccount - the player account attached to this session object.Session.mob()public int getWrap()
Sessionpublic int getPageBreak()
public boolean isStopped()
SessionisStopped in interface SessionSession.logout(boolean),
Session.isStopped()public void setKillFlag(boolean truefalse)
public java.util.List<java.lang.String> getPreviousCMD()
SessiongetPreviousCMD in interface Sessionpublic void setBeingSnoopedBy(Session session, boolean onOff)
SessionsetBeingSnoopedBy in interface Sessionsession - the session to snoop on me.onOff - true to turn on snooping, false otherwiseSession.setBeingSnoopedBy(Session, boolean),
Session.isBeingSnoopedBy(Session),
Session.snoopSuspension(int)public boolean isBeingSnoopedBy(Session S)
SessionisBeingSnoopedBy in interface SessionS - the session to check for a snoop on me.Session.setBeingSnoopedBy(Session, boolean),
Session.isBeingSnoopedBy(Session),
Session.snoopSuspension(int)public int snoopSuspension(int change)
SessionsnoopSuspension in interface Sessionchange - the amount to change the snoop suspension counter bySession.setBeingSnoopedBy(Session, boolean),
Session.isBeingSnoopedBy(Session),
Session.snoopSuspension(int)public java.util.Enumeration<java.util.List<java.lang.String>> getHistory()
SessiongetHistory in interface Sessionprotected void setPreviousCmd(java.util.List<java.lang.String> cmds)
public boolean isAfk()
SessionisAfk in interface SessionSession.setAfkFlag(boolean),
Session.setAFKMessage(String)public void setAfkFlag(boolean truefalse)
SessionsetAfkFlag in interface Sessiontruefalse - true if they are AFK, false otherwiseSession.isAfk(),
Session.getAfkMessage()public java.lang.String getAfkMessage()
SessiongetAfkMessage in interface SessionSession.setAfkFlag(boolean),
Session.setAFKMessage(String)public void setAFKMessage(java.lang.String str)
SessionsetAFKMessage in interface Sessionstr - the reason given by the user that they are AFK.Session.setAfkFlag(boolean),
Session.getAfkMessage()protected void errorOut(java.lang.Exception t)
protected long getWriteStartTime()
public boolean isLockedUpWriting()
SessionisLockedUpWriting in interface Sessionpublic final void rawBytesOut(java.io.OutputStream out,
byte[] bytes)
throws java.io.IOException
java.io.IOExceptionpublic void rawCharsOut(char[] chars)
SessionrawCharsOut in interface Sessionchars - string (as char array) to send out to the userpublic void rawCharsOut(java.io.PrintWriter out,
char[] chars)
public void rawCharsOut(java.lang.String c)
public void rawCharsOut(char c)
public void snoopSupportPrint(java.lang.String msg,
boolean noCache)
public void onlyPrint(java.lang.String msg)
SessiononlyPrint in interface Sessionmsg - the string to send to the userSession.onlyPrint(String, boolean)public void onlyPrint(java.lang.String msg,
boolean noCache)
SessiononlyPrint in interface Sessionmsg - the string to send to the usernoCache - true to disable line caching, false otherwiseSession.rawCharsOut(char[])public void rawOut(java.lang.String msg)
SessionrawOut in interface Sessionmsg - the string to send to the userSession.rawCharsOut(char[])public void rawPrint(java.lang.String msg)
SessionrawPrint in interface Sessionmsg - the string to send to the userSession.rawPrint(String)public void safeRawPrint(java.lang.String msg)
SessionsafeRawPrint in interface Sessionmsg - the string to send to the userSession.safeRawPrintln(String)public void print(java.lang.String msg)
Sessionprint in interface Sessionmsg - the string to send to the userSession.onlyPrint(String, boolean),
Session.promptPrint(String)public void promptPrint(java.lang.String msg)
SessionpromptPrint in interface Sessionmsg - the string to send to the userSession.onlyPrint(String, boolean)public void rawPrintln(java.lang.String msg)
SessionrawPrintln in interface Sessionmsg - the string to send to the userSession.rawPrintln(String)public void safeRawPrintln(java.lang.String msg)
SessionsafeRawPrintln in interface Sessionmsg - the string to send to the userSession.safeRawPrint(String)public void stdPrint(java.lang.String msg)
SessionstdPrint in interface Sessionmsg - the string to send to the userSession.rawPrint(String)public void print(Physical src, Environmental trg, Environmental tol, java.lang.String msg)
Sessionprint in interface Sessionsrc - variable for special code parsing: Sourcetrg - variable for special code parsing: Targettol - variable for special code parsing: Toolmsg - the string to send to the userSession.onlyPrint(String, boolean)public void stdPrint(Physical src, Environmental trg, Environmental tol, java.lang.String msg)
SessionstdPrint in interface Sessionsrc - variable for special code parsing: Sourcetrg - variable for special code parsing: Targettol - variable for special code parsing: Toolmsg - the string to send to the userSession.rawPrint(String)public void println(java.lang.String msg)
Sessionprintln in interface Sessionmsg - the string to send to the userSession.onlyPrint(String, boolean)public void wraplessPrintln(java.lang.String msg)
SessionwraplessPrintln in interface Sessionmsg - the string to send to the userSession.onlyPrint(String, boolean)public void wraplessPrint(java.lang.String msg)
SessionwraplessPrint in interface Sessionmsg - the string to send to the userSession.onlyPrint(String, boolean)public void colorOnlyPrintln(java.lang.String msg)
SessioncolorOnlyPrintln in interface Sessionmsg - the string to send to the userSession.onlyPrint(String, boolean)public void colorOnlyPrintln(java.lang.String msg,
boolean noCache)
SessioncolorOnlyPrintln in interface Sessionmsg - the string to send to the usernoCache - true to disable line caching, false otherwiseSession.onlyPrint(String, boolean)public void colorOnlyPrint(java.lang.String msg)
SessioncolorOnlyPrint in interface Sessionmsg - the string to send to the userSession.onlyPrint(String, boolean)public void colorOnlyPrint(java.lang.String msg,
boolean noCache)
SessioncolorOnlyPrint in interface Sessionmsg - the string to send to the usernoCache - true to disable line caching, false otherwiseSession.onlyPrint(String, boolean)protected void flagTextDisplayed()
protected java.lang.String applyFilters(Physical src, Environmental trg, Environmental tol, java.lang.String msg, boolean noWrap)
public void stdPrintln(java.lang.String msg)
SessionstdPrintln in interface Sessionmsg - the string to send to the userSession.rawPrintln(String)public void println(Physical src, Environmental trg, Environmental tol, java.lang.String msg)
Sessionprintln in interface Sessionsrc - variable for special code parsing: Sourcetrg - variable for special code parsing: Targettol - variable for special code parsing: Toolmsg - the string to send to the userSession.onlyPrint(String, boolean)public void stdPrintln(Physical src, Environmental trg, Environmental tol, java.lang.String msg)
SessionstdPrintln in interface Sessionsrc - variable for special code parsing: Sourcetrg - variable for special code parsing: Targettol - variable for special code parsing: Toolmsg - the string to send to the userSession.rawPrintln(String)public void setPromptFlag(boolean truefalse)
SessionsetPromptFlag in interface Sessiontruefalse - true to send another prompt, false otherwisepublic java.lang.String prompt(java.lang.String Message,
java.lang.String Default,
long maxTime)
throws java.io.IOException
Sessionprompt in interface SessionMessage - the prompt message to display to the userDefault - the default response if the user just hits entermaxTime - max number of milliseconds to wait before timing outjava.io.IOException - a disconnect or time outSession.prompt(String),
Session.prompt(String, String),
Session.prompt(String, long)public java.lang.String prompt(java.lang.String Message,
java.lang.String Default)
throws java.io.IOException
Sessionprompt in interface SessionMessage - the prompt message to display to the userDefault - the default response if the user just hits enterjava.io.IOException - a disconnectSession.prompt(String),
Session.prompt(String, long),
Session.prompt(String, String, long)public void prompt(Session.InputCallback callBack)
Sessionprompt in interface SessioncallBack - the callback to modify and make when doneSession.InputCallbackpublic java.lang.String prompt(java.lang.String Message,
long maxTime)
throws java.io.IOException
Sessionprompt in interface SessionMessage - the prompt message to display to the usermaxTime - max number of milliseconds to wait before timing outjava.io.IOException - a disconnect or time outSession.prompt(String),
Session.prompt(String, String),
Session.prompt(String, String, long)public java.lang.String prompt(java.lang.String Message)
throws java.io.IOException
Sessionprompt in interface SessionMessage - the prompt message to display to the userjava.io.IOException - a disconnectSession.prompt(String, String),
Session.prompt(String, long),
Session.prompt(String, String, long)public java.lang.String[] getColorCodes()
SessiongetColorCodes in interface Sessionpublic void handleSubOption(int optionCode,
char[] suboptionData,
int dataSize)
throws java.io.IOException
java.io.IOExceptionpublic void handleEscape()
throws java.io.IOException,
java.io.InterruptedIOException
java.io.IOExceptionjava.io.InterruptedIOExceptionpublic void handleIAC()
throws java.io.IOException,
java.io.InterruptedIOException
java.io.IOExceptionjava.io.InterruptedIOExceptionpublic int readByte()
throws java.io.IOException
java.io.IOExceptionpublic int readChar()
throws java.io.IOException
java.io.IOExceptionpublic char hotkey(long maxWait)
Sessionprotected int nonBlockingIn(boolean appendInputFlag)
throws java.io.IOException
java.io.IOExceptionprotected void clearInputBuffer(long maxTime)
public java.lang.String blockingIn(long maxTime,
boolean filter)
throws java.io.IOException
SessionblockingIn in interface SessionmaxTime - milliseconds before InterruptedIOException thrownfilter - true to allow normal coffeemud input filteringjava.io.IOException - any exception generated during inputpublic java.lang.String blockingIn()
throws java.io.IOException
java.io.IOExceptionprotected boolean sessionMCPCheck(java.lang.StringBuilder inStr)
public java.lang.String readlineContinue()
throws java.io.IOException,
java.net.SocketException
SessionreadlineContinue in interface Sessionjava.io.IOException - exceptions thrown, typically a timeoutjava.net.SocketException - exceptions thrown, typically socket errorpublic boolean confirm(java.lang.String Message,
java.lang.String Default,
long maxTime)
throws java.io.IOException
Sessionconfirm in interface SessionMessage - the prompt message to display to the userDefault - the default response if the user just hits entermaxTime - max number of milliseconds to wait before timing outjava.io.IOException - a disconnect or time outSession.confirm(String, String)public boolean confirm(java.lang.String Message,
java.lang.String Default)
throws java.io.IOException
Sessionconfirm in interface SessionMessage - the prompt message to display to the userDefault - the default response if the user just hits enterjava.io.IOException - a disconnectSession.confirm(String, String, long)public java.lang.String choose(java.lang.String Message,
java.lang.String Choices,
java.lang.String Default)
throws java.io.IOException
Sessionchoose in interface SessionMessage - the prompt message to display to the userChoices - a list of uppercase characters that may be enteredDefault - the default response if the user just hits enterjava.io.IOException - a disconnectSession.choose(String, String, String, long)public java.lang.String choose(java.lang.String Message,
java.lang.String Choices,
java.lang.String Default,
long maxTime)
throws java.io.IOException
Sessionchoose in interface SessionMessage - the prompt message to display to the userChoices - a list of uppercase characters that may be enteredDefault - the default response if the user just hits entermaxTime - max number of milliseconds to wait before timing outjava.io.IOException - a disconnect or time outSession.choose(String, String, String)public java.lang.String choose(java.lang.String promptMsg,
java.lang.String choices,
java.lang.String def,
long maxTime,
java.util.List<java.lang.String> paramsOut)
throws java.io.IOException
Sessionchoose in interface SessionpromptMsg - the prompt message to display to the userchoices - a list of uppercase characters that may be entereddef - the default response if the user just hits entermaxTime - max number of milliseconds to wait before timing outparamsOut - an empty list to put any extra crap added to the end of the choice.java.io.IOException - a disconnectSession.choose(String, String, String, long)public void stopSession(boolean removeMOB,
boolean dropSession,
boolean killThread)
SessionstopSession in interface SessionremoveMOB - true to remove the mob from the gamedropSession - true to force closed sockets, and removed sessionkillThread - true to force a thread death, and false to be more lenientSession.isStopped()public void showPrompt()
protected void closeSocks(java.lang.String finalMsg)
public java.lang.String getAddress()
SessiongetAddress in interface Sessionpublic Session.SessionStatus getStatus()
SessiongetStatus in interface SessionSession.SessionStatuspublic boolean isWaitingForInput()
SessionisWaitingForInput in interface Sessionpublic void logout(boolean removeMOB)
Sessionpublic boolean isRunning()
Sessionpublic boolean isPendingLogin(java.lang.String otherLoginName)
SessionisPendingLogin in interface SessionotherLoginName - another login name potentially matchprotected void doProtocolPings()
public void run()
run in interface java.lang.Runnablepublic boolean autoLogin(java.lang.String name,
java.lang.String password)
Sessionprotected boolean setLoggedInState(CharCreationLibrary.LoginResult loginResult)
public void loginSystem()
public void logoutFinal()
public void mainLoop()
public long activeTimeMillis()
CMRunnableactiveTimeMillis in interface CMRunnablepublic boolean addSessionFilter(Session.SessionFilter filter)
SessionaddSessionFilter in interface Sessionfilter - the filter to addpublic void setIdleTimers()
SessionsetIdleTimers in interface SessionSession.getIdleMillis()public int getSaveStatIndex()
ModifiablegetSaveStatIndex in interface ModifiableModifiable.getStatCodes(),
Modifiable.getStat(String),
Modifiable.setStat(String, String)public java.lang.String[] getStatCodes()
ModifiablegetStatCodes in interface ModifiableModifiable.getStat(String),
Modifiable.setStat(String, String)public boolean isStat(java.lang.String code)
ModifiableisStat in interface Modifiablecode - the name of the field to read.Modifiable.getStatCodes()public java.lang.String getStat(java.lang.String code)
ModifiablegetStat in interface Modifiablecode - the name of the field to read.Modifiable.getStatCodes()public void setStat(java.lang.String code,
java.lang.String val)
ModifiablesetStat in interface Modifiablecode - the name of the field to setval - the value to set the field toModifiable.getStatCodes()