feat: do not cache skin reset

This commit is contained in:
aro 2023-01-19 20:08:10 +01:00
parent aba24384d5
commit 690aeadf67
7 changed files with 31 additions and 15 deletions

View file

@ -69,13 +69,17 @@ public class AppearanceManager {
final String defaultName = instance.getDataStore().getStoredName(player);
this.profile.setName(defaultName);
this.profile.setSkin(defaultName);
final ActionResult actionResult = updatePlayer(true);
final ActionResult actionResult = resetPlayer();
this.profile.setSkin(null);
this.profile.setName(null);
return actionResult;
}
public ActionResult resetPlayer() {
return NickoBukkit.getInstance().getInternals().updateProfile(player, profile, true, true);
}
public ActionResult updatePlayer(boolean skinChange) {
return NickoBukkit.getInstance().getInternals().updateProfile(player, profile, skinChange);
return NickoBukkit.getInstance().getInternals().updateProfile(player, profile, skinChange, false);
}
}

View file

@ -9,5 +9,5 @@ public interface Internals {
void updateOthers(Player player);
ActionResult updateProfile(Player player, NickoProfile profile, boolean skinChange);
ActionResult updateProfile(Player player, NickoProfile profile, boolean skinChange, boolean reset);
}

View file

@ -46,6 +46,10 @@ public class MojangAPI {
return cache.get(uuid);
}
public Optional<MojangSkin> getSkinWithoutCaching(String uuid) throws IOException {
return getSkinFromMojang(uuid);
}
public Optional<String> getUUID(String name) throws IOException {
final String parametrizedUrl = URL_NAME.replace("{name}", name);
final JsonObject object = getRequestToUrl(parametrizedUrl);