2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2025-04-20 01:27:07 +00:00

Add User-Agent header to PlayerDB lookup requests

This commit is contained in:
Daniel Voort 2023-07-16 15:22:58 +02:00
parent 60e9e2acbd
commit f598f5bf2d

View File

@ -29,7 +29,11 @@ public class NameFetcher {
public static String getName(UUID uuid) throws IOException { public static String getName(UUID uuid) throws IOException {
String url = "https://playerdb.co/api/player/minecraft/" + uuid.toString(); String url = "https://playerdb.co/api/player/minecraft/" + uuid.toString();
Request request = new Request.Builder().url(url).get().build(); Request request = new Request.Builder()
.addHeader("User-Agent", "RedisBungee-ProxioDev")
.url(url)
.get()
.build();
ResponseBody body = httpClient.newCall(request).execute().body(); ResponseBody body = httpClient.newCall(request).execute().body();
String response = body.string(); String response = body.string();
body.close(); body.close();