Performance improvement by caching PPlayer Player reference

This commit is contained in:
Esophose 2020-02-13 17:32:40 -07:00
parent 1c834c7bb6
commit c2146c11b9
2 changed files with 20 additions and 3 deletions

View file

@ -97,8 +97,11 @@ public class ParticleManager extends Manager implements Listener, Runnable {
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent e) {
PPlayer pplayer = this.playerParticles.getManager(DataManager.class).getPPlayer(e.getPlayer().getUniqueId());
if (pplayer != null && pplayer.getFixedEffectIds().isEmpty())
this.particlePlayers.remove(pplayer.getUniqueId()); // Unload the PPlayer if they don't have any fixed effects
if (pplayer != null) {
pplayer.clearCachedPlayer();
if (pplayer.getFixedEffectIds().isEmpty())
this.particlePlayers.remove(pplayer.getUniqueId()); // Unload the PPlayer if they don't have any fixed effects
}
}
/**