private void handleChannelCategory ( JsonNode jsonChannel ) { long channelCategoryId = jsonChannel . get ( "id" ) . asLong ( ) ; api . getChannelCategoryById ( channelCategoryId ) . map ( ChannelCategoryImpl . class :: cast ) . ifPresent ( channel -> { boolean oldNsfwFlag = channel . isNsfw ( ) ; boolean newNsfwFlag = jsonChannel . get ( "nsfw" ) . asBoolean ( ) ; if ( oldNsfwFlag != newNsfwFlag ) { channel . setNsfwFlag ( newNsfwFlag ) ; ServerChannelChangeNsfwFlagEvent event = new ServerChannelChangeNsfwFlagEventImpl ( channel , newNsfwFlag , oldNsfwFlag ) ; api . getEventDispatcher ( ) . dispatchServerChannelChangeNsfwFlagEvent ( ( DispatchQueueSelector ) channel . getServer ( ) , channel , channel . getServer ( ) , null , event ) ; } } ) ; }
Handles a channel category update .