Magic

Magic

190k Downloads

Suggestion - Global Atrributes

NightScythe1 opened this issue ยท 4 comments

commented

Just wondering, is/could there be a way of setting or changing attributes with ModifyAttribute that will affect the whole world rather than targets/players? There are global attributes builtin to magic such as 'time' and 'moon' and 'difficulty', so would it be possible for players to create our own global attributes similar to how these function? The only way I can think of to do this currently is creating a normal attribute and setting its default, but this doesn't seem to be changeable with ModifyAttribute so can't be altered to make certain global checks/events.

commented

It seems like I intended variables to be able to do this, but never implemented it.

public enum VariableScope {
    CAST, SPELL, MAGE

    // TODO: GLOBAL ?
}

It probably wouldn't be too hard, unless you need them to be persistent (survive a server restart)?

commented

Ah I see, it's quite strange they're not sticking then... Something else to note that may or may not be related at all-
If a player's class has any custom attribute values defined within them, all of their custom attributes values will be wiped/reset to default upon relog or reload. Just another attribute persistence issue so thought I'd mention it here too just in case it's related

commented

Oh that's cool! And yeah, my usecase would probably require persistent variables but no worries if not, as I'm not sure how feasible that would be... Would it be a similar issue to the Magic Mob attributes/modifications not persisting after restarts?

commented

No, this is something I'd have to implement myself.

Mob attributes should be using the builtin Spigot persistence, so I don't know why that is not working. I haven't had a chance to look into it.