Skip to content
Success

Changes

Summary

  1. We can optimize a significant portion of LookClose's findNewTarget method with some changes: (#2103) (commit: fe02492) (details)
Commit fe024923cf95b52706b61b0f01e14d32804cd4ba by noreply
We can optimize a significant portion of LookClose's findNewTarget method with some changes: (#2103)

-Build the list of all potential Players and THEN sort by distance. A good chunk of the method's time was spend sorting things it didn't need to.
-Second, reorder the player checks for best performance, where getNPC() is the cheapest check and isPluginVanished is the most expensive check.

In somewhat minimal testing, these changes almost dropped findNewTarget off of my profiling entirely
(commit: fe02492)
The file was modifiedmain/src/main/java/net/citizensnpcs/trait/LookClose.java (diff)