use of io.github.wysohn.triggerreactor.core.manager.trigger.area.AbstractAreaTriggerManager in project TriggerReactor by wysohn.
the class CommonFunctions method getEntitiesInArea.
/**
* Get list of entities tracked by this AreaTrigger.
*
* @param areaTriggerName name of AreaTrigger to get entities from
* @return List of entities. null if the AreaTrigger with specified name
* doesn't exist.
*/
public List<Entity> getEntitiesInArea(String areaTriggerName) {
AbstractAreaTriggerManager areaManager = plugin.getAreaManager();
AreaTrigger trigger = areaManager.get(areaTriggerName);
if (trigger == null)
return null;
List<Entity> entities = new ArrayList<>();
for (IEntity ie : trigger.getEntities()) entities.add(ie.get());
return entities;
}
use of io.github.wysohn.triggerreactor.core.manager.trigger.area.AbstractAreaTriggerManager in project TriggerReactor by wysohn.
the class CommonFunctions method currentAreasAt.
/**
* Get the name of area triggers containing the given location.
*
* @param location the location to check
* @return array of AreaTrigger names. The array can be empty but never null.
*/
public String[] currentAreasAt(Location location) {
AbstractAreaTriggerManager areaManager = plugin.getAreaManager();
String[] names = areaManager.getAreas(LocationUtil.convertToSimpleLocation(location)).stream().map(Map.Entry::getValue).map(Trigger::getInfo).map(TriggerInfo::getTriggerName).toArray(String[]::new);
return names;
}
use of io.github.wysohn.triggerreactor.core.manager.trigger.area.AbstractAreaTriggerManager in project TriggerReactor by wysohn.
the class AbstractCommonFunctions method getEntitiesInArea.
/**
* Get list of entities tracked by this AreaTrigger.
*
* @param areaTriggerName name of AreaTrigger to get entities from
* @return List of entities. null if the AreaTrigger with specified name doesn't exist.
*/
public List<Entity> getEntitiesInArea(String areaTriggerName) {
AbstractAreaTriggerManager areaManager = plugin.getAreaManager();
AreaTrigger trigger = areaManager.get(areaTriggerName);
if (trigger == null)
return null;
List<Entity> entities = new ArrayList<>();
for (IEntity ie : trigger.getEntities()) entities.add(ie.get());
return entities;
}
Aggregations