Functional programming? - Tki-sor/UtilJS GitHub Wiki

Using some simple methods, UtilJS enables common classes to implement operations like let, also, run, takeIf, takeUnless, repeat—basically similar to Kotlin.
So how to use them won’t be elaborated here, but roughly like this:

ServerEvents.tick(event => {  
    event.getServer().wrap().takeIf(take => {  
        return (take.getPlayerCount() == 1)  
    }).also(al => {  
        al.runCommandSilent("say player count = 1")  
    })  
})  

Due to some limitations, ProbeJS cannot provide full code completion without wrapping, so a wrapper approach is used as a compromise.

Wrappers have been implemented for classes like Block, BlockPos, BlockState, CollectionTag, CompoundTag, Entity, Item, and so on.

If you later need to unwrap, just use the get() method.