Im not sure about redprotect. However because you are only comparing int values. You are able to do this sort of asynced. Obviously to cancel the event you need to be on the same tick as the event that was fired.
You may have heard or even used Java 8 steam libs, which is a more modern way to manipulate Collections (so list and sets). Stream is typically synced processing, however there is a second version called parallel stream.
This is a asynced version of stream, so its a lot quicker then regular stream and it forces the thread where the stream was created to wait until all the data is processed, therefore you could compare all the regions on separate threads with the event being cancelled when one is found. So it would be a lot faster.
Here is a good companion of regular to parallel
Thank you. In my tests, I found that reading from the database consumes a thousand times more than cached memory.
I will read the articles you recommend carefully.
If i use the Asynced version , Can the event be cancelled?
You can still cancel the event because the async method it uses is “fork join” whereby the thread that activated the async call, waits until the result is found. So for example, if you were using streams “AnyMatch”, after calling that, it will wait until one thread says there was a match, then it will carry on as normal.