I feel that when you add an attribute it should be persistent after a server restart.
After testing this is not currently the case.
I feel that when you add an attribute it should be persistent after a server restart.
After testing this is not currently the case.
Yes. is persistent only during session. If want to make permanent i think must save them into db and restore on player connect. This if is a attribute of a player ...
This is NPC attributes. I don't really want to have to save them manually lol
Edit: I mean, I have to save them manually, why bother with attributes in the first place?
Attributes are indeed only valid during the session. Right now it's more meant to be a convenient way to store temporary per-instance data (and possibly share it between plugins)... in fact it wouldn't be easy to make them persistent - right now it's possible to store any object as attribute (this could be a reference to another class, e.g a UI element, or just a primitive data type), but we could only store primitive data types persistently (no way to store and recover that properly).
We could think about adding a way to store separate, persistent attributes, but that would be limited to serializable data only (e.g. primitive data types, strings, vectors etc). Custom objects could only be stored if they implement the serializable interface (but no way to store API objects, like players, UI elements etc). It would be a separate API then, like setPersistentAttribute(), getPersistentAttribute() etc.
Yes it was only primitive data types I was adding to NPCs as Attributes. If it's easy from your side to implement then please do so.
However, if it's not going to be a quick fix, please don't waste time on it - I'm sure I could write my own NPC handler for this.
Don’t have an account yet? Create a new account now and be part of our community!