Question

After many hours of been unable to find a viable solution to our issues we have not been able to come to conclusion or a fix on how or why these lag spikes are happening. I would just like to say in advance thanks for any time put into reading and responding to this message.

http://paste.ubuntu.com/7400818/ - htp://aikar.co/timings.php?url=7400818

You can see above there are different tests taken at different times. The timings from Aikar will give a different perspective from the ubuntu pastes, the issues that are occurring are from ChromaHillsRPG. Maintenance on the PlayerJoinEvent and PlayerQuitEvent.

Have a look below at what happens on these events.

Player player = event.getPlayer();
Main.getInstance().setUpData(player);

Group group = Main.getInstance().getTitle(player);
if(group == null){
     return;
}
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
PlayerSkill pSkills = Main.getInstance().pSkills.get(player.getUniqueId().toString());
int mainLevel = pSkills.getLevelHandler().getLevel();
String gName = group.getPrefix();
String prefix = Main.getInstance().getConfig().getString("name-format-1");
String level = Main.getInstance().getConfig().getString("name-format-2").replace("%level%", String.valueOf(mainLevel));
prefix = prefix.replace("%Group-Pre%", gName);
prefix = prefix.replace("%GroupPre%", gName);
prefix = ChatColor.translateAlternateColorCodes('&', prefix);
if(prefix.length() > 16){
     Bukkit.getLogger().severe("HEYO! Too long there for the prefix...." + prefix.length());
     return;
}
level = ChatColor.translateAlternateColorCodes('&', level);
if(!player.hasPermission("rpg.noshow")){
     NametagAPI.setPrefix(player.getName(), prefix);
     NametagAPI.setSuffix(player.getName(), level);
}

Again, thanks in advance for any responses and I can provide more information if needed. Our in-house developer and no one on our team can work out how the CPU keeps spiking around 15-40% each time a player leaves. We believe it is to do with the plugin accessing the files.

Thanks, Luke.

Was it helpful?

Solution

From what it appears to be is the outside plugin NameTagAPI. I can say for sure it's that because of its massive amount of player packets it has to send, and the fact you call it onJoin makes it even more clear that's the issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top