ColinHDev / CPlot

Land and world management plugin for PocketMine-MP
https://discord.gg/cAYKEtaqnp
GNU General Public License v3.0
29 stars 12 forks source link

Duplicate rows in playerData table #65

Closed ColinHDev closed 1 year ago

ColinHDev commented 2 years ago

@Acsrel recently reported to me, that some players lost ownership of their plots. While investigating their database, it came to our attention, that there were in fact multiple rows (up to 5) for those players in the playerData table. The ownership was lost, due to them now having multiple playerIDs. Despite the playerID and lastJoin columns obviously being different, all rows share the exact same data (same playerUUID, same playerXUID, same playerName).

It should have something to do with the following query since it should return the data the database holds about that player. If this query returns invalid player data, a new entry is created in the table, which seems to be the case here.

-- #    { playerDataByData
-- #      :playerUUID ?string
-- #      :playerXUID ?string
-- #      :playerName ?string
SELECT playerID, playerUUID, playerXUID, playerName, lastJoin
FROM playerData
WHERE (:playerUUID IS NOT NULL AND playerUUID = :playerUUID) OR
      (:playerXUID IS NOT NULL AND playerXUID = :playerXUID) OR
      (:playerName IS NOT NULL AND playerName = :playerName);
-- #    }

https://github.com/ColinHDev/CPlot/blob/development/resources/sql/sqlite.sql#L115-L124 https://github.com/ColinHDev/CPlot/blob/development/resources/sql/mysql.sql#L116-L125

ColinHDev commented 2 years ago

Since this plugin can expect a few additional users if #63 gets merged, this issue now has top priority.

ColinHDev commented 2 years ago

So if anybody has similar experiences or additional information towards, please don't hesitate to answer here!

Acsrel commented 1 year ago

Somebody from the server reported this to me:

I think it’s affecting all players and ive found out that it only shuffles when someone claims a plot It also shuffles the ownership of the newly claimed plot

ColinHDev commented 1 year ago

Somebody from the server reported this to me:

I think it’s affecting all players and ive found out that it only shuffles when someone claims a plot It also shuffles the ownership of the newly claimed plot

Tried but could not reproduce this

ColinHDev commented 1 year ago

Closing due to nobody further reporting on this.