Ugleh / RedstoneProximitySensor

A Plugin for Minecraft alongside Spigot for creating proximity detection using redstone sensors.
https://www.spigotmc.org/resources/redstone-proximity-sensor.17965/
5 stars 5 forks source link

Performance problem #3

Closed Nishh closed 6 years ago

Nishh commented 7 years ago

this line: https://github.com/Ugleh/RedstoneProximitySensor/blob/master/src/com/ugleh/redstoneproximitysensor/utils/RPS.java#L133

you wanted to check if chunk is loaded. but Location#getChunk loads the chunk. and makes lag if you have a lot of rps (and memory leak. keeps all rps chunks loaded) https://www.spigotmc.org/threads/when-are-chunks-loaded.58342/

if you do boolean isLoaded = location.getWorld().isChunkLoaded(location.getBlockX()>>4,location.getBlockZ()>>4); problem will be fixed.

Ugleh commented 6 years ago

Sorry for the late reply, I have been on hiatus. Thanks for the info, I will implement.