use of org.lanternpowered.server.data.key.LanternKey in project LanternServer by LanternPowered.
the class CompositeValueStoreHelper method hasListeners.
protected static boolean hasListeners(ICompositeValueStore store, Iterable<Key<?>> keys) {
if (!(store instanceof DataHolder)) {
return false;
}
for (Key<?> key : keys) {
final DataHolder dataHolder = (DataHolder) store;
final List<RegisteredListener<ChangeDataHolderEvent.ValueChange>> listeners = ((LanternKey) key).getListeners();
for (RegisteredListener<ChangeDataHolderEvent.ValueChange> listener : listeners) {
if (((KeyEventListener) listener.getHandler()).getDataHolderPredicate().test(dataHolder)) {
return true;
}
}
}
return false;
}
Aggregations