Jump to content

[SOLVED] [1.15.2] Can players fake which advancements they have?


GenElectrovise

Recommended Posts

My solution: https://www.minecraftforge.net/forum/topic/86697-1152-can-players-fake-which-advancements-they-have/?do=findComment&comment=407476

 

 

The answer is aptly summed up by 

Quote

You can never trust the client

 

==

 

Hi!

 

The Question:

Can players fake which advancements they have?

 

The Context: 

My aim is for players, via the Altar, to be able to cast various rituals, which will do various things. They will be able to select a ritual to cast using buttons on the AltarContainerScreen (not yet added), which cycles a variable called the selectedIndex, handled in the AltarContainer#RitualSelector class. When the Container is opened, it should check which advancements the player has, then make rituals available based on which ones they have completed. I can retrieve their advancements on the Server, though as the packet containing the ResourceLocation of the selected ritual (to be verified and processed on the server) is sent by the client, I either need to retrieve the player's advancements on the client side, or bounce some packets with int arrays around (seems messy to me). I currently have a check in to make sure the logic is only handled on the server, though (of course) that is preventing the client from getting any of their advancements, meaning that they cannot cast any rituals.

 

The bottom line (Literally! Pun intended...) is: Can I trust the client to not fake advancements?

Edited by GenElectrovise
answer

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

Link to comment
Share on other sites

On 6/11/2020 at 9:41 AM, diesieben07 said:

You can never trust the client.

Very true -- I moved all of the logic to the server.

 

On 6/11/2020 at 9:41 AM, diesieben07 said:

I am not sure why you need to "bounce packets around"

Not entirely sure what I meant here... I think something about a 1 or 0 in an int[] for each ritual? Scrapped that idea!

 

On 6/11/2020 at 9:41 AM, diesieben07 said:

Just send a packet when the client wants to cast a ritual and verify on the server fi that is okay.

Bit more complicated in this case but that's the general gist I went with.

 

For anyone from the future, these links should help:

https://github.com/GenElectrovise/MagiksMostEvile/tree/1.15.2/src/main/java/genelectrovise/magiksmostevile/common/network/altar

https://github.com/GenElectrovise/MagiksMostEvile/blob/1.15.2/src/main/java/genelectrovise/magiksmostevile/common/tileentity/altar/AltarContainerScreen.java

https://github.com/GenElectrovise/MagiksMostEvile/blob/1.15.2/src/main/java/genelectrovise/magiksmostevile/common/tileentity/altar/AltarContainer.java

https://github.com/GenElectrovise/MagiksMostEvile/blob/1.15.2/src/main/java/genelectrovise/magiksmostevile/common/tileentity/altar/AltarTileEntity.java

How to ask a good coding question: https://stackoverflow.com/help/how-to-ask

Give logs, code, desired effects, and actual effects. Be thorough or we can't help you. Don't post code without putting it in a code block (the <> button on the post - select "C-type Language"): syntax highlighting makes everything easier, and it keeps the post tidy.

 

My own mod, Magiks Most Evile: GitHub (https://github.com/GenElectrovise/MagiksMostEvile) Wiki (https://magiksmostevile.fandom.com/wiki/Magiks_Most_Evile_Wiki)

Edit your own signature at https://www.minecraftforge.net/forum/settings/signature/

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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