Global Session variables do not work over multiplayer

Published by Tobi9090 on Thu, 06/04/2020 - 12:40
Status
Works as designed
Type
Product/platform
Not applicable
Priority
Normal
Issue description

From my knowledge, global session variables are supposed to be player specific, however i've found that over multiplayer the global session variables are shared across all of the players and sometimes cease to work all together.

I apologise if this is not an issue with Mcreator but that simply global session variables don't work over multiplayer on Minecraft in general.

Thank you for your time!

 

Issue comments

however i've found that over multiplayer the global session variables are shared across all of the players and sometimes cease to work all together.

Where did you read this? This is nothing but wrong.

 

Please take a read of this page: https://mcreator.net/wiki/developing-multiplayer-compatible-mods:

Using GLOBAL_SESSION variables

Another important thing to keep in mind is that GLOBAL_SESSION variables are specific per Java runtime instance and as client and world run on different Java runtime instances or even different computers and locations, these two variables will hold different value for each client connected to the server and another different value for the server.

This limits the usability of GLOBAL_SESSION variable type for multiplayer scenarios. If you do not have a good reason to use them, do not.

Ah, thanks for showing me this it would seem I was mistaken to the function of global session variables. In that case I wonder is there a, for example, 'global_player' type of variable that would save values to a specific player and work over multiplayer. I've looked into this on the forums but the solution I most commonly find involves using Global_Session in game and Nbt tags to save values when the game is closed, which work fine over single-player but encounter the issue I presented in my original post over multiplayer.

Thanks for the help.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.