Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PlayerDB.co for name lookups #82

Merged
merged 3 commits into from
Jul 18, 2023
Merged

Conversation

Techdaan
Copy link
Contributor

@Techdaan Techdaan commented Jul 12, 2023

I noticed that currently name lookups for UUIDs that are not cached, are not supported in RedisBungee due to Mojang removing name history.

When looking at the usages, RedisBungee internally only uses the current name (So no need for full name historyy), so I moved name lookups to PlayerDB, which does not have API rate limits unlike Mojang's API.

Due to removing the NameFetcher#nameHistoryFromUuid, this might break backwards compatibility, but it should be easy to re-add the method and throw an exception like it does now.

closes #59

@ham1255 ham1255 self-assigned this Jul 16, 2023
@ham1255 ham1255 added enhancement New feature or request all platforms labels Jul 16, 2023
@ham1255
Copy link
Member

ham1255 commented Jul 16, 2023

before merging, does this api provider need any kind of tos agreement?

anyways we might need to set user agent based on info provided in the site.

Other Information

The API has no rate limits in place, but we ask that you please include an identifying user-agent header in any requests that you make to the API, so we can contact you if necessary about your usage.

@ham1255 ham1255 removed their assignment Jul 16, 2023
@Techdaan
Copy link
Contributor Author

Yeah, I don't think there's any TOS agreements but I did forget to set an user agent.

Do you have any suggestions for the User-Agent header? Since this is a form, RedisBungee might be too vague, perhaps something like RedisBungee-ProxioDev?

@ham1255
Copy link
Member

ham1255 commented Jul 16, 2023

One you suggested seems to be great

@Techdaan
Copy link
Contributor Author

I just made the change, I haven't tested it yet though because I am currently busy with some other things. If you want to, I can make sure there's no errors when lookups are made later.

@ham1255
Copy link
Member

ham1255 commented Jul 16, 2023

Done some testing it seems like its working and fetches the name perfectly.

fixes: #59

@ham1255
Copy link
Member

ham1255 commented Jul 16, 2023

before merging this you can include this code in name fetcher class to maintain compatibility .

public static List<String> nameHistoryFromUuid(UUID uuid) throws IOException {
        String name = getName(uuid);
        if (name == null) return Collections.emptyList();
        return Collections.singletonList(name);
    }

for some reason ssh connections being dropped

@Techdaan
Copy link
Contributor Author

Heyhey, I missed your message earlier. I just added that snippet :)

@ham1255 ham1255 merged commit 99941c7 into ProxioDev:develop Jul 18, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
all platforms enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mojang Deprecated APIs (NameFetcher)
2 participants