Load certain entities only when a player is near
I have a spigot server with the TrainCarts plugin installed. The trains need to have some chunks around them loaded so they can move and interact with rails, signs etc... Because of the high amount of trains that I have in the map, almost the whole world has to be fully loaded all the time. The problem is that the world has tons of item frames (maybe 5000 of them) and loading them all makes the server run at around 7tps causing a lot of lag and making trains run slow. I can't upgrade the processor because I have my server with a hosting provider.
Is there any way of making item frames only load when a player is near, and not loading them when only trains are near the item frames? Or maybe there is a better solution to do what I'm thinking about?
Pictures about "Load certain entities only when a player is near"



Kill Command Explained
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Yogendra Singh, cottonbro, RODNAE Productions, Yan Krukov
