[SPIGOT-1424] The function scoreboard.getPlayers() needs very long to execute! Created: 16/Jan/16  Updated: 29/Jan/16  Resolved: 29/Jan/16

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Lukas A Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: GetPlayers, Scoreboard
Environment:

I've got an Windows 10 PC with an Intel 4790k processor and the minecraft server has about 1 GB of RAM.



 Description   

I want to use scoreboards in my plugin. So I found the scoreboard.getPlayers() method and so I used it. But my plugin caused heavy lags on the server, so I found out, that these lags were caused by this method. It takes about 2 to 7 seconds to execute this method. I'm using now scoreboard.getEntries() method, but it seem to be bug, that the other method causes so much lag.



 Comments   
Comment by Phoenix616 [ 16/Jan/16 ]

Scoreboard.getPlayers() is deprecated for a reason: it creates a new OfflinePlayer object for each entry (even the ones that aren't players) instead of just giving you the names like Scoreboard.getEntries() does. That might be the reason it's taking so long es it does need to read all the player files. Best practice would be to completely avoid deprecated methods.

Comment by SpigotMC [ 16/Jan/16 ]

Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 1 version(s) behind. CraftBukkit is 3 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.

Generated at Sat Dec 13 11:50:20 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.