[1.12.2] Custom data reset when user reconnect


#1

Sponge Build: Can’t find it, but latest on github
Forge Build: forge-1.12.2-14.23.3.2655
Java Version: 8

Hi, I’m getting trouble after updating my plugins to 7.1.0. My custom data are not saved when the player is reconnecting to the server, but when I break on the fillContainer I can see that values are right… if anyone can help me, this can be very good !
Thank’s

Plugin Source: https://gist.github.com/alimtunc/235256e5f45aa9a43d85a300b8894834


#2

You need to actually register the Keys… Just building them doesn’t cut it. I can provide some more debugging on keys when they’re used, but you are building things, but not registering them. That’s the first step to troubleshooting.


#3

I tried to register key with the event methods like :

@Listener
public void onKeyRegistration(final GameRegistryEvent.Register<Key<?>> event) {
    MyKeys.keyRegistration();
    event.register(MyKeys.STANDARD_ID);
    event.register(MyKeys.STANDARD_NAME);
    event.register(MyKeys.STANDARD_LVLPVP);
    event.register(MyKeys.STANDARD_HONORS);
    event.register(MyKeys.STANDARD_ELEMENT);
}

Same issue, but actually I didn’t see anywhere that registering the keys like that. So far i just register my keys with :
registerKeyValue(MyKeys.STANDARD_ID, this::id); registerKeyValue(MyKeys.STANDARD_NAME, this::name); registerKeyValue(MyKeys.STANDARD_LVLPVP, this::lvlPvP); registerKeyValue(MyKeys.STANDARD_HONORS, this::honors); registerKeyValue(MyKeys.STANDARD_ELEMENT, this::element);


#4

First I’ve heard of it. How do you register Keys, and when?


#6

Already have the same issue…