Skip to content
Snippets Groups Projects
Commit 9cf0009a authored by Alexis Durgnat's avatar Alexis Durgnat :milky_way:
Browse files

Headers

parent 74f06583
No related branches found
No related tags found
1 merge request!21*poof* final version
......@@ -56,42 +56,76 @@ public class MessageManager extends MessageQueue {
/**
* Subscribe to all JoinedJourney events
* @param eventHandler Journey consumer
* @param eventHandler JoinedJourney consumer
*/
public void subscribeJoinedJourney(Consumer<JoinedJourney> eventHandler) {
this.conditionalSubscribeJoinedJourney(eventHandler, (event) -> true);
}
/**
* Subscribe to all LeftJourney events
* @param eventHandler LeftJourney consumer
*/
public void subscribeLeftJourney(Consumer<LeftJourney> eventHandler) {
this.conditionalSubscribeLeftJourney(eventHandler, (event) -> true);
}
/**
* Subscribe to JoinedJourney events validating the condition
* @param eventHandler JoinedJourney consumer
* @param condition JoinedJourney predicate
*/
public void conditionalSubscribeJoinedJourney(Consumer<JoinedJourney> eventHandler,
Predicate<JoinedJourney> condition) {
this.conditionalSubscribe(Message.Type.JoinedJourney, eventHandler, condition);
}
/**
* Subscribe to LeftJourney events validating the condition
* @param eventHandler LeftJourney consumer
* @param condition LeftJourney predicate
*/
public void conditionalSubscribeLeftJourney(Consumer<LeftJourney> eventHandler, Predicate<LeftJourney> condition) {
this.conditionalSubscribe(Message.Type.LeftJourney, eventHandler, condition);
}
/**
* Send a JoinedJourney event
* @param event JoinedJourney event
*/
public void sendJoinedJourney(JoinedJourney event) {
this.sendEvent(Message.Type.JoinedJourney, event);
}
/**
* Send a LeftJourney event
* @param event LeftJourney event
*/
public void sendLeftJourney(LeftJourney event) {
this.sendEvent(Message.Type.LeftJourney, event);
}
/**
* Subscribe to all ChatMessage events
* @param eventHandler ChatMessage consumer
*/
public void subscribeChatMessage(Consumer<ChatMessage> eventHandler) {
this.conditionalSubscribeChatMessage(eventHandler, (event) -> true);
}
/**
* Subscribe to ChatMessage events validating the condition
* @param eventHandler ChatMessage consumer
* @param condition ChatMessage predicate
*/
public void conditionalSubscribeChatMessage(Consumer<ChatMessage> eventHandler, Predicate<ChatMessage> condition) {
this.conditionalSubscribe(Message.Type.ChatMessage, eventHandler, condition);
}
/**
* Send a ChatMessage event
* @param event ChatMessage event
*/
public void sendChatMessage(ChatMessage event) {
this.sendEvent(Message.Type.ChatMessage, event);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment