skadistats.clarity.event.Initializer Java Examples

The following examples show how to use skadistats.clarity.event.Initializer. 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: 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 #2
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 #3
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 #4
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 #5
Source File: InputSourceProcessor.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnPostEmbeddedMessage.class)
public void initOnPostEmbeddedMessageListener(final EventListener<OnPostEmbeddedMessage> listener) {
    listener.setParameterClasses(listener.getAnnotation().value(), BitStream.class);
    unpackUserMessages |= engineType.isUserMessage(listener.getAnnotation().value());
}
 
Example #6
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);
}
 
Example #7
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 #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(OnEntityUpdated.class)
public void initOnEntityUpdated(final EventListener<OnEntityUpdated> listener) {
    listener.setInvocationPredicate(getInvocationPredicate(listener.getAnnotation().classPattern()));
}
 
Example #10
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 #11
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 #12
Source File: Wards.java    From parser with MIT License 4 votes vote down vote up
@Initializer(OnWardKilled.class)
public void initOnWardKilled(final Context ctx, final EventListener<OnWardKilled> listener) {
    evKilled = ctx.createEvent(OnWardKilled.class, Entity.class, String.class);
}
 
Example #13
Source File: InputSourceProcessor.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnMessage.class)
public void initOnMessageListener(final EventListener<OnMessage> listener) {
    listener.setParameterClasses(listener.getAnnotation().value());
    unpackUserMessages |= engineType.isUserMessage(listener.getAnnotation().value());
}
 
Example #14
Source File: BaseStringTableEmitter.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(UsesStringTable.class)
public void initStringTableUsage(final UsagePoint<UsesStringTable> usagePoint) {
    requestedTables.add(usagePoint.getAnnotation().value());
}
 
Example #15
Source File: SpawnsAndDeaths.java    From clarity-examples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnEntityDied.class)
public void initOnEntityDied(final Context ctx, final EventListener<OnEntityDied> eventListener) {
    init(ctx);
    evDied = ctx.createEvent(OnEntityDied.class, Entity.class);
}
 
Example #16
Source File: SpawnsAndDeaths.java    From clarity-examples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnEntityDying.class)
public void initOnEntityDying(final Context ctx, final EventListener<OnEntityDying> eventListener) {
    init(ctx);
    evDying = ctx.createEvent(OnEntityDying.class, Entity.class);
}
 
Example #17
Source File: SpawnsAndDeaths.java    From clarity-examples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Initializer(OnEntitySpawned.class)
public void initOnEntitySpawned(final Context ctx, final EventListener<OnEntitySpawned> eventListener) {
    init(ctx);
    evSpawned = ctx.createEvent(OnEntitySpawned.class, Entity.class);
}
 
Example #18
Source File: Wards.java    From parser with MIT License 4 votes vote down vote up
@Initializer(OnWardPlaced.class)
public void initOnWardPlaced(final Context ctx, final EventListener<OnWardPlaced> listener) {
    evPlaced = ctx.createEvent(OnWardPlaced.class, Entity.class);
}
 
Example #19
Source File: Wards.java    From parser with MIT License 4 votes vote down vote up
@Initializer(OnWardExpired.class)
public void initOnWardExpired(final Context ctx, final EventListener<OnWardExpired> listener) {
    evExpired = ctx.createEvent(OnWardExpired.class, Entity.class);
}