booksaw/BetterTeams

[BUG] Server pauses when using /team info

Closed this issue · 4 comments

What is the bug?

When using /team info <random characters> (/team info aiosjdoidsjfiojfpiokgrgvioperjgrejoij) it pauses the Server's Main Thread for a significant amount of time. This is because the entire command is running on the Main Thread of the Server and not on a different, async Thread to retreive the OfflinePlayer that doesn't exist. And because the OfflinePlayer doesn't exist, it will always continue to work, because it is not being cached. When spamming this command players are able to crash a server without any effort.

Expected Behaviour

It should not pause the Server. Everything should continue as normal and the Team should be retreived on an async Thread.

How to Reproduce

  1. Run Command /team info orifjhwoueishfuojshfuoishedf
  2. Watch the Server lag

Error message

No response

Output of /teama version

image

Additional Information

No response

Where have you got this plugin download, the version listed in the screenshot does not exist?

I have not downloaded this plugin myself, this is on a public Server called "ArmorUp". I got an admin of that server to do /teama version. They sent me that screenshot with the version. But I checked in the code of the current version and the issue still exists, as Bukkit.getOfflinePlayer(args[0]) is still called on the main Thread. Bukkit#getOfflinePlayer() is slow and lags the server because it needs to find the OfflinePlayer from a name. (Line 148 of InfoCommand.java in package com.booksaw.betterTeams.commands.team)

Please could you ask your admins to download the latest version from the betterteams plugin page (see here: https://www.spigotmc.org/resources/better-teams.17129/ ) and check if the issue still continues because the info command should already be run asynchronously (see line 59:

Bukkit.getScheduler().runTaskAsynchronously(Main.plugin, () -> {
)

Alright, he updated it and it is fixed. I just didn't see the async call in the Command file ;p