Jump to content

Server side verification


Recommended Posts

depending on the context and location of the call, the method of obtaining it may differ significantly, but it is always Level

example: the Player parameter is passed to a certain method

public boolen anyMethod(ServerPlayer player, par1, par2) {...}

you will receive the client side as follows


server code is written in a block if (! player.getLevel.isClientSide){///}

client code is written in a block if (player.getLevel.isClientSide){///}


in some cases, the world can be passed directly to the method, but I don’t remember this in my practice

in almost all cases I get the client side from LivingEntity.getLevel.isClientSide


example 2: the client side is taken from the event

public static void onPlayerJoin(EntityJoinLevelEvent event){
                if(event.getEntity() instanceof ServerPlayer player){
                    val = event;
                    RegisterPlayer registerPlayer = new RegisterPlayer();
                    SetupQuestCoreForPlayer setupQuestCoreForPlayer = new SetupQuestCoreForPlayer();

here you can also get the client side via event.getEntity().getLevel().isClientSide() OR event.getLevel().isClientSide()

sorry my ENGLISH is very bad

loock this






its help you!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.