|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.planet_ink.coffee_mud.Common.DefaultSession
public class DefaultSession
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected boolean |
afkFlag
|
protected java.lang.String |
afkMessage
|
protected java.lang.String[] |
clookup
|
protected java.lang.StringBuffer |
curPrevMsg
|
protected java.io.BufferedReader |
in
|
protected java.lang.StringBuffer |
input
|
protected boolean |
killFlag
|
protected java.lang.String |
lastColorStr
|
protected java.lang.String |
lastStr
|
protected boolean |
lastWasCR
|
protected boolean |
lastWasLF
|
protected MOB |
mob
|
protected boolean |
needPrompt
|
protected java.io.PrintWriter |
out
|
protected java.util.Vector |
previousCmd
|
protected java.util.Vector |
prevMsgs
|
protected java.io.OutputStream |
rawout
|
protected static int |
sessionCounter
|
protected java.util.Vector |
snoops
|
protected int |
snoopSuspensionStack
|
protected java.net.Socket |
sock
|
protected static int |
SOTIMEOUT
|
protected int |
spamStack
|
protected int |
status
|
protected boolean |
suspendCommandLine
|
protected int |
terminalHeight
|
protected java.lang.String |
terminalType
|
protected int |
terminalWidth
|
protected boolean |
waiting
|
protected long |
writeStartTime
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
DefaultSession()
|
|
| 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. |
java.lang.String |
blockingIn(long maxTime)
|
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. |
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. |
protected void |
closeSocks()
|
void |
cmdExit(MOB mob,
java.util.Vector commands)
Queries and executes the quit command for the mob. |
void |
colorOnlyPrint(java.lang.String msg)
Lower-Medium-level text output method. |
void |
colorOnlyPrint(java.lang.String msg,
int pageBreak,
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,
int pageBreak,
boolean noCache)
Lower-Medium-level text output method. |
int |
compareTo(CMObject o)
|
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. |
int |
currentColor()
Returns the current color code. |
protected void |
errorOut(java.lang.Exception t)
|
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.Vector |
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. |
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 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 |
isLockedUpWriting()
Checks whether this session is currently over its time limit trying to write data to its socket. |
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 |
logoff(boolean removeMOB,
boolean dropSession,
boolean killThread)
Force the current player to logoff. |
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. |
CMObject |
newInstance()
Returns a new instance of this class. |
int |
nonBlockingIn(boolean appendInputFlag)
|
void |
onlyPrint(java.lang.String msg)
Low level text output method. |
void |
onlyPrint(java.lang.String msg,
int pageBreak,
boolean noCache)
Low level text output method. |
void |
out(char c)
|
void |
out(char[] c)
Lowest level user-output method. |
void |
out(java.lang.String c)
|
java.util.Vector |
previousCMD()
Returns a pre-parsed, pre-filtered Vector of strings representing the last command entered by the user through this session. |
void |
print(Environmental 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(Environmental 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. |
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 |
rawPrint(java.lang.String msg,
int pageBreak)
Low level line-output method. |
void |
rawPrintln(java.lang.String msg)
Low level line-output method. |
void |
rawPrintln(java.lang.String msg,
int pageBreak)
Low level line-output method. |
int |
read()
|
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()
|
boolean |
serverTelnetMode(int telnetCode)
Gets a server telnet mode flag. |
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 |
setKillFlag(boolean truefalse)
|
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 |
setPreviousCmd(java.util.Vector 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 |
showPrompt()
|
int |
snoopSuspension(int change)
Increments or decrements the snoop suspension counter by the given amount. |
void |
startBeingSnoopedBy(Session S)
Notifies this session that the given session is snooping it. |
void |
stdPrint(Environmental 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(Environmental 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 |
stopBeingSnoopedBy(Session S)
Notifies this session that the given session is no longer snooping it. |
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 class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.planet_ink.coffee_mud.Common.interfaces.Session |
|---|
start |
| Field Detail |
|---|
protected int status
protected int snoopSuspensionStack
protected java.net.Socket sock
protected java.io.BufferedReader in
protected java.io.PrintWriter out
protected java.io.OutputStream rawout
protected MOB mob
protected boolean killFlag
protected boolean needPrompt
protected boolean afkFlag
protected java.lang.String afkMessage
protected java.lang.StringBuffer input
protected boolean waiting
protected static final int SOTIMEOUT
protected java.util.Vector previousCmd
protected java.lang.String[] clookup
protected java.lang.String lastColorStr
protected java.lang.String lastStr
protected int spamStack
protected java.util.Vector snoops
protected java.util.Vector prevMsgs
protected java.lang.StringBuffer curPrevMsg
protected boolean lastWasCR
protected boolean lastWasLF
protected boolean suspendCommandLine
protected java.lang.String terminalType
protected int terminalWidth
protected int terminalHeight
protected long writeStartTime
protected static int sessionCounter
| Constructor Detail |
|---|
public DefaultSession()
| Method Detail |
|---|
public java.lang.String ID()
CMObject
ID in interface CMObjectpublic CMObject newInstance()
CMObject
newInstance in interface CMObjectpublic void initializeClass()
CMObject
initializeClass in interface CMObjectpublic CMObject copyOf()
CMObject
copyOf in interface CMObjectpublic int compareTo(CMObject o)
compareTo in interface java.lang.Comparable<CMObject>
public void initializeSession(java.net.Socket s,
java.lang.String introTextStr)
Session
initializeSession in interface Sessions - the socket the user connected fromintroTextStr - introductory text string (Hello!)
public void setServerTelnetMode(int telnetCode,
boolean onOff)
Session
setServerTelnetMode in interface SessiontelnetCode - the telnet codeonOff - true to turn on, false to turn off the flagSession.TELNET_ANSI,
Session.serverTelnetMode(int)public boolean serverTelnetMode(int telnetCode)
Session
serverTelnetMode in interface SessiontelnetCode - the telnet code
Session.TELNET_ANSI,
Session.setServerTelnetMode(int, boolean)
public void setClientTelnetMode(int telnetCode,
boolean onOff)
Session
setClientTelnetMode in interface SessiontelnetCode - the telnet codeonOff - true to turn on, false to turn off the flagSession.TELNET_ANSI,
Session.clientTelnetMode(int)public boolean clientTelnetMode(int telnetCode)
Session
clientTelnetMode in interface SessiontelnetCode - the telnet code
Session.TELNET_ANSI,
Session.setClientTelnetMode(int, boolean)
public void changeTelnetMode(int telnetCode,
boolean onOff)
Session
changeTelnetMode in interface SessiontelnetCode - the telnet codeonOff - true to turn on, false to turn off the flagSession.TELNET_ANSI,
Session.setClientTelnetMode(int, boolean),
Session.setServerTelnetMode(int, boolean)
public void changeTelnetModeBackwards(int telnetCode,
boolean onOff)
public void changeTelnetModeBackwards(java.io.OutputStream out,
int telnetCode,
boolean onOff)
throws java.io.IOException
java.io.IOExceptionpublic void negotiateTelnetMode(int telnetCode)
Session
negotiateTelnetMode in interface SessiontelnetCode - the telnet codeSession.TELNET_ANSI,
Session.setClientTelnetMode(int, boolean),
Session.setServerTelnetMode(int, boolean)public void initTelnetMode(int mobbitmap)
Session
initTelnetMode in interface Sessionmobbitmap - the mobbitmap the bitmap of mob flags to use as a guide in negotiationMOB.getBitmap(),
MOB.ATT_MXP,
Session.changeTelnetMode(int, boolean)public int currentColor()
Session
currentColor in interface SessionSession.getColor(char),
Session.makeEscape(int),
Session.lastColor()public int lastColor()
Session
lastColor in interface SessionSession.getColor(char),
Session.currentColor(),
Session.makeEscape(int)public long getTotalMillis()
Session
getTotalMillis in interface Sessionpublic long getIdleMillis()
Session
getIdleMillis in interface Sessionpublic long getTotalTicks()
Session
getTotalTicks in interface Sessionpublic long getMillisOnline()
Session
getMillisOnline in interface Sessionpublic long lastLoopTime()
Session
lastLoopTime in interface Sessionpublic long getLastPKFight()
Session
getLastPKFight in interface SessionSession.setLastPKFight(),
Session.setLastNPCFight()public void setLastPKFight()
Session
setLastPKFight in interface SessionSession.getLastPKFight(),
Session.getLastNPCFight()public long getLastNPCFight()
Session
getLastNPCFight in interface SessionSession.setLastPKFight(),
Session.setLastNPCFight()public void setLastNPCFight()
Session
setLastNPCFight in interface SessionSession.getLastPKFight(),
Session.getLastNPCFight()public java.util.Vector getLastMsgs()
Session
getLastMsgs in interface Sessionpublic java.lang.String getTerminalType()
Session
getTerminalType in interface Sessionpublic MOB mob()
Session
mob in interface SessionSession.setMob(MOB)public void setMob(MOB newmob)
Session
setMob in interface Sessionnewmob - the player MOB attached to this session object.Session.mob()public int getWrap()
Session
getWrap in interface Sessionpublic boolean killFlag()
Session
killFlag in interface SessionSession.logoff(boolean, boolean, boolean),
Session.cmdExit(MOB, Vector),
Session.killFlag()public void setKillFlag(boolean truefalse)
public java.util.Vector previousCMD()
Session
previousCMD in interface Sessionpublic void startBeingSnoopedBy(Session S)
Session
startBeingSnoopedBy in interface SessionS - the session to snoop on me.Session.startBeingSnoopedBy(Session),
Session.stopBeingSnoopedBy(Session),
Session.amBeingSnoopedBy(Session),
Session.snoopSuspension(int)public void stopBeingSnoopedBy(Session S)
Session
stopBeingSnoopedBy in interface SessionS - the session to stop snooping on me.Session.startBeingSnoopedBy(Session),
Session.stopBeingSnoopedBy(Session),
Session.amBeingSnoopedBy(Session),
Session.snoopSuspension(int)public boolean amBeingSnoopedBy(Session S)
Session
amBeingSnoopedBy in interface SessionS - the session to check for a snoop on me.
Session.startBeingSnoopedBy(Session),
Session.stopBeingSnoopedBy(Session),
Session.amBeingSnoopedBy(Session),
Session.snoopSuspension(int)public int snoopSuspension(int change)
Session
snoopSuspension in interface Sessionchange - the amount to change the snoop suspension counter by
Session.startBeingSnoopedBy(Session),
Session.stopBeingSnoopedBy(Session),
Session.amBeingSnoopedBy(Session),
Session.snoopSuspension(int)public void setPreviousCmd(java.util.Vector cmds)
public boolean afkFlag()
Session
afkFlag in interface SessionSession.setAfkFlag(boolean),
Session.setAFKMessage(String)public void setAfkFlag(boolean truefalse)
Session
setAfkFlag in interface Sessiontruefalse - true if they are AFK, false otherwiseSession.afkFlag(),
Session.afkMessage()public java.lang.String afkMessage()
Session
afkMessage in interface SessionSession.setAfkFlag(boolean),
Session.setAFKMessage(String)public void setAFKMessage(java.lang.String str)
Session
setAFKMessage in interface Sessionstr - the reason given by the user that they are AFK.Session.setAfkFlag(boolean),
Session.afkMessage()protected void errorOut(java.lang.Exception t)
public long getWriteStartTime()
public boolean isLockedUpWriting()
Session
isLockedUpWriting in int