@SuppressWarnings("unchecked")
    public <T extends ObjectAttachableListener> List<T> getObjectListeners(
            Class<?> objectClass, long objectId, Class<T> listenerClass) {
        return Collections.unmodifiableList((List<T>) Optional.ofNullable(objectClass)
                .map(objectListeners::get)
                .map(objectListener -> objectListener.get(objectId))
                .map(listeners -> listeners.get(listenerClass))
                .map(Map::keySet)
                .map(ArrayList::new)
                .orElseGet(ArrayList::new));
    }
@ SuppressWarnings ( "unchecked" ) public < T extends ObjectAttachableListener > List < T > getObjectListeners ( Class < ? > objectClass , long objectId , Class < T > listenerClass ) { return Collections . unmodifiableList ( ( List < T > ) Optional . ofNullable ( objectClass ) . map ( objectListeners :: get ) . map ( objectListener -> objectListener . get ( objectId ) ) . map ( listeners -> listeners . get ( listenerClass ) ) . map ( Map :: keySet ) . map ( ArrayList :: new ) . orElseGet ( ArrayList :: new ) ) ; }
Gets all object listeners of the given class.

@param objectClass The class of the object.
@param objectId The id of the object.
@param listenerClass The listener class.
@param <T> The type of the listener.
@return A list with all object listeners of the given type.