overlaymanager: Add anyMatch method
This will help plugins make informed decisions when, say, displaying different text when toggling an overlay on and off.
This commit is contained in:
@@ -217,6 +217,17 @@ public class OverlayManager
|
|||||||
return removeIf;
|
return removeIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether an overlay exists which matches the given predicate.
|
||||||
|
*
|
||||||
|
* @param filter Filter predicate function
|
||||||
|
* @return {@code true} if any overlays match the given filter, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public synchronized boolean anyMatch(Predicate<Overlay> filter)
|
||||||
|
{
|
||||||
|
return overlays.stream().anyMatch(filter);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all overlays
|
* Clear all overlays
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user