CMObject
, Tickable
, ChannelsLibrary
, CMLibrary
, java.lang.Cloneable
, java.lang.Comparable<CMObject>
public class CMChannels extends StdLibrary implements ChannelsLibrary
ChannelsLibrary.ChannelFlag, ChannelsLibrary.ChannelMsg, ChannelsLibrary.CMChannel
Modifier and Type | Field | Description |
---|---|---|
java.lang.String[] |
baseChannelNames |
|
java.util.List<ChannelsLibrary.CMChannel> |
channelList |
|
protected Language |
commonLang |
|
static java.util.Set<ChannelsLibrary.ChannelFlag> |
emptyFlags |
|
static java.util.List<ChannelsLibrary.ChannelMsg> |
emptyQueue |
|
int |
QUEUE_SIZE |
idConverter
isDebugging, name, serviceClient, tickStatus
STATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BALLISTICK, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EVENT, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SHORTERMASK, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
Constructor | Description |
---|---|
CMChannels() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
activate() |
Activates the library.
|
void |
channelQueUp(int channelNumber,
CMMsg msg,
int subNameField) |
Adds the given channel message CMMsg event message to the que for the given
channel number.
|
protected java.util.Enumeration<ChannelsLibrary.CMChannel> |
channels() |
|
java.util.List<Session> |
clearInvalidSnoopers(Session mySession,
int channelCode) |
Searches all users online for any sessions that are snooping on the
given session, and also are not permitted to read the given channel
number.
|
protected java.util.List<ChannelsLibrary.ChannelMsg> |
convertBackLogEntries(MOB mob,
ChannelsLibrary.CMChannel channel,
int subNameField,
java.util.List<Triad<java.lang.String,java.lang.Integer,java.lang.Long>> backLog) |
|
void |
createAndSendChannelMessage(MOB mob,
java.lang.String channelName,
java.lang.String message,
boolean systemMsg) |
Creates and sends the given string message on the channel with the given name to all sessions who are
allowed to receive the message from the given sender.
|
ChannelsLibrary.CMChannel |
createNewChannel(java.lang.String name) |
|
ChannelsLibrary.CMChannel |
createNewChannel(java.lang.String name,
java.lang.String i3Name,
java.lang.String imc2Name,
java.lang.String mask,
java.util.Set<ChannelsLibrary.ChannelFlag> flags,
java.lang.String colorOverrideANSI,
java.lang.String colorOverrideWords) |
Creates a new channel object.
|
ChannelsLibrary.CMChannel |
createNewChannel(java.lang.String name,
java.lang.String mask,
java.util.Set<ChannelsLibrary.ChannelFlag> flags,
java.lang.String colorOverrideANSI,
java.lang.String colorOverrideWords) |
|
java.lang.String |
findChannelName(java.lang.String channelName) |
Returns the official channel name of the channel with the
given name or which starts with the given name.
|
ChannelsLibrary.CMChannel |
getChannel(int channelNumber) |
Returns the CMChannel object for the given
registered channel from 0 - getNumChannels();
Basically this is almost all you need, but
there's more....
|
ChannelsLibrary.CMChannel |
getChannel(java.lang.String channelName) |
Returns the official channel object of the channel with the
given name.
|
int |
getChannelCodeNumber(java.lang.String channelName) |
Returns the bitmask appropriate to the channel of the given
name, or which starts with the given string.
|
int |
getChannelIndex(java.lang.String channelName) |
Returns the official index number of the channel with the
given name or which starts with the given name.
|
java.lang.String[] |
getChannelNames() |
Returns an array of all the names of all the channels.
|
java.util.List<ChannelsLibrary.ChannelMsg> |
getChannelQue(int channelNumber,
int numNewToSkip,
int numToReturn,
MOB mob) |
Generates a list of previous channel messages, in ChannelMsg
object format.
|
int |
getChannelQueIndex(int channelNumber,
MOB mob,
long oldestDateMs) |
Returns the lowest page index to messages in the given channel after the given date
|
int |
getChannelQuePageEnd(int channelNumber,
MOB mob) |
Returns the highest page index for messages in the given channel, for the given reader.
|
protected Language |
getCommonLanguage() |
|
protected int |
getExtraChannelDataField(MOB mob,
ChannelsLibrary.CMChannel chan) |
|
protected int[] |
getExtraChannelDataFields(MOB mob,
ChannelsLibrary.CMChannel chan) |
|
java.lang.String |
getExtraChannelDesc(java.lang.String channelName) |
Returns the friendly readable description of the channel
with the given name, or which starts with the given string.
|
java.util.List<java.lang.String> |
getFlaggedChannelNames(ChannelsLibrary.ChannelFlag flag,
MOB mob) |
Returns the list of channel names that have the given
ChannelFlag set.
|
java.util.List<ChannelsLibrary.CMChannel> |
getI3ChannelsList() |
Returns all the CMChannel objects for any channels flagged
as being mapped to I3.
|
java.util.List<ChannelsLibrary.CMChannel> |
getIMC2ChannelsList() |
Returns all the CMChannel objects for any channels flagged
as being mapped to IMC2.
|
int |
getNumChannels() |
Returns the number of registered channels
|
java.lang.String |
ID() |
The CoffeeMud Java Class ID shared by all instances of
this object.
|
int |
loadChannels(java.lang.String list,
java.lang.String ilist,
java.lang.String imc2list) |
Clears the channels list and then reloads it from the three given comma-delimited
list of coded strings.
|
boolean |
mayReadThisChannel(MOB sender,
boolean areaReq,
Session ses,
int channelNumber) |
Returns whether the given Mob can read a channel message from the given sender, on
a particular channel.
|
boolean |
mayReadThisChannel(MOB sender,
boolean areaReq,
MOB M,
int channelNumber) |
Returns whether the given Mob can read a channel message from the given sender, on
a particular channel.
|
boolean |
mayReadThisChannel(MOB sender,
boolean areaReq,
MOB M,
int channelNumber,
boolean offlineOK) |
Returns whether the given Mob can read a channel message from the given sender, on
a particular channel.
|
boolean |
mayReadThisChannel(MOB M,
int channelNumber,
boolean zapCheckOnly) |
Returns whether the given Mob can read a channel message from the given sender, on
a particular channel.
|
java.lang.String |
parseOutFlags(java.lang.String mask,
java.util.Set<ChannelsLibrary.ChannelFlag> flags,
java.lang.String[] colorOverride) |
|
void |
restoreInvalidSnoopers(Session mySession,
java.util.List<Session> invalid) |
Iterates through the given list of sessions and forces them all to snoop on
the given session.
|
java.util.List<ChannelsLibrary.ChannelMsg> |
searchChannelQue(MOB mob,
int channelNumber,
java.lang.String srchTerms,
int maxReturn) |
Searches the list of previous channel messages, in ChannelMsg
object format.
|
boolean |
sendChannelCMMsgTo(Session ses,
boolean areareq,
int channelInt,
CMMsg msg,
MOB sender) |
Sends the given channel message from the given sender to the given session on the
given channelNumbered channel.
|
boolean |
shutdown() |
Shuts down the library.
|
boolean |
tick(Tickable ticking,
int tickID) |
this is the method which is called periodically by the threading engine.
|
getServiceClient, L, propertiesLoaded
copyOf, initializeClass, name, newInstance
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkDatabase, compareTo, copyOf, getServiceClient, getTickStatus, initializeClass, L, name, newInstance, propertiesLoaded, setThreadStatus
public final int QUEUE_SIZE
public java.lang.String[] baseChannelNames
public java.util.List<ChannelsLibrary.CMChannel> channelList
protected Language commonLang
public static final java.util.List<ChannelsLibrary.ChannelMsg> emptyQueue
public static final java.util.Set<ChannelsLibrary.ChannelFlag> emptyFlags
public java.lang.String ID()
CMObject
ID
in interface CMObject
ID
in class StdLibrary
public int getNumChannels()
ChannelsLibrary
getNumChannels
in interface ChannelsLibrary
ChannelsLibrary.getChannelIndex(String)
protected java.util.Enumeration<ChannelsLibrary.CMChannel> channels()
public ChannelsLibrary.CMChannel getChannel(int channelNumber)
ChannelsLibrary
getChannel
in interface ChannelsLibrary
channelNumber
- the index of the channelChannelsLibrary.getNumChannels()
public ChannelsLibrary.CMChannel createNewChannel(java.lang.String name)
public ChannelsLibrary.CMChannel createNewChannel(java.lang.String name, java.lang.String mask, java.util.Set<ChannelsLibrary.ChannelFlag> flags, java.lang.String colorOverrideANSI, java.lang.String colorOverrideWords)
public ChannelsLibrary.CMChannel createNewChannel(java.lang.String name, java.lang.String i3Name, java.lang.String imc2Name, java.lang.String mask, java.util.Set<ChannelsLibrary.ChannelFlag> flags, java.lang.String colorOverrideANSI, java.lang.String colorOverrideWords)
ChannelsLibrary
createNewChannel
in interface ChannelsLibrary
name
- the channel namei3Name
- empty string, or the mapped name of the i3 channelimc2Name
- empty string, or the mapped name of the imc2 channelmask
- the zapper mask for who may read the channelflags
- the channel flags to set for the given channelcolorOverrideANSI
- empty string for default, or the color code for this channelcolorOverrideWords
- empty string for default, or the color code for this channelChannelsLibrary.CMChannel
,
ChannelsLibrary.ChannelFlag
public int getChannelQuePageEnd(int channelNumber, MOB mob)
ChannelsLibrary
getChannelQuePageEnd
in interface ChannelsLibrary
channelNumber
- the channel id number/indexmob
- the channel readerChannelsLibrary.getChannelIndex(String)
,
ChannelsLibrary.ChannelMsg
,
ChannelsLibrary.getChannelQue(int, int, int, MOB)
public int getChannelQueIndex(int channelNumber, MOB mob, long oldestDateMs)
ChannelsLibrary
getChannelQueIndex
in interface ChannelsLibrary
channelNumber
- the channel id number/indexmob
- the channel readeroldestDateMs
- the oldest date timestamppublic java.util.List<ChannelsLibrary.ChannelMsg> searchChannelQue(MOB mob, int channelNumber, java.lang.String srchTerms, int maxReturn)
ChannelsLibrary
searchChannelQue
in interface ChannelsLibrary
mob
- the channel readerchannelNumber
- the channel id number/indexsrchTerms
- the string to search formaxReturn
- max number of messages to returnChannelsLibrary.getChannelIndex(String)
,
ChannelsLibrary.ChannelMsg
,
ChannelsLibrary.getChannelQuePageEnd(int, MOB)
protected java.util.List<ChannelsLibrary.ChannelMsg> convertBackLogEntries(MOB mob, ChannelsLibrary.CMChannel channel, int subNameField, java.util.List<Triad<java.lang.String,java.lang.Integer,java.lang.Long>> backLog)
public java.util.List<ChannelsLibrary.ChannelMsg> getChannelQue(int channelNumber, int numNewToSkip, int numToReturn, MOB mob)
ChannelsLibrary
getChannelQue
in interface ChannelsLibrary
channelNumber
- the channel id number/indexnumNewToSkip
- starting message number (0 based)numToReturn
- total number of messages to returnmob
- the channel readerChannelsLibrary.getChannelIndex(String)
,
ChannelsLibrary.ChannelMsg
,
ChannelsLibrary.getChannelQuePageEnd(int, MOB)
public boolean mayReadThisChannel(MOB sender, boolean areaReq, MOB M, int channelNumber)
ChannelsLibrary
mayReadThisChannel
in interface ChannelsLibrary
sender
- the sender of the channel messageareaReq
- true if the message can only be read by someone in the senders AreaM
- the potential receiver of the message to confirmchannelNumber
- the channel index numberChannelsLibrary.getNumChannels()
,
ChannelsLibrary.mayReadThisChannel(MOB, int, boolean)
,
ChannelsLibrary.mayReadThisChannel(MOB, boolean, Session, int)
,
ChannelsLibrary.mayReadThisChannel(MOB, boolean, MOB, int, boolean)
public boolean mayReadThisChannel(MOB sender, boolean areaReq, MOB M, int channelNumber, boolean offlineOK)
ChannelsLibrary
mayReadThisChannel
in interface ChannelsLibrary
sender
- the sender of the channel messageareaReq
- true if the message can only be read by someone in the senders AreaM
- the potential receiver of the message to confirmchannelNumber
- the channel index numberofflineOK
- true if the channel reader can be read, or offline, false if they must be onlineChannelsLibrary.getChannelIndex(String)
,
ChannelsLibrary.mayReadThisChannel(MOB, int, boolean)
,
ChannelsLibrary.mayReadThisChannel(MOB, boolean, Session, int)
,
ChannelsLibrary.mayReadThisChannel(MOB, boolean, MOB, int)
public boolean mayReadThisChannel(MOB sender, boolean areaReq, Session ses, int channelNumber)
ChannelsLibrary
mayReadThisChannel
in interface ChannelsLibrary
sender
- the sender of the channel messageareaReq
- true if the message can only be read by someone in the senders Areases
- the potential receiver session of the message to confirmchannelNumber
- the channel index numberChannelsLibrary.getNumChannels()
,
ChannelsLibrary.mayReadThisChannel(MOB, int, boolean)
,
ChannelsLibrary.mayReadThisChannel(MOB, boolean, MOB, int)
,
ChannelsLibrary.mayReadThisChannel(MOB, boolean, MOB, int, boolean)
public boolean mayReadThisChannel(MOB M, int channelNumber, boolean zapCheckOnly)
ChannelsLibrary
mayReadThisChannel
in interface ChannelsLibrary
M
- the potential receiver of the message to confirmchannelNumber
- the channel index numberzapCheckOnly
- the channel index numberChannelsLibrary.getChannelIndex(String)
,
ChannelsLibrary.mayReadThisChannel(MOB, boolean, MOB, int)
,
ChannelsLibrary.mayReadThisChannel(MOB, boolean, Session, int)
,
ChannelsLibrary.mayReadThisChannel(MOB, boolean, MOB, int, boolean)
public void channelQueUp(int channelNumber, CMMsg msg, int subNameField)
ChannelsLibrary
channelQueUp
in interface ChannelsLibrary
channelNumber
- the channel index numbermsg
- the channel message msg that was sent aroundsubNameField
- extra audience data for the given new messageChannelsLibrary.getNumChannels()
,
ChannelsLibrary.getChannelIndex(String)
public int getChannelIndex(java.lang.String channelName)
ChannelsLibrary
getChannelIndex
in interface ChannelsLibrary
channelName
- the channel string to search forChannelsLibrary.getNumChannels()
public int getChannelCodeNumber(java.lang.String channelName)
ChannelsLibrary
getChannelCodeNumber
in interface ChannelsLibrary
channelName
- the name of the channelpublic java.lang.String findChannelName(java.lang.String channelName)
ChannelsLibrary
findChannelName
in interface ChannelsLibrary
channelName
- the channel string to search forChannelsLibrary.getNumChannels()
public ChannelsLibrary.CMChannel getChannel(java.lang.String channelName)
ChannelsLibrary
getChannel
in interface ChannelsLibrary
channelName
- the channel string to search forChannelsLibrary.getNumChannels()
public java.util.List<java.lang.String> getFlaggedChannelNames(ChannelsLibrary.ChannelFlag flag, MOB mob)
ChannelsLibrary
getFlaggedChannelNames
in interface ChannelsLibrary
flag
- the flag to find channels formob
- the mob whose privacy flag to respect, or nullChannelsLibrary.ChannelFlag
public java.lang.String getExtraChannelDesc(java.lang.String channelName)
ChannelsLibrary
getExtraChannelDesc
in interface ChannelsLibrary
channelName
- the name of the channelpublic java.util.List<ChannelsLibrary.CMChannel> getIMC2ChannelsList()
ChannelsLibrary
getIMC2ChannelsList
in interface ChannelsLibrary
public java.util.List<ChannelsLibrary.CMChannel> getI3ChannelsList()
ChannelsLibrary
getI3ChannelsList
in interface ChannelsLibrary
public java.lang.String[] getChannelNames()
ChannelsLibrary
getChannelNames
in interface ChannelsLibrary
ChannelsLibrary.getNumChannels()
public java.util.List<Session> clearInvalidSnoopers(Session mySession, int channelCode)
ChannelsLibrary
clearInvalidSnoopers
in interface ChannelsLibrary
mySession
- the session to search for snoopers ofchannelCode
- the channel number to cross reference snoopers byChannelsLibrary.getNumChannels()
,
ChannelsLibrary.restoreInvalidSnoopers(Session, List)
public void restoreInvalidSnoopers(Session mySession, java.util.List<Session> invalid)
ChannelsLibrary
restoreInvalidSnoopers
in interface ChannelsLibrary
mySession
- the session to search restoring snooping oninvalid
- the list of sessions to force resnoopingChannelsLibrary.clearInvalidSnoopers(Session, int)
public java.lang.String parseOutFlags(java.lang.String mask, java.util.Set<ChannelsLibrary.ChannelFlag> flags, java.lang.String[] colorOverride)
public int loadChannels(java.lang.String list, java.lang.String ilist, java.lang.String imc2list)
ChannelsLibrary
loadChannels
in interface ChannelsLibrary
list
- the main game channel listilist
- the list of i3 channelsimc2list
- the list of imc2 channelspublic boolean sendChannelCMMsgTo(Session ses, boolean areareq, int channelInt, CMMsg msg, MOB sender)
ChannelsLibrary
sendChannelCMMsgTo
in interface ChannelsLibrary
ses
- the session to send the channel message toareareq
- true if the sender and session must be in the same area, false otherwisechannelInt
- the channel index number of the messagemsg
- the constructed CMMsg channel messagesender
- the sender of the channel messageChannelsLibrary.getNumChannels()
,
ChannelsLibrary.createAndSendChannelMessage(MOB, String, String, boolean)
protected int[] getExtraChannelDataFields(MOB mob, ChannelsLibrary.CMChannel chan)
protected int getExtraChannelDataField(MOB mob, ChannelsLibrary.CMChannel chan)
public void createAndSendChannelMessage(MOB mob, java.lang.String channelName, java.lang.String message, boolean systemMsg)
ChannelsLibrary
createAndSendChannelMessage
in interface ChannelsLibrary
mob
- the sender of the messagechannelName
- the name of the channel to send the message onmessage
- the string message to send on the channelsystemMsg
- true to format as a system message, false for a normal chat messageChannelsLibrary.sendChannelCMMsgTo(Session, boolean, int, CMMsg, MOB)
protected Language getCommonLanguage()
public boolean activate()
CMLibrary
activate
in interface CMLibrary
activate
in class StdLibrary
CMLibrary.shutdown()
public boolean tick(Tickable ticking, int tickID)
Tickable
tick
in interface Tickable
tick
in class StdLibrary
ticking
- a reference to this Tickable objecttickID
- the TICKID_ constant describing this periodic call, as defined in TickableTickable
,
ServiceEngine
,
TickableGroup
public boolean shutdown()
CMLibrary
shutdown
in interface CMLibrary
shutdown
in class StdLibrary
CMLibrary.activate()