Meta not updating properly with h2 storage due to server context not being handled the same
bloodmc opened this issue ยท 2 comments
Tested with LP 5.1.28
Using JSON perform the following command
/lp user <playername> meta set griefdefender.pvp false server=global gd_claim_default=global
LP will store this as
{
"key": "griefdefender.pvp",
"value": "false",
"context": {
"server": "global",
"gd_claim_default": "global"
}
},
- Run
/lp user <playername> meta set griefdefender.pvp true server=global gd_claim_default=global
LP will update the existing meta value as
{
"key": "griefdefender.pvp",
"value": "true",
"context": {
"server": "global",
"gd_claim_default": "global"
}
},
- Remove permission above then change storage to h2
Repeat the above steps and h2 will add 2 rows instead of updating the existing one
The USER_PERMISSIONS table ends up with the following 2 rows
13152 e035f345-cd86-32c4-b341-cb1c91fe2c9d meta.griefdefender\.pvp.false TRUE global global 0 {"gd_claim_default":"global"}
13153 e035f345-cd86-32c4-b341-cb1c91fe2c9d meta.griefdefender\.pvp.true TRUE global global 0 {"gd_claim_default":"global"}
I assume the underlying issue is the DB implementation is ignoring server contexts since it stores this in the server
column. So when I apply meta via command using server=global
it finds no match and ends up adding a new record. However, I would expect LP to scan contexts being passed and if server/world exist then to match it against the data in server/world columns.
I'm also guessing that world context would have the same issue as its also stored in its own column in h2.
Using JSON perform the following command
/lp user <playername> meta set griefdefender.pvp false server=global gd_claim_default=global
LP will store this as
{ "key": "griefdefender.pvp", "value": "false", "context": { "server": "global", "gd_claim_default": "global" } },
I can't reproduce this, running that exact command results in the following JSON:
{
"key": "griefdefender.pvp",
"value": "false",
"context": {
"gd_claim_default": "global"
}
}
server=global
is a bit of a special case - because really it means that there is no specific server context defined. Because of this, LP filters it out when it is used in commands.
Confirmed fix in commit
5a6176d
Thanks!