de.gurkenlabs.litiengine.entities.TriggerActivatingCondition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of litiengine Show documentation
Show all versions of litiengine Show documentation
The FOSS 2D Java game engine.
The newest version!
package de.gurkenlabs.litiengine.entities;
import java.util.EventListener;
/**
* This listener provides a callback that allows to check conditions for activating a {@code
* Trigger} and prevent the activation if necessary.
*/
@FunctionalInterface
public interface TriggerActivatingCondition extends EventListener {
/**
* Allows to register functions that contain additional checks for the trigger activation. The return value of the
* function is considered the reason why the trigger cannot be activated. If the function returns anything else than
* null, the activation is cancelled and the result of the function is send to the activator entity.
*
* @param event
* The event data that contains information about the trigger.
* @return The reason why the trigger cannot be activated or null if it can be activated.
*/
String canActivate(TriggerEvent event);
}