public abstract class AbstractMutableMessageChannel extends Object implements MutableMessageChannel
MutableMessageChannel
.Modifier and Type | Field and Description |
---|---|
protected Collection<MessageReceiver> |
members |
TO_ALL, TO_CONSOLE, TO_NONE, TO_PLAYERS
Modifier | Constructor and Description |
---|---|
protected |
AbstractMutableMessageChannel()
The default implementation uses a
WeakHashMap implementation of Set . |
protected |
AbstractMutableMessageChannel(Collection<MessageReceiver> members)
Creates a new instance of
AbstractMutableMessageChannel with the
provided Collection as the underlying member list. |
Modifier and Type | Method and Description |
---|---|
boolean |
addMember(MessageReceiver member)
Adds a member to this channel.
|
void |
clearMembers()
Removes all of the members from this channel.
|
Collection<MessageReceiver> |
getMembers()
Gets a collection of all members in this channel.
|
boolean |
removeMember(MessageReceiver member)
Removes a member from this channel.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asMutable
combined, combined, fixed, fixed, permission, send, send, send, send, transformMessage, world
protected final Collection<MessageReceiver> members
protected AbstractMutableMessageChannel()
WeakHashMap
implementation of Set
.protected AbstractMutableMessageChannel(Collection<MessageReceiver> members)
AbstractMutableMessageChannel
with the
provided Collection
as the underlying member list.
The passed Collection
directly affects the members of this
channel.
It is recommended to use a weak collection to avoid memory leaks. If you do not use a weak collection, please ensure that members are cleaned up properly.
members
- The collection of memberspublic boolean addMember(MessageReceiver member)
MutableMessageChannel
addMember
in interface MutableMessageChannel
member
- The member to addtrue
if this channel did not already contain the memberpublic boolean removeMember(MessageReceiver member)
MutableMessageChannel
removeMember
in interface MutableMessageChannel
member
- The member to removetrue
if this channel contained the specified memberpublic void clearMembers()
MutableMessageChannel
clearMembers
in interface MutableMessageChannel
public Collection<MessageReceiver> getMembers()
MessageChannel
getMembers
in interface MessageChannel