nikosgram / gringotts

Gringotts is an item-based economy plugin for the Bukkit Minecraft server platform. Unlike earlier economy plugins, all currency value and money transactions are based on actual items in Minecraft, per default emeralds.
https://www.spigotmc.org/resources/gringotts.42071/
BSD 2-Clause "Simplified" License
43 stars 35 forks source link

Reduce lag caused by getOfflinePlayer #114

Closed GroobleDierne closed 2 years ago

GroobleDierne commented 2 years ago

As Bukkit.getOfflinePlayer(String name) is doing a blocking web call, it is very slow and results in server freezes when there are many players online and plugins like Towny try to perform transactions. To reduce this impact I avoided calling Bukkit.getOfflinePlayer() multiple times in a row when the result can be stored.

To further address the problem, I would like to discuss with you what the use of accessing the balance of a player who never logged on is. And maybe suppress this feature or at least always return an empty balance without checking if the player exists.

GroobleDierne commented 2 years ago

I'm talking about removing this type of calls : https://github.com/nikosgram/gringotts/pull/114/files#diff-7e0ed99ba5fc2a5855d5890ce32119f9fecc05cd4d8bc2d2be18fc81e68c7edeL108

nikosgram commented 2 years ago

That sounds amazing :) Thank you for looking into it. <3

GroobleDierne commented 2 years ago

If you could add the hacktoberfest-accepted label to this PR it would be cool 😉 (https://hacktoberfest.com/)