com.planet_ink.coffee_mud.Common.interfaces
Interface Session

All Superinterfaces:
java.lang.Cloneable, CMCommon, CMObject, java.lang.Comparable<CMObject>, Modifiable
All Known Implementing Classes:
DefaultSession, FakeSession

public interface Session
extends CMCommon, Modifiable

A Session object is the key interface between the internet user and their player MOB. In fact, the presence of an attached session object to a MOB is the only difference between an NPC MOB and a player MOB. This object handles input, output, and related processes.


Field Summary
static int MAX_PREVMSGS
          for REPLY command, constant for maximum number of saved strings
static int STATUS_ACCOUNTMENU
          Status value constant possibly returned by getStatus method
static int STATUS_LOGIN
          Status value constant possibly returned by getStatus method
static int STATUS_LOGIN1
          Status value constant possibly returned by getStatus method
static int STATUS_LOGIN2
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT1
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT10
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT11
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT12
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT2
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT3
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT4
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT5
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT6
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT7
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT8
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUT9
          Status value constant possibly returned by getStatus method
static int STATUS_LOGOUTFINAL
          Status value constant possibly returned by getStatus method
static int STATUS_OK
          Status value constant possibly returned by getStatus method
static java.lang.String[] STATUS_STR
          Status strings indexed by the various STATUS_ constants.
static int TELNET_ANSI
          TELNET CODE: 253 doubles as fake ansi telnet code
static int TELNET_AYT
          TELNET CODE: Are You There
static int TELNET_BINARY
          TELNET CODE: transmit binary
static int TELNET_COMPRESS
          TELNET CODE: text compression, protocol 1
static int TELNET_COMPRESS2
          TELNET CODE: text compression, protocol 2
static java.lang.String[] TELNET_DESCS
          Array String-friendly descriptions of the various telnet codes.
static int TELNET_DO
          TELNET CODE: Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option
static int TELNET_DONT
          TELNET CODE: Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option.
static int TELNET_EC
          TELNET CODE: Erase character
static int TELNET_ECHO
          TELNET CODE: echo
static int TELNET_IAC
          TELNET CODE: IAC
static int TELNET_LINEMODE
          TELNET CODE: Linemode
static int TELNET_LINEMODE_MODE
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_MODEMASK_ACK
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_MODEMASK_EDIT
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_MODEMASK_TRAPSIG
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_ACK
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_AO
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_AYT
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_BRK
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_CANTCHANGE
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_DEFAULT
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_EOF
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_EOR
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_IP
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_NOSUPPORT
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_SUSP
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_VALUE
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_XOFF
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LINEMODE_SLC_XON
          Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does
static int TELNET_LOGOUT
          TELNET CODE: echo
static int TELNET_MSP
          TELNET CODE: MSP SOund protocol
static int TELNET_MSSP
          TELNET CODE: MSSP Server Status protocol
static int TELNET_MXP
          TELNET CODE: MXP Extended protocol
static int TELNET_NAWS
          TELNET CODE: Negotiate About Window Size.
static int TELNET_SB
          TELNET CODE: Indicates that what follows is subnegotiation of the indicated option
static int TELNET_SE
          TELNET CODE: End of subnegotiation parameters
static int TELNET_SUPRESS_GO_AHEAD
          TELNET CODE: supress go ahead
static int TELNET_TERMTYPE
          TELNET CODE: sending terminal type
static int TELNET_TOGGLE_FLOW_CONTROL
          TELNET CODE: Remote Flow Control.
static int TELNET_WILL
          TELNET CODE: Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option
static int TELNET_WONT
          TELNET CODE: Indicates the refusal to perform, or continue performing, the indicated option
 
Method Summary
 boolean afkFlag()
          Returns whether this mob/session is currently Away From Keyboard
 java.lang.String afkMessage()
          Returns the reason given by the user that they are AFK.
 boolean amBeingSnoopedBy(Session S)
          Checks to see if the given session is snooping on this one.
 java.lang.String blockingIn()
          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.
 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 Message, java.lang.String Choices, java.lang.String Default, long maxTime, java.util.List<java.lang.String> paramsOut)
          Prompts the user to enter one character responses from a set of valid choices.
 boolean clientTelnetMode(int telnetCode)
          Gets a client telnet mode flag.
 java.lang.String[] clookup()
          Returns a list of telnet coded strings indexed by coffeemud color code.
 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.
 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.
 int currentColor()
          Returns the current color code.
 java.lang.String getAddress()
          Gets the current telnet clients ip address.
 int getColor(char c)
          Returns the given color code, unless it is one that translates to another, such as ?
 long getIdleMillis()
          Gets the number of milliseconds since a user entry was registered by this session
 java.util.List<java.lang.String> getLastMsgs()
          Returns a Vector 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 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.
 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.
 void initializeSession(java.net.Socket s, java.lang.String introTextStr)
          Negotiates various telnet options (or attempts to), and prints the introTextStr to the user.
 void initTelnetMode(int mobbitmap)
          Initializes a telnet mode between this session and the connected client by negotiating certain fundamental flags, like ANSI, MXP, and MSP.
 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.
 void kill(boolean removeMOB, boolean dropSession, boolean killThread)
          Force the current player to logoff.
 boolean killFlag()
          Returns whether this session is done, or slated to be done.
 int lastColor()
          Returns the previous current color code.
 long lastLoopTime()
          Returns the last time in milliseconds that this session began its input loop.
 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.
 java.lang.String makeEscape(int c)
          Converts a character after the ^ sign (usually a color code) into an appropriate telnet escape sequence string for output.
 MOB mob()
          Returns the player MOB attached to this session object.
 void negotiateTelnetMode(int telnetCode)
          Change telnet mode by negotiating the command to the clients client.
 void onlyPrint(java.lang.String msg)
          Low level text output method.
 void onlyPrint(java.lang.String msg, boolean noCache)
          Low level text output method.
 void out(char[] c)
          Lowest level user-output method.
 java.util.List<java.lang.String> previousCMD()
          Returns a pre-parsed, pre-filtered Vector of strings representing the last command entered by the user through this session.
 void print(Physical Source, Environmental Target, Environmental Tool, java.lang.String msg)
          Medium-level text output method.
 void print(java.lang.String msg)
          Medium-level text output method.
 void println(Physical Source, Environmental Target, Environmental Tool, java.lang.String msg)
          Medium-level text output method.
 void println(java.lang.String msg)
          Medium-level text output method.
 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 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.
 java.lang.String readlineContinue()
          Blocks for a short amount of time, returning an input string only if the user happens to have hit enter.
 boolean serverTelnetMode(int telnetCode)
          Gets a server telnet mode flag.
 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 setClientTelnetMode(int telnetCode, boolean onOff)
          Sets a client telnet mode flag.
 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.
 void setMob(MOB newmob)
          Sets the player MOB attached to this session object.
 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.
 int snoopSuspension(int change)
          Increments or decrements the snoop suspension counter by the given amount.
 void start()
          There is no interface for Thread, so since DefaultSession implements thread, and this fact needs to be externatized, the thread start method is hereby externalized.
 void startBeingSnoopedBy(Session S)
          Notifies this session that the given session is snooping it.
 void stdPrint(Physical Source, Environmental Target, Environmental Tool, java.lang.String msg)
          Higher-level line output method.
 void stdPrint(java.lang.String msg)
          Higher-level line output method.
 void stdPrintln(Physical Source, Environmental Target, Environmental Tool, java.lang.String msg)
          Higher-level line output method.
 void stdPrintln(java.lang.String msg)
          Higher-level line output method.
 void stopBeingSnoopedBy(Session S)
          Notifies this session that the given session is no longer snooping it.
 void updateLoopTime()
          Sets the last time in milliseconds that this session began its input loop.
 void wraplessPrint(java.lang.String msg)
          Medium-level text output method.
 void wraplessPrintln(java.lang.String msg)
          Medium-level text output method.
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Modifiable
getSaveStatIndex, getStat, getStatCodes, isStat, setStat
 

Field Detail

TELNET_BINARY

static final int TELNET_BINARY
TELNET CODE: transmit binary

See Also:
Constant Field Values

TELNET_ECHO

static final int TELNET_ECHO
TELNET CODE: echo

See Also:
Constant Field Values

TELNET_LOGOUT

static final int TELNET_LOGOUT
TELNET CODE: echo

See Also:
Constant Field Values

TELNET_SUPRESS_GO_AHEAD

static final int TELNET_SUPRESS_GO_AHEAD
TELNET CODE: supress go ahead

See Also:
Constant Field Values

TELNET_TERMTYPE

static final int TELNET_TERMTYPE
TELNET CODE: sending terminal type

See Also:
Constant Field Values

TELNET_NAWS

static final int TELNET_NAWS
TELNET CODE: Negotiate About Window Size.

See Also:
Constant Field Values

TELNET_TOGGLE_FLOW_CONTROL

static final int TELNET_TOGGLE_FLOW_CONTROL
TELNET CODE: Remote Flow Control.

See Also:
Constant Field Values

TELNET_LINEMODE

static final int TELNET_LINEMODE
TELNET CODE: Linemode

See Also:
Constant Field Values

TELNET_MSSP

static final int TELNET_MSSP
TELNET CODE: MSSP Server Status protocol

See Also:
Constant Field Values

TELNET_COMPRESS

static final int TELNET_COMPRESS
TELNET CODE: text compression, protocol 1

See Also:
Constant Field Values

TELNET_COMPRESS2

static final int TELNET_COMPRESS2
TELNET CODE: text compression, protocol 2

See Also:
Constant Field Values

TELNET_MSP

static final int TELNET_MSP
TELNET CODE: MSP SOund protocol

See Also:
Constant Field Values

TELNET_MXP

static final int TELNET_MXP
TELNET CODE: MXP Extended protocol

See Also:
Constant Field Values

TELNET_SE

static final int TELNET_SE
TELNET CODE: End of subnegotiation parameters

See Also:
Constant Field Values

TELNET_AYT

static final int TELNET_AYT
TELNET CODE: Are You There

See Also:
Constant Field Values

TELNET_EC

static final int TELNET_EC
TELNET CODE: Erase character

See Also:
Constant Field Values

TELNET_SB

static final int TELNET_SB
TELNET CODE: Indicates that what follows is subnegotiation of the indicated option

See Also:
Constant Field Values

TELNET_WILL

static final int TELNET_WILL
TELNET CODE: Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option

See Also:
Constant Field Values

TELNET_WONT

static final int TELNET_WONT
TELNET CODE: Indicates the refusal to perform, or continue performing, the indicated option

See Also:
Constant Field Values

TELNET_DO

static final int TELNET_DO
TELNET CODE: Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option

See Also:
Constant Field Values

TELNET_ANSI

static final int TELNET_ANSI
TELNET CODE: 253 doubles as fake ansi telnet code

See Also:
Constant Field Values

TELNET_DONT

static final int TELNET_DONT
TELNET CODE: Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option.

See Also:
Constant Field Values

TELNET_IAC

static final int TELNET_IAC
TELNET CODE: IAC

See Also:
Constant Field Values

TELNET_DESCS

static final java.lang.String[] TELNET_DESCS
Array String-friendly descriptions of the various telnet codes. Indexed by code id 0-255


MAX_PREVMSGS

static final int MAX_PREVMSGS
for REPLY command, constant for maximum number of saved strings

See Also:
Constant Field Values

TELNET_LINEMODE_MODE

static final int TELNET_LINEMODE_MODE
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_MODEMASK_EDIT

static final int TELNET_LINEMODE_MODEMASK_EDIT
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_MODEMASK_TRAPSIG

static final int TELNET_LINEMODE_MODEMASK_TRAPSIG
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_MODEMASK_ACK

static final int TELNET_LINEMODE_MODEMASK_ACK
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC

static final int TELNET_LINEMODE_SLC
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_DEFAULT

static final int TELNET_LINEMODE_SLC_DEFAULT
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_VALUE

static final int TELNET_LINEMODE_SLC_VALUE
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_CANTCHANGE

static final int TELNET_LINEMODE_SLC_CANTCHANGE
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_NOSUPPORT

static final int TELNET_LINEMODE_SLC_NOSUPPORT
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_ACK

static final int TELNET_LINEMODE_SLC_ACK
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_XON

static final int TELNET_LINEMODE_SLC_XON
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_XOFF

static final int TELNET_LINEMODE_SLC_XOFF
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_EOF

static final int TELNET_LINEMODE_SLC_EOF
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_SUSP

static final int TELNET_LINEMODE_SLC_SUSP
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_BRK

static final int TELNET_LINEMODE_SLC_BRK
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_IP

static final int TELNET_LINEMODE_SLC_IP
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_AO

static final int TELNET_LINEMODE_SLC_AO
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_AYT

static final int TELNET_LINEMODE_SLC_AYT
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

TELNET_LINEMODE_SLC_EOR

static final int TELNET_LINEMODE_SLC_EOR
Some sort of TELNET protocol constant related to LINEMODE -- I've no idea what it does

See Also:
Constant Field Values

STATUS_OK

static final int STATUS_OK
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGIN

static final int STATUS_LOGIN
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_ACCOUNTMENU

static final int STATUS_ACCOUNTMENU
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGIN1

static final int STATUS_LOGIN1
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGIN2

static final int STATUS_LOGIN2
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT

static final int STATUS_LOGOUT
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT1

static final int STATUS_LOGOUT1
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT2

static final int STATUS_LOGOUT2
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT3

static final int STATUS_LOGOUT3
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT4

static final int STATUS_LOGOUT4
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT5

static final int STATUS_LOGOUT5
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT6

static final int STATUS_LOGOUT6
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT7

static final int STATUS_LOGOUT7
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT8

static final int STATUS_LOGOUT8
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT9

static final int STATUS_LOGOUT9
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT10

static final int STATUS_LOGOUT10
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT11

static final int STATUS_LOGOUT11
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUT12

static final int STATUS_LOGOUT12
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_LOGOUTFINAL

static final int STATUS_LOGOUTFINAL
Status value constant possibly returned by getStatus method

See Also:
Constant Field Values

STATUS_STR

static final java.lang.String[] STATUS_STR
Status strings indexed by the various STATUS_ constants. Descriptive strings

Method Detail

initializeSession

void initializeSession(java.net.Socket s,
                       java.lang.String introTextStr)
Negotiates various telnet options (or attempts to), and prints the introTextStr to the user.

Parameters:
s - the socket the user connected from
introTextStr - introductory text string (Hello!)

start

void start()
There is no interface for Thread, so since DefaultSession implements thread, and this fact needs to be externatized, the thread start method is hereby externalized. Not required for most sessions, only for those acting as Threads.


clookup

java.lang.String[] clookup()
Returns a list of telnet coded strings indexed by coffeemud color code. May be from the standard list, or read from player records for a customized list.

Returns:
telnet coded color strings.

onlyPrint

void onlyPrint(java.lang.String msg,
               boolean noCache)
Low level text output method. Implements such features as snoops, spam-stacking, page breaks, and line caching

Parameters:
msg - the string to send to the user
noCache - true to disable line caching, false otherwise
See Also:
out(char[])

onlyPrint

void onlyPrint(java.lang.String msg)
Low level text output method. Implements such features as snoops, spam-stacking. No page breaking, and Always line caching

Parameters:
msg - the string to send to the user
See Also:
onlyPrint(String, boolean)

rawOut

void rawOut(java.lang.String msg)
Lowest level user-output method. Does nothing but send the string to the user, period.

Parameters:
msg - the string to send to the user
See Also:
out(char[])

rawPrintln

void rawPrintln(java.lang.String msg)
Low level line-output method. Sets the prompt flag after write, and inserts additional pre-linefeed if currently at the prompt. Adds post linefeed of course. Does not do a page break.

Parameters:
msg - the string to send to the user
See Also:
rawPrintln(String)

rawPrint

void rawPrint(java.lang.String msg)
Low level line-output method. Sets the prompt flag after write, and inserts additional pre-linefeed if currently at the prompt.

Parameters:
msg - the string to send to the user
See Also:
rawPrint(String)

stdPrint

void stdPrint(java.lang.String msg)
Higher-level line output method. Does full filtering of special characters and codes.

Parameters:
msg - the string to send to the user
See Also:
rawPrint(String)

stdPrint

void stdPrint(Physical Source,
              Environmental Target,
              Environmental Tool,
              java.lang.String msg)
Higher-level line output method. Does full filtering of special characters and codes using given variable values.

Parameters:
Source - variable for special code parsing: Source
Target - variable for special code parsing: Target
Tool - variable for special code parsing: Tool
msg - the string to send to the user
See Also:
rawPrint(String)

stdPrintln

void stdPrintln(java.lang.String msg)
Higher-level line output method. Does full filtering of special characters and codes.

Parameters:
msg - the string to send to the user
See Also:
rawPrintln(String)

stdPrintln

void stdPrintln(Physical Source,
                Environmental Target,
                Environmental Tool,
                java.lang.String msg)
Higher-level line output method. Does full filtering of special characters and codes using given variable values.

Parameters:
Source - variable for special code parsing: Source
Target - variable for special code parsing: Target
Tool - variable for special code parsing: Tool
msg - the string to send to the user
See Also:
rawPrintln(String)

out

void out(char[] c)
Lowest level user-output method. Does nothing but send the string to the user, period.

Parameters:
c - string (as char array) to send out to the user

isLockedUpWriting

boolean isLockedUpWriting()
Checks whether this session is currently over its time limit trying to write data to its socket. For some reason this happens, and this method detects it.

Returns:
true if something bas happened, false otherwise

isFake

boolean isFake()
Returns true if this session is merely a placeholder, and does not represent an actual user connection. Will ensure that the system continues to treat the user as a mob.

Returns:
true if this session is not a connection

print

void print(java.lang.String msg)
Medium-level text output method. Does full filtering of special characters and codes. Does not manage the prompt.

Parameters:
msg - the string to send to the user
See Also:
onlyPrint(String, boolean)

print

void print(Physical Source,
           Environmental Target,
           Environmental Tool,
           java.lang.String msg)
Medium-level text output method. Does full filtering of special characters and codes using given variable values. Does not manage the prompt.

Parameters:
Source - variable for special code parsing: Source
Target - variable for special code parsing: Target
Tool - variable for special code parsing: Tool
msg - the string to send to the user
See Also:
onlyPrint(String, boolean)

println

void println(java.lang.String msg)
Medium-level text output method. Does full filtering of special characters and codes. Does not manage the prompt. Adds a linefeed at the end though.

Parameters:
msg - the string to send to the user
See Also:
onlyPrint(String, boolean)

println

void println(Physical Source,
             Environmental Target,
             Environmental Tool,
             java.lang.String msg)
Medium-level text output method. Does full filtering of special characters and codes using given variable values. Does not manage the prompt. Adds a linefeed at the end though.

Parameters:
Source - variable for special code parsing: Source
Target - variable for special code parsing: Target
Tool - variable for special code parsing: Tool
msg - the string to send to the user
See Also:
onlyPrint(String, boolean)

setPromptFlag

void setPromptFlag(boolean truefalse)
Notifies this session to output the users prompt again once it has reached a suitable lapse in text output.

Parameters:
truefalse - true to send another prompt, false otherwise

wraplessPrintln

void wraplessPrintln(java.lang.String msg)
Medium-level text output method. Does full filtering of special characters and codes. DOES manage the prompt, but turns OFF word wrap! Adds a linefeed at the end.

Parameters:
msg - the string to send to the user
See Also:
onlyPrint(String, boolean)

wraplessPrint

void wraplessPrint(java.lang.String msg)
Medium-level text output method. Does full filtering of special characters and codes. DOES manage the prompt, but turns OFF word wrap!

Parameters:
msg - the string to send to the user
See Also:
onlyPrint(String, boolean)

colorOnlyPrintln

void colorOnlyPrintln(java.lang.String msg,
                      boolean noCache)
Lower-Medium-level text output method. Does only the parsing of color codes, no word wrapping, no codes. Adds a linefeed at the end.

Parameters:
msg - the string to send to the user
noCache - true to disable line caching, false otherwise
See Also:
onlyPrint(String, boolean)

colorOnlyPrint

void colorOnlyPrint(java.lang.String msg,
                    boolean noCache)
Lower-Medium-level text output method. Does only the parsing of color codes, no word wrapping, no codes.

Parameters:
msg - the string to send to the user
noCache - true to disable line caching, false otherwise
See Also:
onlyPrint(String, boolean)

colorOnlyPrintln

void colorOnlyPrintln(java.lang.String msg)
Lower-Medium-level text output method. Does only the parsing of color codes, no word wrapping, no codes. Adds a linefeed at the end.

Parameters:
msg - the string to send to the user
See Also:
onlyPrint(String, boolean)

colorOnlyPrint

void colorOnlyPrint(java.lang.String msg)
Lower-Medium-level text output method. Does only the parsing of color codes, no word wrapping, no codes.

Parameters:
msg - the string to send to the user
See Also:
onlyPrint(String, boolean)

hotkey

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.

Parameters:
maxWait - the maximum milliseconds to wait
Returns:
the key pressed, or \0

prompt

java.lang.String prompt(java.lang.String Message,
                        java.lang.String Default)
                        throws java.io.IOException
Prompts the user to enter a string, and then returns what the enter. Does not time out, but may throw an exception on disconnnect.

Parameters:
Message - the prompt message to display to the user
Default - the default response if the user just hits enter
Returns:
the string entered by the user, or the Default
Throws:
java.io.IOException - a disconnect
See Also:
prompt(String), prompt(String, long), prompt(String, String, long)

prompt

java.lang.String prompt(java.lang.String Message,
                        java.lang.String Default,
                        long maxTime)
                        throws java.io.IOException
Prompts the user to enter a string, and then returns what the enter. Possibly times out, and may throw an exception on disconnnect or time out.

Parameters:
Message - the prompt message to display to the user
Default - the default response if the user just hits enter
maxTime - max number of milliseconds to wait before timing out
Returns:
the string entered by the user, or the Default
Throws:
java.io.IOException - a disconnect or time out
See Also:
prompt(String), prompt(String, String), prompt(String, long)

prompt

java.lang.String prompt(java.lang.String Message)
                        throws java.io.IOException
Prompts the user to enter a string, and then returns what the enter. Does not time out, but may throw an exception on disconnnect.

Parameters:
Message - the prompt message to display to the user
Returns:
the string entered by the user
Throws:
java.io.IOException - a disconnect
See Also:
prompt(String, String), prompt(String, long), prompt(String, String, long)

prompt

java.lang.String prompt(java.lang.String Message,
                        long maxTime)
                        throws java.io.IOException
Prompts the user to enter a string, and then returns what the enter. Possibly times out, and may throw an exception on disconnnect or time out.

Parameters:
Message - the prompt message to display to the user
maxTime - max number of milliseconds to wait before timing out
Returns:
the string entered by the user
Throws:
java.io.IOException - a disconnect or time out
See Also:
prompt(String), prompt(String, String), prompt(String, String, long)

confirm

boolean confirm(java.lang.String Message,
                java.lang.String Default)
                throws java.io.IOException
Prompts the user to enter Y or N, and returns what they enter. Will not time out, but may throw an exception on disconnect.

Parameters:
Message - the prompt message to display to the user
Default - the default response if the user just hits enter
Returns:
true if they entered Y, false otherwise
Throws:
java.io.IOException - a disconnect
See Also:
confirm(String, String, long)

confirm

boolean confirm(java.lang.String Message,
                java.lang.String Default,
                long maxTime)
                throws java.io.IOException
Prompts the user to enter Y or N, and returns what they enter. Possibly times out, and may throw an exception on disconnnect or time out.

Parameters:
Message - the prompt message to display to the user
Default - the default response if the user just hits enter
maxTime - max number of milliseconds to wait before timing out
Returns:
true if they entered Y, false otherwise
Throws:
java.io.IOException - a disconnect or time out
See Also:
confirm(String, String)

choose

java.lang.String choose(java.lang.String Message,
                        java.lang.String Choices,
                        java.lang.String Default)
                        throws java.io.IOException
Prompts the user to enter one character responses from a set of valid choices. Repeats the prompt if the user does not enter a valid choice. ENTER is a valid choice for Default. Does not time out, but may throw an exception on disconnnect.

Parameters:
Message - the prompt message to display to the user
Choices - a list of uppercase characters that may be entered
Default - the default response if the user just hits enter
Returns:
the character entered from the choices
Throws:
java.io.IOException - a disconnect
See Also:
choose(String, String, String, long)

choose

java.lang.String choose(java.lang.String Message,
                        java.lang.String Choices,
                        java.lang.String Default,
                        long maxTime,
                        java.util.List<java.lang.String> paramsOut)
                        throws java.io.IOException
Prompts the user to enter one character responses from a set of valid choices. Repeats the prompt if the user does not enter a valid choice. ENTER is a valid choice for Default. Does not time out, but may throw an exception on disconnnect.

Parameters:
Message - the prompt message to display to the user
Choices - a list of uppercase characters that may be entered
Default - the default response if the user just hits enter
maxTime - max number of milliseconds to wait before timing out
paramsOut - an empty list to put any extra crap added to the end of the choice.
Returns:
the character entered from the choices
Throws:
java.io.IOException - a disconnect
See Also:
choose(String, String, String, long)

choose

java.lang.String choose(java.lang.String Message,
                        java.lang.String Choices,
                        java.lang.String Default,
                        long maxTime)
                        throws java.io.IOException
Prompts the user to enter one character responses from a set of valid choices. Repeats the prompt if the user does not enter a valid choice. ENTER is a valid choice for Default. May time out, and may throw an exception on disconnnect.

Parameters:
Message - the prompt message to display to the user
Choices - a list of uppercase characters that may be entered
Default - the default response if the user just hits enter
maxTime - max number of milliseconds to wait before timing out
Returns:
the character entered from the choices
Throws:
java.io.IOException - a disconnect or time out
See Also:
choose(String, String, String)

startBeingSnoopedBy

void startBeingSnoopedBy(Session S)
Notifies this session that the given session is snooping it. This session will manage said snooping.

Parameters:
S - the session to snoop on me.
See Also:
startBeingSnoopedBy(Session), stopBeingSnoopedBy(Session), amBeingSnoopedBy(Session), snoopSuspension(int)

stopBeingSnoopedBy

void stopBeingSnoopedBy(Session S)
Notifies this session that the given session is no longer snooping it. This session will remove said snooping.

Parameters:
S - the session to stop snooping on me.
See Also:
startBeingSnoopedBy(Session), stopBeingSnoopedBy(Session), amBeingSnoopedBy(Session), snoopSuspension(int)

amBeingSnoopedBy

boolean amBeingSnoopedBy(Session S)
Checks to see if the given session is snooping on this one.

Parameters:
S - the session to check for a snoop on me.
Returns:
true if the given session is snooping on me, false otherwise
See Also:
startBeingSnoopedBy(Session), stopBeingSnoopedBy(Session), amBeingSnoopedBy(Session), snoopSuspension(int)

snoopSuspension

int snoopSuspension(int change)
Increments or decrements the snoop suspension counter by the given amount. Only when the counter is 0 does snooping of this session actually occur.

Parameters:
change - the amount to change the snoop suspension counter by
Returns:
the current value of the snoop suspension counter after the change
See Also:
startBeingSnoopedBy(Session), stopBeingSnoopedBy(Session), amBeingSnoopedBy(Session), snoopSuspension(int)

kill

void kill(boolean removeMOB,
          boolean dropSession,
          boolean killThread)
Force the current player to logoff.

Parameters:
removeMOB - true to remove the mob from the game
dropSession - true to force closed sockets, and removed session
killThread - true to force a thread death, and false to be more lenient
See Also:
killFlag()

killFlag

boolean killFlag()
Returns whether this session is done, or slated to be done.

Returns:
true if this session needs to go, false otherwise
See Also:
logout(boolean), killFlag()

logout

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.

Parameters:
removeMOB - true to remove the mob from the game

afkFlag

boolean afkFlag()
Returns whether this mob/session is currently Away From Keyboard

Returns:
true if they are AFK, false otherwise
See Also:
setAfkFlag(boolean), setAFKMessage(String)

setAfkFlag

void setAfkFlag(boolean truefalse)
Sets whether this mob/session is currently Away From Keyboard

Parameters:
truefalse - true if they are AFK, false otherwise
See Also:
afkFlag(), afkMessage()

afkMessage

java.lang.String afkMessage()
Returns the reason given by the user that they are AFK.

Returns:
the reason given by the user that they are AFK.
See Also:
setAfkFlag(boolean), setAFKMessage(String)

setAFKMessage

void setAFKMessage(java.lang.String str)
Returns the reason given by the user that they are AFK.

Parameters:
str - the reason given by the user that they are AFK.
See Also:
setAfkFlag(boolean), afkMessage()

blockingIn

java.lang.String blockingIn()
                            throws java.io.IOException
Blocks the current thread until the user attached to this session hits ENTER, returning the characters they enter. Completely filtered input.

Returns:
the string entered by the user
Throws:
java.io.IOException - any exception generated during input

readlineContinue

java.lang.String readlineContinue()
                                  throws java.io.IOException,
                                         java.net.SocketException
Blocks for a short amount of time, returning an input string only if the user happens to have hit enter.

Returns:
a string entered by the user
Throws:
java.io.IOException - exceptions thrown, typically a timeout
java.net.SocketException

previousCMD

java.util.List<java.lang.String> previousCMD()
Returns a pre-parsed, pre-filtered Vector of strings representing the last command entered by the user through this session.

Returns:
a vector of strings

mob

MOB mob()
Returns the player MOB attached to this session object.

Returns:
the player MOB attached to this session object.
See Also:
setMob(MOB)

setMob

void setMob(MOB newmob)
Sets the player MOB attached to this session object.

Parameters:
newmob - the player MOB attached to this session object.
See Also:
mob()

setAccount

void setAccount(PlayerAccount account)
Sets the player acount attached to this session object.

Parameters:
account - the player account attached to this session object.
See Also:
mob()

makeEscape

java.lang.String makeEscape(int c)
Converts a character after the ^ sign (usually a color code) into an appropriate telnet escape sequence string for output.

Parameters:
c - the ^ character code
Returns:
telnet escape sequence string for output
See Also:
getColor(char), currentColor(), lastColor()

getColor

int getColor(char c)
Returns the given color code, unless it is one that translates to another, such as ?

Parameters:
c - the color code
Returns:
the color code again
See Also:
makeEscape(int), currentColor(), lastColor()

currentColor

int currentColor()
Returns the current color code.

Returns:
the current color code.
See Also:
getColor(char), makeEscape(int), lastColor()

lastColor

int lastColor()
Returns the previous current color code.

Returns:
the previous current color code.
See Also:
getColor(char), currentColor(), makeEscape(int)

getWrap

int getWrap()
Gets the column number for engine word-wrapping. 0 Means disabled.

Returns:
the wrap column

getAddress

java.lang.String getAddress()
Gets the current telnet clients ip address.

Returns:
the ip address

getStatus

int getStatus()
Gets the tick/thread status of this session object.

Returns:
the tick status
See Also:
STATUS_LOGIN

getTotalMillis

long getTotalMillis()
Gets the total milliseconds consumed by this session objects thread.

Returns:
the total milliseconds consumed

getTotalTicks

long getTotalTicks()
Gets the total number of ticks consumed by this session object thread.

Returns:
the total ticks consumed

getIdleMillis

long getIdleMillis()
Gets the number of milliseconds since a user entry was registered by this session

Returns:
the idle milliseconds passed

getMillisOnline

long getMillisOnline()
Gets the milliseconds elapsed since this user came online.

Returns:
the milliseconds online

getLastPKFight

long getLastPKFight()
Gets the milliseconds timestamp since this user last registered a pk fight.

Returns:
the last pk fight timestamp
See Also:
setLastPKFight(), setLastNPCFight()

setLastPKFight

void setLastPKFight()
Sets now as the milliseconds timestamp since this user last registered a pk fight.

See Also:
getLastPKFight(), getLastNPCFight()

getLastNPCFight

long getLastNPCFight()
Gets the milliseconds timestamp since this user last registered a npc fight.

Returns:
the last npc fight timestamp
See Also:
setLastPKFight(), setLastNPCFight()

setLastNPCFight

void setLastNPCFight()
Sets now as the milliseconds timestamp since this user last registered a npc fight.

See Also:
getLastPKFight(), getLastNPCFight()

lastLoopTime

long lastLoopTime()
Returns the last time in milliseconds that this session began its input loop. Is typically only held up by executing a user command, so it is an accurate gauge of a locked up user command.

Returns:
the last time in milliseconds that this session began its input loop
See Also:
updateLoopTime()

updateLoopTime

void updateLoopTime()
Sets the last time in milliseconds that this session began its input loop. Is typically only held up by executing a user command, so it is an accurate gauge of a locked up user command.

See Also:
lastLoopTime()

getLastMsgs

java.util.List<java.lang.String> getLastMsgs()
Returns a Vector of the last several message strings received by this user. All are already previously filtered and parsed and ready to display.

Returns:
a vector of string message strings

getTerminalType

java.lang.String getTerminalType()
Gets the terminal type the user has

Returns:
the terminal type

setServerTelnetMode

void setServerTelnetMode(int telnetCode,
                         boolean onOff)
Sets a server telnet mode flag.

Parameters:
telnetCode - the telnet code
onOff - true to turn on, false to turn off the flag
See Also:
TELNET_ANSI, serverTelnetMode(int)

serverTelnetMode

boolean serverTelnetMode(int telnetCode)
Gets a server telnet mode flag.

Parameters:
telnetCode - the telnet code
Returns:
true, if server telnet mode is on, false otherwise
See Also:
TELNET_ANSI, setServerTelnetMode(int, boolean)

setClientTelnetMode

void setClientTelnetMode(int telnetCode,
                         boolean onOff)
Sets a client telnet mode flag.

Parameters:
telnetCode - the telnet code
onOff - true to turn on, false to turn off the flag
See Also:
TELNET_ANSI, clientTelnetMode(int)

clientTelnetMode

boolean clientTelnetMode(int telnetCode)
Gets a client telnet mode flag.

Parameters:
telnetCode - the telnet code
Returns:
true, if client telnet mode is on, false otherwise
See Also:
TELNET_ANSI, setClientTelnetMode(int, boolean)

changeTelnetMode

void changeTelnetMode(int telnetCode,
                      boolean onOff)
Change telnet mode by sending the appropriate command to the clients client. A response received later will trigger mode changed.

Parameters:
telnetCode - the telnet code
onOff - true to turn on, false to turn off the flag
See Also:
TELNET_ANSI, setClientTelnetMode(int, boolean), setServerTelnetMode(int, boolean)

negotiateTelnetMode

void negotiateTelnetMode(int telnetCode)
Change telnet mode by negotiating the command to the clients client.

Parameters:
telnetCode - the telnet code
See Also:
TELNET_ANSI, setClientTelnetMode(int, boolean), setServerTelnetMode(int, boolean)

initTelnetMode

void initTelnetMode(int mobbitmap)
Initializes a telnet mode between this session and the connected client by negotiating certain fundamental flags, like ANSI, MXP, and MSP. It will use a bitmap of MOB flags passed in as a guide.

Parameters:
mobbitmap - the mobbitmap the bitmap of mob flags to use as a guide in negotiation
See Also:
MOB.getBitmap(), MOB.ATT_MXP, changeTelnetMode(int, boolean)