Advice on making an efficient plugin to catch dupers and find dupe stashes?

Hello everyone! So I started a server about a month ago, and prior to that I had never programmed any plugins at all, but I already have experience programming from teaching myself C++ for 3 years, then learning java for a couple classes I had where I needed to learn Java’s syntax. I made my first custom plugin the other day, and it was surprisingly easy. See, my server was being raided by a large group on discord who were sending 50+ people in to spam the chat and try to crash the server, so I created a simple plugin that my staff can use to kick everyone who doesn’t have a rank, and to whitelist the server to only allow Donators for a short time period while they go through and IP ban everyone who was raiding the server, and spamming in chat. It was a really fun exercise actually, and I’d like to get more into making plugins.

I take the security on my server extremely seriously, I feel like I take it more seriously than some bigger servers. I always see these videos on Youtube of people destroying servers by duping and making dupe stashes all across the map, and I decided that my next plugin will be to catch these people. The way I want it to work is by basically finding any chests/containers, or player’s inventories/echests with an unusually large amount of items, and if it finds one - let’s say there is a chest somewhere on the map that has like an entire stack of crate keys - then it will log that, alert staff to the location of it, and then you can catch the duper before they even have a chance to distribute the items. There could also be a command like /finddupes and it will list off a bunch of possible places where there could be duped items, such as, “Player could possibly have duped items in their echest,” or, “Chest with possible duped items at (coordinates)”.

I’m worried about the performance of a plugin like this, I know that there are plugins like CoreProtect which store all of the data that would be needed for something like this in an efficient manner, but the main ways that I can think to do it are just by searching every player’s inventory at a set interval, and also searching every container each time a player opens one. I think this would be quite difficult, if someone could point me in the right direction or give me ideas on how I could make this plugin work efficiently, that would be great! Thank you.

Hi, I would like to say that I am new to plugin development myself, but I think I might have a few suggestions that might be of help. We know that mincraft doesn’t utilize very many cores (3 at the most last time I checked) so if you could run the bulk of your passing in an unused core you might be able to reduce the stain on your game TPS. As for collecting data, whenever a something happens the server (a lighting update or block booking) the data goes somewhere to be processed. If you could get a duplicate of the data (find where it is stored and copied it not request data) it might not increase the performance cost of your plugin.

yes so I think we can make something different from mincraft

but we can’t like let’s say make it 3d

This isn’t what you described, but have you seen IllegalStack? It catches all kinds of glitches and dupes people try and it’d save you the effort of making your own plugin to catch dupes.

The issue with what you want to do is that it doesn’t seem to be very efficient, getting all possible chests and player inventories and checking if they have an inordinate amount of items.