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 Project: clarity   Author: skadistats   File: BaseStringTableEmitter.java    License: 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 Project: clarity   Author: skadistats   File: InputSourceProcessor.java    License: 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 Project: clarity   Author: skadistats   File: GameEvents.java    License: 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 Project: clarity   Author: skadistats   File: GameEvents.java    License: 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 Project: parser   Author: odota   File: Wards.java    License: 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 #6
Source Project: parser   Author: odota   File: Wards.java    License: 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);
}
 
Example #7
Source Project: parser   Author: odota   File: Wards.java    License: 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 #8
Source Project: clarity-examples   Author: skadistats   File: SpawnsAndDeaths.java    License: 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 #9
Source Project: clarity-examples   Author: skadistats   File: SpawnsAndDeaths.java    License: 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 #10
Source Project: clarity-examples   Author: skadistats   File: SpawnsAndDeaths.java    License: 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 #11
Source Project: clarity   Author: skadistats   File: BaseStringTableEmitter.java    License: 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 #12
Source Project: clarity   Author: skadistats   File: InputSourceProcessor.java    License: 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 #13
Source Project: clarity   Author: skadistats   File: InputSourceProcessor.java    License: 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 #14
Source Project: clarity   Author: skadistats   File: Entities.java    License: 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 #15
Source Project: clarity   Author: skadistats   File: Entities.java    License: 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 #16
Source Project: clarity   Author: skadistats   File: Entities.java    License: 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 #17
Source Project: clarity   Author: skadistats   File: Entities.java    License: 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 #18
Source Project: clarity   Author: skadistats   File: Entities.java    License: 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 #19
Source Project: clarity   Author: skadistats   File: PropertyChange.java    License: 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);
}