CMCommon
, Session
, CMObject
, Modifiable
, CMRunnable
, java.lang.Cloneable
, java.lang.Comparable<CMObject>
, java.lang.Runnable
public 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 |
idConverter
MAX_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()
CMObject
public java.lang.String name()
CMObject
name
in interface CMObject
Environmental.Name()
public CMObject newInstance()
CMObject
newInstance
in interface CMObject
public void initializeClass()
CMObject
initializeClass
in interface CMObject
public boolean isFake()
Session
public CMObject copyOf()
CMObject
public int compareTo(CMObject o)
compareTo
in interface java.lang.Comparable<CMObject>
public void setStatus(Session.SessionStatus newStatus)
Session
setStatus
in interface Session
newStatus
- the tick statusSession.SessionStatus
public long getStartTime()
CMRunnable
getStartTime
in interface CMRunnable
public int getGroupID()
CMRunnable
getGroupID
in interface CMRunnable
public boolean isAllowedMcp(java.lang.String packageName, float version)
Session
isAllowedMcp
in interface Session
packageName
- the package to checkversion
- the version of the package to checkpublic boolean sendMcpCommand(java.lang.String packageCommand, java.lang.String parms)
Session
sendMcpCommand
in interface Session
packageCommand
- the fully formed commandparms
- the variable parameters, already well formedpublic void initializeSession(java.net.Socket s, java.lang.String groupName, java.lang.String introTextStr)
Session
initializeSession
in interface Session
s
- 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.IOException
public java.lang.String getGroupName()
Session
getGroupName
in interface Session
public void setGroupName(java.lang.String group)
Session
setGroupName
in interface Session
group
- the thread group namepublic void setFakeInput(java.lang.String input)
Session
setFakeInput
in interface Session
input
- text to send.public void setServerTelnetMode(int telnetCode, boolean onOff)
Session
setServerTelnetMode
in interface Session
telnetCode
- the telnet codeonOff
- true to turn on, false to turn off the flagSession.TELNET_ANSI
,
Session.getServerTelnetMode(int)
public boolean getServerTelnetMode(int telnetCode)
Session
getServerTelnetMode
in interface Session
telnetCode
- the telnet codeSession.TELNET_ANSI
,
Session.setServerTelnetMode(int, boolean)
public void setClientTelnetMode(int telnetCode, boolean onOff)
Session
setClientTelnetMode
in interface Session
telnetCode
- the telnet codeonOff
- true to turn on, false to turn off the flagSession.TELNET_ANSI
,
Session.getClientTelnetMode(int)
public boolean getClientTelnetMode(int telnetCode)
Session
getClientTelnetMode
in interface Session
telnetCode
- the telnet codeSession.TELNET_ANSI
,
Session.setClientTelnetMode(int, boolean)
public boolean isAllowedMxp(java.lang.String tagString)
Session
isAllowedMxp
in interface Session
tagString
- the tag to checkpublic boolean sendGMCPEvent(java.lang.String eventName, java.lang.String json)
Session
sendGMCPEvent
in interface Session
eventName
- the event name, like comm.channeljson
- the json doc, like {"blah":"BLAH"}public void changeTelnetMode(int telnetCode, boolean onOff)
Session
changeTelnetMode
in interface Session
telnetCode
- 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.IOException
public void changeTelnetModeBackwards(java.io.OutputStream out, int telnetCode, boolean onOff) throws java.io.IOException
java.io.IOException
public void negotiateTelnetMode(int telnetCode)
Session
negotiateTelnetMode
in interface Session
telnetCode
- the telnet codeSession.TELNET_ANSI
,
Session.TELNET_ANSI16
,
Session.setClientTelnetMode(int, boolean)
,
Session.setServerTelnetMode(int, boolean)
public void initTelnetMode(int attributesBitmap)
Session
initTelnetMode
in interface Session
attributesBitmap
- 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()
Session
getCurrentColor
in interface Session
public void setCurrentColor(ColorLibrary.ColorState newColor)
Session
setCurrentColor
in interface Session
newColor
- the color to change it topublic ColorLibrary.ColorState getLastColor()
Session
getLastColor
in interface Session
public void setLastColor(ColorLibrary.ColorState newColor)
Session
setLastColor
in interface Session
newColor
- the color to change it topublic ColorLibrary.ColorState popMarkedColor()
Session
popMarkedColor
in interface Session
public void pushMarkedColor(ColorLibrary.ColorState newColor)
Session
pushMarkedColor
in interface Session
newColor
- the color to change it topublic long getTotalMillis()
Session
getTotalMillis
in interface Session
public long getIdleMillis()
Session
getIdleMillis
in interface Session
Session.setIdleTimers()
public long getTotalTicks()
Session
getTotalTicks
in interface Session
public long getMillisOnline()
Session
getMillisOnline
in interface Session
public long getInputLoopTime()
Session
getInputLoopTime
in interface Session
Session.setInputLoopTime()
public void setInputLoopTime()
Session
setInputLoopTime
in interface Session
Session.getInputLoopTime()
public long getLastPKFight()
Session
getLastPKFight
in interface Session
Session.setLastPKFight()
,
Session.setLastNPCFight()
public void setLastPKFight()
Session
setLastPKFight
in interface Session
Session.getLastPKFight()
,
Session.getLastNPCFight()
public long getLastNPCFight()
Session
getLastNPCFight
in interface Session
Session.setLastPKFight()
,
Session.setLastNPCFight()
public void setLastNPCFight()
Session
setLastNPCFight
in interface Session
Session.getLastPKFight()
,
Session.getLastNPCFight()
public java.util.List<java.lang.String> getLastMsgs()
Session
getLastMsgs
in interface Session
public java.lang.String getTerminalType()
Session
getTerminalType
in interface Session
public MOB mob()
Session
mob
in interface Session
Session.setMob(MOB)
public void setMob(MOB newmob)
Session
setMob
in interface Session
newmob
- the player MOB attached to this session object.Session.mob()
public void setAccount(PlayerAccount account)
Session
setAccount
in interface Session
account
- the player account attached to this session object.Session.mob()
public int getWrap()
Session
public int getPageBreak()
public boolean isStopped()
Session
isStopped
in interface Session
Session.logout(boolean)
,
Session.isStopped()
public void setKillFlag(boolean truefalse)
public java.util.List<java.lang.String> getPreviousCMD()
Session
getPreviousCMD
in interface Session
public void setBeingSnoopedBy(Session session, boolean onOff)
Session
setBeingSnoopedBy
in interface Session
session
- 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)
Session
isBeingSnoopedBy
in interface Session
S
- the session to check for a snoop on me.Session.setBeingSnoopedBy(Session, boolean)
,
Session.isBeingSnoopedBy(Session)
,
Session.snoopSuspension(int)
public int snoopSuspension(int change)
Session
snoopSuspension
in interface Session
change
- 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()
Session
getHistory
in interface Session
protected void setPreviousCmd(java.util.List<java.lang.String> cmds)
public boolean isAfk()
Session
isAfk
in interface Session
Session.setAfkFlag(boolean)
,
Session.setAFKMessage(String)
public void setAfkFlag(boolean truefalse)
Session
setAfkFlag
in interface Session
truefalse
- true if they are AFK, false otherwiseSession.isAfk()
,
Session.getAfkMessage()
public java.lang.String getAfkMessage()
Session
getAfkMessage
in interface Session
Session.setAfkFlag(boolean)
,
Session.setAFKMessage(String)
public void setAFKMessage(java.lang.String str)
Session
setAFKMessage
in interface Session
str
- 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()
Session
isLockedUpWriting
in interface Session
public final void rawBytesOut(java.io.OutputStream out, byte[] bytes) throws java.io.IOException
java.io.IOException
public void rawCharsOut(char[] chars)
Session
rawCharsOut
in interface Session
chars
- 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)
Session
onlyPrint
in interface Session
msg
- the string to send to the userSession.onlyPrint(String, boolean)
public void onlyPrint(java.lang.String msg, boolean noCache)
Session
onlyPrint
in interface Session
msg
- the string to send to the usernoCache
- true to disable line caching, false otherwiseSession.rawCharsOut(char[])
public void rawOut(java.lang.String msg)
Session
rawOut
in interface Session
msg
- the string to send to the userSession.rawCharsOut(char[])
public void rawPrint(java.lang.String msg)
Session
rawPrint
in interface Session
msg
- the string to send to the userSession.rawPrint(String)
public void safeRawPrint(java.lang.String msg)
Session
safeRawPrint
in interface Session
msg
- the string to send to the userSession.safeRawPrintln(String)
public void print(java.lang.String msg)
Session
print
in interface Session
msg
- the string to send to the userSession.onlyPrint(String, boolean)
,
Session.promptPrint(String)
public void promptPrint(java.lang.String msg)
Session
promptPrint
in interface Session
msg
- the string to send to the userSession.onlyPrint(String, boolean)
public void rawPrintln(java.lang.String msg)
Session
rawPrintln
in interface Session
msg
- the string to send to the userSession.rawPrintln(String)
public void safeRawPrintln(java.lang.String msg)
Session
safeRawPrintln
in interface Session
msg
- the string to send to the userSession.safeRawPrint(String)
public void stdPrint(java.lang.String msg)
Session
stdPrint
in interface Session
msg
- the string to send to the userSession.rawPrint(String)
public void print(Physical src, Environmental trg, Environmental tol, java.lang.String msg)
Session
print
in interface Session
src
- 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)
Session
stdPrint
in interface Session
src
- 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)
Session
println
in interface Session
msg
- the string to send to the userSession.onlyPrint(String, boolean)
public void wraplessPrintln(java.lang.String msg)
Session
wraplessPrintln
in interface Session
msg
- the string to send to the userSession.onlyPrint(String, boolean)
public void wraplessPrint(java.lang.String msg)
Session
wraplessPrint
in interface Session
msg
- the string to send to the userSession.onlyPrint(String, boolean)
public void colorOnlyPrintln(java.lang.String msg)
Session
colorOnlyPrintln
in interface Session
msg
- the string to send to the userSession.onlyPrint(String, boolean)
public void colorOnlyPrintln(java.lang.String msg, boolean noCache)
Session
colorOnlyPrintln
in interface Session
msg
- the string to send to the usernoCache
- true to disable line caching, false otherwiseSession.onlyPrint(String, boolean)
public void colorOnlyPrint(java.lang.String msg)
Session
colorOnlyPrint
in interface Session
msg
- the string to send to the userSession.onlyPrint(String, boolean)
public void colorOnlyPrint(java.lang.String msg, boolean noCache)
Session
colorOnlyPrint
in interface Session
msg
- 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)
Session
stdPrintln
in interface Session
msg
- the string to send to the userSession.rawPrintln(String)
public void println(Physical src, Environmental trg, Environmental tol, java.lang.String msg)
Session
println
in interface Session
src
- 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)
Session
stdPrintln
in interface Session
src
- 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)
Session
setPromptFlag
in interface Session
truefalse
- 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
Session
prompt
in interface Session
Message
- 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
Session
prompt
in interface Session
Message
- 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)
Session
prompt
in interface Session
callBack
- the callback to modify and make when doneSession.InputCallback
public java.lang.String prompt(java.lang.String Message, long maxTime) throws java.io.IOException
Session
prompt
in interface Session
Message
- 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
Session
prompt
in interface Session
Message
- 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()
Session
getColorCodes
in interface Session
public void handleSubOption(int optionCode, char[] suboptionData, int dataSize) throws java.io.IOException
java.io.IOException
public void handleEscape() throws java.io.IOException, java.io.InterruptedIOException
java.io.IOException
java.io.InterruptedIOException
public void handleIAC() throws java.io.IOException, java.io.InterruptedIOException
java.io.IOException
java.io.InterruptedIOException
public int readByte() throws java.io.IOException
java.io.IOException
public int readChar() throws java.io.IOException
java.io.IOException
public char hotkey(long maxWait)
Session
protected int nonBlockingIn(boolean appendInputFlag) throws java.io.IOException
java.io.IOException
protected void clearInputBuffer(long maxTime)
public java.lang.String blockingIn(long maxTime, boolean filter) throws java.io.IOException
Session
blockingIn
in interface Session
maxTime
- 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.IOException
protected boolean sessionMCPCheck(java.lang.StringBuilder inStr)
public java.lang.String readlineContinue() throws java.io.IOException, java.net.SocketException
Session
readlineContinue
in interface Session
java.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
Session
confirm
in interface Session
Message
- 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
Session
confirm
in interface Session
Message
- 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
Session
choose
in interface Session
Message
- 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
Session
choose
in interface Session
Message
- 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
Session
choose
in interface Session
promptMsg
- 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)
Session
stopSession
in interface Session
removeMOB
- 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()
Session
getAddress
in interface Session
public Session.SessionStatus getStatus()
Session
getStatus
in interface Session
Session.SessionStatus
public boolean isWaitingForInput()
Session
isWaitingForInput
in interface Session
public void logout(boolean removeMOB)
Session
public boolean isRunning()
Session
public boolean isPendingLogin(java.lang.String otherLoginName)
Session
isPendingLogin
in interface Session
otherLoginName
- another login name potentially matchprotected void doProtocolPings()
public void run()
run
in interface java.lang.Runnable
public boolean autoLogin(java.lang.String name, java.lang.String password)
Session
protected boolean setLoggedInState(CharCreationLibrary.LoginResult loginResult)
public void loginSystem()
public void logoutFinal()
public void mainLoop()
public long activeTimeMillis()
CMRunnable
activeTimeMillis
in interface CMRunnable
public boolean addSessionFilter(Session.SessionFilter filter)
Session
addSessionFilter
in interface Session
filter
- the filter to addpublic void setIdleTimers()
Session
setIdleTimers
in interface Session
Session.getIdleMillis()
public int getSaveStatIndex()
Modifiable
getSaveStatIndex
in interface Modifiable
Modifiable.getStatCodes()
,
Modifiable.getStat(String)
,
Modifiable.setStat(String, String)
public java.lang.String[] getStatCodes()
Modifiable
getStatCodes
in interface Modifiable
Modifiable.getStat(String)
,
Modifiable.setStat(String, String)
public boolean isStat(java.lang.String code)
Modifiable
isStat
in interface Modifiable
code
- the name of the field to read.Modifiable.getStatCodes()
public java.lang.String getStat(java.lang.String code)
Modifiable
getStat
in interface Modifiable
code
- the name of the field to read.Modifiable.getStatCodes()
public void setStat(java.lang.String code, java.lang.String val)
Modifiable
setStat
in interface Modifiable
code
- the name of the field to setval
- the value to set the field toModifiable.getStatCodes()