Server.createProfile(String name) should not trigger an UUID lookup #881
Comments
Fixes GlowstoneMC#881. Server.createProfile() now returns immediately, but GlowPlayerProfile.getId() may block.
@Minecrell Could you please test #882 as a fix? If it doesn't fix, then it probably at least mitigates the delay. To get a version with the change, go to https://circleci.com/gh/Pr0methean/Glowstone/tree/uuid, click the newest build, then it's under Artifacts. |
@Pr0methean The issue title was correct: it should not trigger an UUID lookup at all. It doesn't matter if it's blocking or not. Your fix improves the situation somewhat, because it no longer throws an exception if the UUID cannot be found. But it's not the correct fix: It will still block for ~250ms on the first run because the code in
The |
Please re-open this issue. As mentioned above, the issue is not fixed in #882. |
@Minecrell Is there some reason not to do the lookup eagerly, once getId() is made non-blocking? The worst case is that we waste a few bytes of bandwidth and, if fully utilizing the CPU, slightly delay another async task on |
@Pr0methean I believe it's for fake players where this is no point to looking it up. As stated, |
@mastercoms is right, but in this case, the usage doesn't really matter. This is just about implementing the API correctly (granted, the Javadocs on some methods could be more clear).
The main question is if having |
I'll overload |
Problematic code:
Glowstone/src/main/java/net/glowstone/GlowServer.java
Lines 1689 to 1697 in 911ba9e
This should not lookup the UUID for the given name.
PlayerProfile
is defined to have at least either the UUID or name defined, but not necessarily both. This code may be used with names that don't really exist, and therefore shouldn't trigger an UUID lookup.An example for such usage is the new
PaperServerListPingEvent
added in PaperMC/Paper#980. FakePlayerProfile
s may be used to display custom messages in the list of players displayed when hovering the player count in the server list.I've ported
PaperServerListPingEvent
to Glowstone in #880, and running ServerListPlus on it then results in a significant delay and the following error: https://gist.github.com/Minecrell/448ad637b2e9d033b1864f522da8d773 because it is looking up the fake profile.It seems like this was done in #817 because
GlowPlayerProfile
doesn't support having no UUID defined (see #817 (comment)). However, it should be refactored to support this to match the API specifications.This is needed for #880.
The text was updated successfully, but these errors were encountered: