public static Map < String , String > getSpoilers ( Message message ) { if ( ! containsSpoiler ( message ) ) { return Collections . emptyMap ( ) ; } List < ExtensionElement > spoilers = message . getExtensions ( SpoilerElement . ELEMENT , NAMESPACE ) ; Map < String , String > map = new HashMap <> ( ) ; for ( ExtensionElement e : spoilers ) { SpoilerElement s = ( SpoilerElement ) e ; if ( s . getLanguage ( ) == null || s . getLanguage ( ) . equals ( "" ) ) { map . put ( "" , s . getHint ( ) ) ; } else { map . put ( s . getLanguage ( ) , s . getHint ( ) ) ; } } return map ; }
Return a map of all spoilers contained in a message . The map uses the language of a spoiler as key . If a spoiler has no language attribute its key will be an empty String .