Java Code Examples for skadistats.clarity.event.EventListener#setInvocationPredicate()

The following examples show how to use skadistats.clarity.event.EventListener#setInvocationPredicate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseStringTableEmitter.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Initializer(OnStringTableEntry.class)
public void initStringTableEntryEvent(final EventListener<OnStringTableEntry> eventListener) {
    final String tableName = eventListener.getAnnotation().value();
    requestedTables.add(tableName);
    if ("*".equals(tableName)) {
        updateEventTables = requestedTables;
    } else {
        updateEventTables.add(tableName);
    }
    eventListener.setInvocationPredicate(args -> {
        StringTable t = (StringTable) args[0];
        return "*".equals(tableName) || t.getName().equals(tableName);
    });
}
 
Example 2
Source File: InputSourceProcessor.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Initializer(OnMessageContainer.class)
public void initOnMessageContainerListener(final EventListener<OnMessageContainer> listener) {
    listener.setInvocationPredicate(args -> {
        Class<? extends GeneratedMessage> clazz = (Class<? extends GeneratedMessage>) args[0];
        return listener.getAnnotation().value().isAssignableFrom(clazz);
    });
}
 
Example 3
Source File: GameEvents.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Initializer(OnGameEventDescriptor.class)
public void initOnGameEventDescriptor(final EventListener<OnGameEventDescriptor> eventListener) {
    eventListener.setInvocationPredicate(args -> {
        String v = eventListener.getAnnotation().value();
        GameEventDescriptor ev = (GameEventDescriptor) args[0];
        return v.length() == 0 || v.equals(ev.getName());
    });
}
 
Example 4
Source File: GameEvents.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Initializer(OnGameEvent.class)
public void initOnGameEvent(final EventListener<OnGameEvent> eventListener) {
    eventListener.setInvocationPredicate(args -> {
        String v = eventListener.getAnnotation().value();
        GameEvent ev = (GameEvent) args[0];
        return v.length() == 0 || v.equals(ev.getName());
    });
}
 
Example 5
Source File: Entities.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnEntityCreated.class)
public void initOnEntityCreated(final EventListener<OnEntityCreated> listener) {
    listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern()));
}
 
Example 6
Source File: Entities.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnEntityDeleted.class)
public void initOnEntityDeleted(final EventListener<OnEntityDeleted> listener) {
    listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern()));
}
 
Example 7
Source File: Entities.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnEntityUpdated.class)
public void initOnEntityUpdated(final EventListener<OnEntityUpdated> listener) {
    listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern()));
}
 
Example 8
Source File: Entities.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnEntityEntered.class)
public void initOnEntityEntered(final EventListener<OnEntityEntered> listener) {
    listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern()));
}
 
Example 9
Source File: Entities.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnEntityLeft.class)
public void initOnEntityLeft(final EventListener<OnEntityLeft> listener) {
    listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern()));
}
 
Example 10
Source File: PropertyChange.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnEntityPropertyChanged.class)
public void initListener(final EventListener<OnEntityPropertyChanged> listener) {
    ListenerAdapter adapter = new ListenerAdapter(listener);
    adapters.add(adapter);
    listener.setInvocationPredicate(adapter.invocationPredicate);
}