I have an issue where when the user logs back in and does /is challanges their database player data record gets reset. It's completely fine as long as they don't relog, and relogging itse;lf doesn't clear it, watched it change in real time.
1: complete challenges
2: relog
3: do is challenges
4: see that none are complete
Database should not reset
/bbox version (Mandatory)[20:06:16] [Render thread/INFO]: [CHAT] Running PAPER 1.16.1.
[20:06:16] [Render thread/INFO]: [CHAT] BentoBox version: 1.14.0
[20:06:16] [Render thread/INFO]: [CHAT] Database: POSTGRESQL
[20:06:16] [Render thread/INFO]: [CHAT] Loaded Game Worlds:
[20:06:16] [Render thread/INFO]: [CHAT] bskyblock_world (BSkyBlock): Overworld, Nether, The End
[20:06:16] [Render thread/INFO]: [CHAT] Loaded Addons:
[20:06:16] [Render thread/INFO]: [CHAT] Biomes 1.7.0 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] BSkyBlock 1.14.0-SNAPSHOT-b665 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] Challenges 0.9.0-SNAPSHOT-b420 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] ControlPanel 1.13.0-SNAPSHOT-b34 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] DimensionalTrees 1.6.1-SNAPSHOT-b81 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] Greenhouses 1.0.0 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] Level 2.0.0 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] MagicCobblestoneGenerator 1.7.0.2 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] MagicSummon 1.5.0.0 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] TwerkingForTrees 1.4.1 (ENABLED)
[20:06:16] [Render thread/INFO]: [CHAT] Warps 1.9.7 (ENABLED)
[20:07:04] [Render thread/INFO]: [CHAT] Plugins (40): AdvancedTeleport, ArmorStandEditor, AsyncWorldEdit, AsyncWorldEditBossBar, AutoRestart, BanManager, BentoBox, BlocksHub, ChestCleaner, Crosstalk, DiscordSRV, Elevators, Flight, Graves, Harbor, HeadDatabase, HeadsPlus, LogBlock, LuckPerms, LWC, MailIt, MessageAnnouncer, ModReq, MultitoolPlus, Multiverse-Core, Multiverse-NetherPortals, Multiverse-Portals, Nicky, PlaceholderAPI, PlayerControlPlus, ProtocolLib, Sickle, StaffFacilities, TAB, Vault, VentureChat, VoxelSniper, WG-GUI, WorldEdit, WorldGuard
Hmm, are there any errors in log file when it happens?
Oh, it is POSTGRESQL database... hmm...
Does it happen when relogging is fast? or even after some minutes, it is still cleared?
No errors. It also does not happen on the relog, the database is fine then. It happens on the first gui load after relog. Amount of time doesn't matter. It will still do it after hours, and across server restarts.
I still cannot reproduce the issue.
Interesting.
However, I do not have a POSTGRESQL database.
Update... I setup POSTGRESQL and still cannot reproduce the issue.
Update...
Can reproduce...
:D Sorry...
@tastybento POSTGRESQL does not work with Database#objectExists() method. It returns false while the object clearly is inside the database.
This is a major bug in BentoBox with POSTGRESQL database.
@Poslovitch and @tastybento
Query that SQL Handler creates for checking if object exists:
SELECT EXISTS(SELECT * FROM "ChallengesPlayerData" WHERE uniqueid = '"c37dedcf-b3c8-4e5e-a577-fd8110c497cc"')
By looks of it, the issue is with extra " or '
It must be only '. " is extra information that breaks the search via query.
Using MySQL I ended up with a request:
SELECT IF ( EXISTS( SELECT * FROM `ChallengesPlayerData` WHERE `uniqueId` = '"c37dedcf-b3c8-4e5e-a577-fd8110c497cc"'), 1, 0)
So it looks like that POSTGRESQL does not like extra "
LoadObject and DeleteObject were also broken.