public abstract class BotBehaviour
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Set<EventListener> |
activeListeners |
protected EventListenerContext |
context |
protected java.util.Set<CoordinationBehaviour> |
coordinationBehaviours |
protected org.slf4j.Logger |
logger |
protected java.lang.String |
name |
| Constructor and Description |
|---|
BotBehaviour(EventListenerContext context) |
BotBehaviour(EventListenerContext context,
java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
Activates the behaviour without passing a message object.
|
void |
activate(java.util.Optional<java.lang.Object> message)
Activates the behaviour by registering listeners.
|
void |
deactivate()
Deactivates the behaviour without passing a message.
|
void |
deactivate(java.util.Optional<java.lang.Object> message)
Deactivates the behaviour.
|
java.lang.String |
getName() |
boolean |
isActive() |
protected abstract void |
onActivate(java.util.Optional<java.lang.Object> message)
Activates the behaviour by registering listeners, if you addListeners with the subscribeWithAutoCleanup method, you
do not have to clean them within the onCleanup method.
|
void |
onActivateActivate(BotBehaviour... nextBehaviours) |
void |
onActivateDeactivate(BotBehaviour... nextBehaviours) |
protected void |
onCleanup()
Deactivates the behaviour.
|
void |
onDeactivateActivate(BotBehaviour... nextBehaviours) |
void |
onDeactivateDeactivate(BotBehaviour... nextBehaviours) |
protected <T extends Event> |
subscribeWithAutoCleanup(java.lang.Class<T> eventClazz,
EventListener listener)
Subscribes an Event/EventListener Pair, that will be automatically cleaned within the deactivate process of this
behaviour.
|
protected final org.slf4j.Logger logger
protected final java.lang.String name
protected final EventListenerContext context
protected java.util.Set<EventListener> activeListeners
protected java.util.Set<CoordinationBehaviour> coordinationBehaviours
public BotBehaviour(EventListenerContext context)
public BotBehaviour(EventListenerContext context, java.lang.String name)
public void onDeactivateActivate(BotBehaviour... nextBehaviours)
public void onActivateActivate(BotBehaviour... nextBehaviours)
public void onDeactivateDeactivate(BotBehaviour... nextBehaviours)
public void onActivateDeactivate(BotBehaviour... nextBehaviours)
public final void activate()
public final void activate(java.util.Optional<java.lang.Object> message)
public final void deactivate()
public final void deactivate(java.util.Optional<java.lang.Object> message)
protected <T extends Event> void subscribeWithAutoCleanup(java.lang.Class<T> eventClazz, EventListener listener)
protected void onCleanup()
protected abstract void onActivate(java.util.Optional<java.lang.Object> message)
public java.lang.String getName()
public boolean isActive()
Copyright © 2018. All Rights Reserved.