BentoBoxWorld / BentoBox

Expandable Minecraft server plugin for island-type games like SkyBlock or AcidIsland.
https://bentobox.world
Eclipse Public License 2.0
322 stars 134 forks source link

Update how /is purge works to be team based. #2359

Open spookymgmt opened 1 month ago

spookymgmt commented 1 month ago

Is your feature request related to a problem?

The /is purge command in redundant when using it in a multiplayer experience.

Currently, the command is ran on every server reboot, but according to support in the discord, it completely skips any islands that are part of a team.

How does that help me?

Describe the solution you'd like.

I think this feature should be changed, so that it works like this:

When /is purge 10 is ran for example, it will check every island on the server, and in order for an island to be purged, the following requirement must be met.

This would make for a very good purge system, compared to what we have now.

That way, it's not skipping islands with a team, and, if it was still only owner based, what if owner invites friend, owner quits playing server, but friend keeps playing. You do not want to purge the island on him. So it just makes the most sense to do a check, and see if EVERY SINGLE team member has been offline for the purge arg time.

Describe alternatives you've considered.

Asked in discord.

Agreements

Other

$20 bounty

tastybento commented 1 month ago

@spookymgmt This is done. Please have a check and confirm it works how you expect.

spookymgmt commented 1 month ago

Putting it live now, don't really have a great way to test it I don't think, but maybe I can setup a test server this Monday and see. Thank you.

spookymgmt commented 1 month ago

@spookymgmt This is done. Please have a check and confirm it works how you expect.

[01:25:05] [Server thread/INFO]: [BentoBox] +-----------------------------------------+
[01:25:05] [Paper Watchdog Thread/ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH  - git-Axolotl-"3841885" (MC: 1.20.1) ---
[01:25:05] [Paper Watchdog Thread/ERROR]: The server has not responded for 10 seconds! Creating thread dump
[01:25:05] [Paper Watchdog Thread/ERROR]: ------------------------------
[01:25:05] [Paper Watchdog Thread/ERROR]: Server thread dump (Look for plugins here before reporting to Paper!):
[01:25:05] [Server thread/INFO]: [BentoBox] Will purge island at 360000,80,-110000 in oneblock_world
[01:25:05] [Paper Watchdog Thread/ERROR]: ------------------------------
[01:25:05] [Paper Watchdog Thread/ERROR]: Current Thread: Server thread
[01:25:05] [Paper Watchdog Thread/ERROR]:   PID: 45 | Suspended: false | Native: false | State: RUNNABLE
[01:25:05] [Paper Watchdog Thread/ERROR]:   Stack:
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.zip.Inflater.inflateBytesBytes(Native Method)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.zip.Inflater.inflate(Inflater.java:378)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:152)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.zip.GZIPInputStream.read(GZIPInputStream.java:117)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.util.FastBufferedInputStream.fill(FastBufferedInputStream.java:94)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.util.FastBufferedInputStream.read(FastBufferedInputStream.java:42)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.io.DataInputStream.readFully(DataInputStream.java:201)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.io.DataInputStream.readUTF(DataInputStream.java:614)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.io.DataInputStream.readUTF(DataInputStream.java:570)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.StringTag$1.load(StringTag.java:16)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.StringTag$1.load(StringTag.java:15)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.ListTag$1.load(ListTag.java:31)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.ListTag$1.load(ListTag.java:17)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag.readNamedTagData(CompoundTag.java:512)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag$1.load(CompoundTag.java:45)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag$1.b(CompoundTag.java:32)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag.readNamedTagData(CompoundTag.java:512)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag$1.load(CompoundTag.java:45)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag$1.b(CompoundTag.java:32)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag.readNamedTagData(CompoundTag.java:512)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag$1.load(CompoundTag.java:45)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag$1.b(CompoundTag.java:32)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.ListTag$1.load(ListTag.java:31)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.ListTag$1.load(ListTag.java:17)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag.readNamedTagData(CompoundTag.java:512)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag$1.load(CompoundTag.java:45)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.CompoundTag$1.b(CompoundTag.java:32)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.NbtIo.readUnnamedTag(NbtIo.java:293)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.NbtIo.read(NbtIo.java:238)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.nbt.NbtIo.readCompressed(NbtIo.java:58)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.world.level.storage.PlayerDataStorage.getPlayerData(PlayerDataStorage.java:108)
[01:25:05] [Paper Watchdog Thread/ERROR]:       org.bukkit.craftbukkit.v1_20_R1.CraftOfflinePlayer.getData(CraftOfflinePlayer.java:209)
[01:25:05] [Paper Watchdog Thread/ERROR]:       org.bukkit.craftbukkit.v1_20_R1.CraftOfflinePlayer.getBukkitData(CraftOfflinePlayer.java:213)
[01:25:05] [Paper Watchdog Thread/ERROR]:       org.bukkit.craftbukkit.v1_20_R1.CraftOfflinePlayer.getLastPlayed(CraftOfflinePlayer.java:253)
[01:25:05] [Paper Watchdog Thread/ERROR]:       BentoBox-2.4.0-SNAPSHOT-b2624.jar//world.bentobox.bentobox.api.commands.admin.purge.AdminPurgeCommand.lambda$getOldIslands$4(AdminPurgeCommand.java:139)
[01:25:05] [Paper Watchdog Thread/ERROR]:       BentoBox-2.4.0-SNAPSHOT-b2624.jar//world.bentobox.bentobox.api.commands.admin.purge.AdminPurgeCommand$$Lambda$20248/0x000000080513b630.test(Unknown Source)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.MatchOps$1MatchSink.accept(MatchOps.java:90)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1856)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ReferencePipeline.allMatch(ReferencePipeline.java:637)
[01:25:05] [Paper Watchdog Thread/ERROR]:       BentoBox-2.4.0-SNAPSHOT-b2624.jar//world.bentobox.bentobox.api.commands.admin.purge.AdminPurgeCommand.lambda$getOldIslands$5(AdminPurgeCommand.java:138)
[01:25:05] [Paper Watchdog Thread/ERROR]:       BentoBox-2.4.0-SNAPSHOT-b2624.jar//world.bentobox.bentobox.api.commands.admin.purge.AdminPurgeCommand$$Lambda$20246/0x000000080513b1a8.test(Unknown Source)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
[01:25:05] [Paper Watchdog Thread/ERROR]:       BentoBox-2.4.0-SNAPSHOT-b2624.jar//world.bentobox.bentobox.api.commands.admin.purge.AdminPurgeCommand.getOldIslands(AdminPurgeCommand.java:140)
[01:25:05] [Paper Watchdog Thread/ERROR]:       BentoBox-2.4.0-SNAPSHOT-b2624.jar//world.bentobox.bentobox.api.commands.admin.purge.AdminPurgeCommand.execute(AdminPurgeCommand.java:78)
[01:25:05] [Paper Watchdog Thread/ERROR]:       BentoBox-2.4.0-SNAPSHOT-b2624.jar//world.bentobox.bentobox.api.commands.CompositeCommand.call(CompositeCommand.java:292)
[01:25:05] [Paper Watchdog Thread/ERROR]:       BentoBox-2.4.0-SNAPSHOT-b2624.jar//world.bentobox.bentobox.api.commands.CompositeCommand.execute(CompositeCommand.java:260)
[01:25:05] [Paper Watchdog Thread/ERROR]:       org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155)
[01:25:05] [Paper Watchdog Thread/ERROR]:       org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:1009)
[01:25:05] [Paper Watchdog Thread/ERROR]:       UltimateAutoRestart Build 53 (1).jar//dev.norska.uar.tasks.UARAfterRestart$2.run(UARAfterRestart.java:55)
[01:25:05] [Paper Watchdog Thread/ERROR]:       org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101)
[01:25:05] [Paper Watchdog Thread/ERROR]:       org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1505)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:457)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1419)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1196)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:326)
[01:25:05] [Paper Watchdog Thread/ERROR]:       net.minecraft.server.MinecraftServer$$Lambda$4699/0x0000000801a12758.run(Unknown Source)
[01:25:05] [Paper Watchdog Thread/ERROR]:       java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
[01:25:05] [Paper Watchdog Thread/ERROR]: ------------------------------
[01:25:05] [Paper Watchdog Thread/ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---
[01:25:05] [Paper Watchdog Thread/ERROR]: ------------------------------

Entire server freezes then crashes when purging on this version.

Additionally, I typed /isa purge 40, and it's saying it's going to purge islands with a team member that was online just a day ago.

It should be, the entire team must be offline for the given days, to purge.

[01:25:06] [Server thread/INFO]: [BentoBox] Will purge island at 500000,80,20000 in oneblock_world
[01:25:06] [Server thread/INFO]: [BentoBox] Player _Sorinelul5297 last logged in 0 days ago. Wed May 22 11:47:10 UTC 2024
[01:25:06] [Server thread/INFO]: [BentoBox] +-----------------------------------------+
[01:25:06] [Server thread/INFO]: [BentoBox] Will purge island at -100000,80,10000 in oneblock_world
[01:25:06] [Server thread/INFO]: [BentoBox] Player _Jayboss172 last logged in 39 days ago. Sat Apr 13 12:54:31 UTC 2024
[01:25:06] [Server thread/INFO]: [BentoBox] +-----------------------------------------+
[01:25:06] [Server thread/INFO]: [BentoBox] Will purge island at -170000,80,-130000 in oneblock_world
[01:25:06] [Server thread/INFO]: [BentoBox] Player _Ellufra007 last logged in 38 days ago. Mon Apr 15 01:08:24 UTC 2024
[01:25:06] [Server thread/INFO]: [BentoBox] +-----------------------------------------+
[01:25:06] [Server thread/INFO]: [BentoBox] Will purge island at 170000,80,-60000 in oneblock_world
[01:25:06] [Server thread/INFO]: [BentoBox] Player _Firelanp71351 last logged in 38 days ago. Sun Apr 14 22:05:17 UTC 2024
[01:25:06] [Server thread/INFO]: [BentoBox] +-----------------------------------------+
[01:25:06] [Server thread/INFO]: [BentoBox] Will purge island at 350000,80,370000 in oneblock_world
[01:25:06] [Server thread/INFO]: [BentoBox] Player Robotdogyt last logged in 20 days ago. Thu May 02 15:42:41 UTC 2024
[01:25:06] [Server thread/INFO]: [BentoBox] +-----------------------------------------+
tastybento commented 1 month ago

That is odd. Some comments/questions and a request for files:

  1. Is your server time set correctly? I assume so, but just checking
  2. The "THIS IS NOT A BUG OR A CRASH" log indicates that the server is hanging when the request is made to provide the last logged in time for a team member's UUID. This is usually just a check of the local usercache.json so I don't know why it would take 10+ seconds to do that check, clearly the server is having an issue loading that file for some reason. This to me seems like a server bug, but I could be wrong.
  3. The difference between this code and the previous is that every team member is being checked, so maybe the UUID of some of these team members is not in the server user cache, but in that case, the server should report 0 immediately - there's no network lookup happening here, or there shouldn't be.
  4. If the above is not working, then I assume bogus info is being provided for the last logged-in date so I'm not surprised if the report of what needs to be purged is messed up.
  5. When does the actual server freeze happen? When you run the initial command to get the status of what needs to be purged, or when you actually start the purging.
  6. Can you provide the following files so I can try and replicate the issue? Just zip them up and drag and drop to the reply: usercache.json in the main server folder, a zip of the BentoBox database folder.
  7. Also, what version of the server did you use to test this?

Thanks!

spookymgmt commented 1 month ago

Hey so yeah server time is correct.

The lag issue happens with the team version of purge, and the original version of purging, but it's just not as bad.

The freeze happens the second you run the command, not when confirming it.

Server version is on 1.20.1.

I'll send over a zip of all my files, gonna take a bit to transfer and zip them up though, ill send them over on discord? If dms are off ill figure a way out to just send them here as a google drive link or something.

Thank you

tastybento commented 1 month ago

Okay. You can also email the link to tastybento @ bentobox . world

spookymgmt commented 1 month ago

I've went ahead and sent that over now, thanks

tastybento commented 1 month ago

The email forwarding doesn't seem to be working so please send to tastybento 2 @ gmail . com

tastybento commented 1 month ago

I got it. I made some changes that I think should work, but I’d like you to test - run the /oba purge 40 command and see what it says in terms of how many islands it will purge. Shar the console output. Do not actually do it! Just share what the output is on your server. You can try different days too and see what it says. BentoBox-2.4.0-SNAPSHOT-LOCAL.jar.zip

spookymgmt commented 1 month ago

[05:48:44 INFO]: AlsoLunar issued server command: /isa purge 40 [05:48:44 INFO]: [BentoBox] DEBUG: Progress: 4% [05:48:45 INFO]: [BentoBox] DEBUG: Progress: 9% [05:48:45 INFO]: [BentoBox] DEBUG: Progress: 14% [05:48:45 INFO]: [BentoBox] DEBUG: Progress: 19% [05:48:45 INFO]: [BentoBox] DEBUG: Progress: 24% [05:48:45 INFO]: [BentoBox] DEBUG: Progress: 29% [05:48:46 INFO]: [BentoBox] DEBUG: Progress: 34% [05:48:46 INFO]: [BentoBox] DEBUG: Progress: 39% [05:48:46 INFO]: [BentoBox] DEBUG: Progress: 44% [05:48:46 INFO]: [ChatChat] BillyDaKid8469 » hit lvl 120 fishing though [05:48:46 INFO]: [BentoBox] DEBUG: Progress: 49% [05:48:46 INFO]: [BentoBox] DEBUG: Progress: 54% [05:48:47 INFO]: [BentoBox] DEBUG: Progress: 59% [05:48:47 INFO]: [BentoBox] DEBUG: Progress: 64% [05:48:47 INFO]: [BentoBox] DEBUG: Progress: 69% [05:48:47 INFO]: [BentoBox] DEBUG: Progress: 74% [05:48:47 INFO]: [BentoBox] DEBUG: Progress: 79% [05:48:48 INFO]: [BentoBox] DEBUG: Progress: 84% [05:48:48 INFO]: [BentoBox] DEBUG: Progress: 89% [05:48:48 INFO]: [BentoBox] DEBUG: Progress: 94% [05:48:48 INFO]: [BentoBox] DEBUG: Progress: 99% [05:48:48 INFO]: [BentoBox] DEBUG: 100%

10098 islands to check, and 10097 of them are purgable now

tastybento commented 1 month ago

That appears to be the correct assessment because out of all the islands in the database, none of them have an owner in the usercache.json file, so it appears that none of the users have ever logged into that server. Is the usercache the correct file for that server? I ran a check and not a single UUID in the Island's database folder matches any in the server's usercache.json file, so as a result, the owner of every single appears to have never logged into the server, and therefore every island is over that timelimit and purgeable.

I don't know how this happened. Any ideas? It's as if the database is not from the server that the usercache.json file applies to.

spookymgmt commented 1 month ago

Mmm, I think something is wrong then, when I open up the usercache.json in a file editor, and then /seen any name inside of this file, they've all been online in the last 50 days.

spookymgmt commented 1 month ago

For example, in the file I sent you, do you see this data?

{"name":"GrimXPlague","uuid":"615d39bd-f960-4ac4-92ad-1d5ab776817f","expiresOn":"2024-06-23 04:16:12 +0000"},

Then in game, qsJLRacIuM

tastybento commented 1 month ago

Thanks, that helps. Yes, I see that.

tastybento commented 1 month ago

If I run:

            Date d = new Date(
                    Bukkit.getOfflinePlayer(UUID.fromString("615d39bd-f960-4ac4-92ad-1d5ab776817f")).getLastPlayed());
            user.sendRawMessage("GrimXPlague last logged in " + d);

then I get this in console:

[00:08:11] [Server thread/INFO]: GrimXPlague last logged in Wed Dec 31 16:00:00 PST 1969

even though I have that usercache.json file in the server folder and it's a totally fresh server.

It looks like the usercache.json file is non-transferable between servers. I don't know where they are sticking the data, but it isn't there.

I also verified that the date is correct shown for a player that logged in to the server that I'm running, and also, if that file is transferted to another server, my player also appears to have never logged in.

So, the upshot of this is that the purge command should in theory correctly identify the actual number of islands to purge if you run it on the production server, but it won't if all you did was copy the files from the production server to a local server. There must be a hidden file somewhere with the info in it, but I need to hit the sack, so I'll look at this later.

spookymgmt commented 1 month ago

Appreciate it a bunch, and this is a prod server, but I may have copied an old usercache file from a different gamemode of mine? Hmm, would I possibly be able to just delete it so it's fresh? I don't know, thanks for the help though

tastybento commented 1 month ago

I don't understand why it is doing what it is doing right now, but I'm tired.

I think that I may have to start storing the last login time in my own database instead of relying on the server cache. That way I can tell for sure. That won't help with your current situation immediately.

BONNe commented 1 month ago

Tasty... just curiosity... Did you transform date to the correct format? The format is 2024-06-21 13:13:47 +0300 Which is: yyyy-MM-dd HH:mm:ss Z I think... It maybe that the issue why you get different is because your default format is different

tastybento commented 1 month ago

@BONNe Yeah, thanks. The thing is though that the calculations are done on Unix timestamps, which are just longs. This part of the code hasn't changed since forever. I'm open to suggestions though.

spookymgmt commented 1 month ago

How we lookin boss

tastybento commented 1 month ago

I checked on the Paper Discord and the last played time for players comes from the player dat file, or it uses the file mtime. So, if those files don't exist on the server, e.g., in the folder /Minecraft/1.20.6/world/playerdata then their last login time will be 0. So, I suspect that your player dat files may have been deleted, or if you are running this on a test server where that data wasn't copied over. As a result, the purging, which is currently based on that date, will select every unknown player for purging.

So, you could... wait 30 or 40 days and let players log in and build those files up again. Then any that haven't logged in within 40 days will be purged.

spookymgmt commented 1 month ago

Would it be a better solution to build your own system for tracking last login dates, in the bento database?

This would remove any margin for error?

Because currently this isn't a test server nor did I delete any files. So I'm unsure why it's not having the correct data.

spookymgmt commented 4 weeks ago

While running this setup, 7NnUyxyq8v

now /isa purge 40 displays 3000 islands to delete, rather than the 10,000 previously reported.

Seems like it might be working correctly now?

Is this the build that takes team members last login into account?

tastybento commented 4 weeks ago

No, that version is 2.3.0 so it's probably a smaller amount because it is ignoring team islands.

I saw your previous message about storing the last login time of a user in our own database and we could although it duplicates the Bukkit API for last login. I could.

It'd be interesting to see what date you have for your players in world/playerdata/ because apparently, this is where the player data is stored and the dates of last login of the .dat files. Do you have any kind of backup system that copies these files or restores them? Actually, do you have a default world, world?

spookymgmt commented 4 weeks ago

I have this player data file from /world/playerdata, but I'm not noticing any last login date in the file. https://cdn.discordapp.com/attachments/1247546496040177717/1249515838201921616/8535aad2-8ead-4834-afea-0902457db4f3.dat?ex=666795ce&is=6666444e&hm=153535393349b6dd783c4511ac970b2ef8f1570c968ed0b15cf9aa0c57b5a37e&

File download, not positive if it works or not.

tastybento commented 4 weeks ago

No, the files are binary, but in the file system where they are stored the files should have a date on them. Like this:

Screenshot 2024-06-09 at 5 12 56 PM
spookymgmt commented 4 weeks ago

Ohhhhh yeah is that usable? Can we switch it to use that instead? I don't see how that could fail. It looks correct from what I can see

tastybento commented 4 weeks ago

That is what Bukkit is using. But if that folder was deleted, or moved, or the default world was changed so a new folder was used, then when the query on the UUID is made, the date given is 0. This makes the player appear to have never logged in, or to have logged in back in the 70's. This is why all your users appeared to be valid for purging. However, as players login from now on, that folder will be rebuilt and after 40 days or so, you will have an accurate list of all the players who are recent and all the ones who are not (they will still be unlisted in the folder). So at that point, the purging will be accurate. Does that make sense?

spookymgmt commented 4 weeks ago

Oooh and thats what the current team purge jar is using?

tastybento commented 4 weeks ago

Yes. Bukkit.getOfflinePlayer(UUID).getLastPlayed()), which gets the timestamp from those files or the data within those files.

spookymgmt commented 4 weeks ago

Ah okay, so I'll put the jar back on, test out the purge again, and see if it's better? As that default main world folder hasn't been touched at all since launching the server last month.

tastybento commented 4 weeks ago

Yes, you can try it. Can you also look at that folder and see how many files are in there and what sort of dates they have? It should have all the players in there who have logged in over the last few weeks at least.

spookymgmt commented 4 weeks ago

Around 45 thousand files and yeah the dates seem correct.

tastybento commented 3 weeks ago

Good. Let's see what the purge says with the latest BentoBox. 🤞