alex9849 / advanced-region-market

A Bukkit/Spigot plugin for renting/selling WorldGuard regions
https://www.spigotmc.org/resources/advancedregionmarket.58732/
69 stars 44 forks source link

Heavy sign ticks #52

Closed FrankHeijden closed 3 years ago

FrankHeijden commented 3 years ago

It seems that the Region#updateSignText method is very heavy to compute for all n shops every second, is it maybe possible of fixing the timestamp onto the sign instead of updating the sign text each second / interval?

I was thinking about a line on the sign which could just be fixed, such as "Expires At dd-MM HH:mm" or something, so the plugin doesn't need to update the signs each tick at all.

alex9849 commented 3 years ago

You are already able to let the plugin display the expiration-time of a region as a date. Unfortunately most players want the countdown. But there is something you can do to reduce your lags. You can set the signupdateInterval in your configuration to a higher number of ticks. ARM automatically tries to distribute the workload on as many ticks as you allow. For example: If you have 80 Regions and an updateInterval of 40 ticks. ARM will only update 2 regions per tick. It follows that all regions will be updated every 2 seconds, because 40 ticks = 2 seconds. Also ARM tries to only update regions in one tick, that are not in the same chunk. That increases the probability that some regions don't even get their signs updated, because ARM only updates signs that are located in loaded chunks. The only thing that I can't optimize is the region restoring process. If a region expires and gets restored, a schematic gets loaded and pasted into the region. This may cause some lags, but shouldn't happen often.

FrankHeijden commented 3 years ago

Thanks for the quick response!