1
0
mirror of https://github.com/Suiranoil/SkinRestorer.git synced 2026-01-16 04:42:12 +00:00

use new variable for authenticatedProfile for easier backporting

This commit is contained in:
2024-09-24 08:02:22 +03:00
parent 7aa3316d0f
commit 48976117cb

View File

@@ -32,20 +32,22 @@ public abstract class ServerLoginPacketListenerImplMixin {
public void waitForSkin(CallbackInfo ci) {
if (skinrestorer$pendingSkin == null) {
skinrestorer$pendingSkin = CompletableFuture.supplyAsync(() -> {
assert authenticatedProfile != null;
var originalSkin = PlayerUtils.getPlayerSkin(authenticatedProfile);
final var profile = authenticatedProfile;
if (SkinRestorer.getSkinStorage().hasSavedSkin(authenticatedProfile.getId())) {
assert profile != null;
var originalSkin = PlayerUtils.getPlayerSkin(profile);
if (SkinRestorer.getSkinStorage().hasSavedSkin(profile.getId())) {
if (originalSkin != null) { // update to the latest official skin
var value = SkinRestorer.getSkinStorage().getSkin(authenticatedProfile.getId());
SkinRestorer.getSkinStorage().setSkin(authenticatedProfile.getId(), value.setOriginalValue(originalSkin));
var value = SkinRestorer.getSkinStorage().getSkin(profile.getId());
SkinRestorer.getSkinStorage().setSkin(profile.getId(), value.setOriginalValue(originalSkin));
}
if (SkinRestorer.getConfig().refreshSkinOnJoin()) {
var currentSkin = SkinRestorer.getSkinStorage().getSkin(authenticatedProfile.getId());
var currentSkin = SkinRestorer.getSkinStorage().getSkin(profile.getId());
var context = currentSkin.toProviderContext();
skinrestorer$fetchSkin(authenticatedProfile, context);
skinrestorer$fetchSkin(profile, context);
}
return null;
@@ -54,10 +56,10 @@ public abstract class ServerLoginPacketListenerImplMixin {
if (originalSkin == null && SkinRestorer.getConfig().fetchSkinOnFirstJoin()) {
var context = new SkinProviderContext(
SkinRestorer.getConfig().firstJoinSkinProvider().getName(),
authenticatedProfile.getName(),
profile.getName(),
null
);
skinrestorer$fetchSkin(authenticatedProfile, context);
skinrestorer$fetchSkin(profile, context);
}
return null;