Jump to content

[1.12.2] Prevent client side changing of server configs


Tomson124

Recommended Posts

Recently I realized that if you change the config values of my mod (SimplyJetpacks 2), this changes also the values for the jetpacks on servers. The server configs are not changed as far as I know but it seems that always the client configs are loaded. Is there a way to change this, so it loads the config from the server, when the player is on a server?

Link to comment
Share on other sites

On 18.1.2018 at 10:34 PM, diesieben07 said:

You should treat singleplayer and multiplayer exactly the same. As soon as a player logs in, send them the necessary config data using a packet (server-side). Then on the client store those values separate from the "actual config values". On the client you then only access those separate values.

I changed the side of the ConfigSync from Client to Server, but I guess that is not enough, right?

public static void init() {
		SimplyJetpacks.logger.info("Registering network messages");
		instance.registerMessage(MessageJetpackSync.class, MessageJetpackSync.class, 0, Side.CLIENT);
		instance.registerMessage(MessageConfigSync.class, MessageConfigSync.class, 1, Side.SERVER);
		instance.registerMessage(MessageKeyboardSync.class, MessageKeyboardSync.class, 2, Side.SERVER);
		instance.registerMessage(MessageKeyBind.class, MessageKeyBind.class, 4, Side.SERVER);
}

 

Link to comment
Share on other sites

Yeah I did, I am sorry but it is the first time that I have to deal with the client/server side interaction on my own. The current Config is read from the File and then parsed to the NBT. From there is will be read on item init to set the NBT values for each item.

I guess I have to get the file on the server side an then write it to the NBT (or a variable) and get it from there on the client side for item init.

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.