Custom minigame fill the CPU with no errors

Hi, I will try to be as concise as possible.

Some few premises to make the situation clear: I am not a noob in Java programming, so don’t be afraid to make technical statements; before posting here i tried literally everything I could do.

Our minigame, every 5 hours circa, fills the CPU with no errors . Details below.

We replicated the Dream’s DeathSwap within a minigame with multiple arenas, which are Worlds.

We have countdowns to regulate the swaps in each arena, where every countdown is a series of scheduled delayed tasks with a time offset. We tried also repeating tasks with a variable decrementation but the outcome was the same.

I use scheduled tasks in a very intensive way, but I tried to keep them clean.
Also the tasks IDs are increasing to the limit of Java’s Integer. Wonder if that’s a problem, but we never reached that goal because of the filling of the CPU before that happens.

The teleports (the swaps, and also the teleprot at the beginning and end of the game) happens with the Paper’s


function, and everything that needs to be done after is located in the


section of the teleport’s return object.

With that said, it would be meaningless to post code because I have literraly no errors in console.

I use Multiverse-Core to clone the arenas worlds, to remove them when the game is finished and make a new clone from an untouched world folder.

The CPU usage, right before the plugin fills it, begins to spike to 100% with increasing frequency until it is full.

I put literally everything in a


}catch(Exception e){



but still is printing NO errors before filling the CPU. Also note that the minigame doesn’t stop functioning, it just fills the CPU.

We also already tried Spigot teleports, loading and uloading Worlds with Bukkit’s functions, and to balance the loads to multiple ticks to avoid TPS loss .

I tried everything i had in mind. I will be glad to post details and code where they will be necessary to understand parts of the plugin.

Thanks in advance for your time.