You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tki-sor edited this page Jun 18, 2025
·
1 revision
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.