CC007 / HeadsPluginAPI

The documentation and wiki for the HeadsPluginAPI plugin
MIT License
5 stars 0 forks source link

GameProfile now requires both the id and name #31

Closed CC007 closed 11 months ago

CC007 commented 12 months ago

Issue

A user of the puglin found an issue on a PurpurMC 1.20.2 server (version 2074)

afbeelding

Cause

It seems that Mojang changes something in their GameProfile class: In Mojang authlib version 4.0.43:

public GameProfile(final UUID id, final String name) {
    this.properties = new PropertyMap();
    if (id == null && StringUtils.isBlank((CharSequence)name)) {
        throw new IllegalArgumentException("Name and ID cannot both be blank");
    }
    this.id = id;
    this.name = name;
}

In authlib version 5.0.47 (the version in your Purpur server):

public GameProfile(final UUID id, final String name) {
    this.properties = new PropertyMap();
    this.id = Objects.requireNonNull(id, "Profile ID must not be null");
    this.name = Objects.requireNonNull(name, "Profile name must not be null");
}

To summarize the changes: In the old version id OR name had to be filled in (both is fine too). In the new version id AND name have to be provided. I only provided the id, so that's why it works for the old version, but breaks in the new version.

Versions

Minecraft version: 1.20.2, using purpur 2074 Java version: 17 HeadsPluginAPI version: 3.2.0 HeadsInventory version: 1.11.1