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

Merge branch '1.20-multiloader' into 1.19.4-multiloader

This commit is contained in:
2025-07-09 21:52:48 +03:00
7 changed files with 37 additions and 7 deletions

View File

@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.4.1] - 2025-07-09
### Changed
- Log full exception and argument when unable to fetch/set skin
### Fixed
- Fixed mojang provider using offline uuids when unable to fetch actual uuid resulting in `no profile with uuid` error
## [2.4.0] - 2025-07-05
### Fixed
- Added support for player heads

View File

@@ -1,2 +1,4 @@
### Added
- Added support for player heads
### Changed
- Log full exception and argument when unable to fetch/set skin
### Fixed
- Fixed mojang provider using offline uuids when unable to fetch actual uuid resulting in `no profile with uuid` error

View File

@@ -1,10 +1,12 @@
package net.lionarius.skinrestorer;
import com.google.common.base.Throwables;
import com.mojang.authlib.GameProfile;
import com.mojang.brigadier.CommandDispatcher;
import net.lionarius.skinrestorer.command.SkinCommand;
import net.lionarius.skinrestorer.config.Config;
import net.lionarius.skinrestorer.config.provider.BuiltInProviderConfig;
import net.lionarius.skinrestorer.exception.TransparentException;
import net.lionarius.skinrestorer.platform.Services;
import net.lionarius.skinrestorer.skin.SkinIO;
import net.lionarius.skinrestorer.skin.SkinStorage;
@@ -147,7 +149,7 @@ public final class SkinRestorer {
var skinResult = result.get();
if (skinResult.isError())
return Result.<Collection<ServerPlayer>, String>error(skinResult.getErrorValue().getMessage());
throw new TransparentException(Throwables.getRootCause(skinResult.getErrorValue()));
var skinValue = SkinValue.fromProviderContextWithValue(context, skinResult.getSuccessValue().orElse(null));
@@ -156,7 +158,7 @@ public final class SkinRestorer {
return Result.<Collection<ServerPlayer>, String>success(acceptedPlayers);
}, server)
.exceptionally(e -> {
SkinRestorer.LOGGER.error(e.toString());
SkinRestorer.LOGGER.error("Failed to set skin '{}:{}'", context.name(), context.argument(), e);
return Result.error(e.getMessage());
});
}

View File

@@ -0,0 +1,19 @@
package net.lionarius.skinrestorer.exception;
import org.jetbrains.annotations.NotNull;
public class TransparentException extends RuntimeException {
public TransparentException(@NotNull Throwable cause) {
super(cause);
}
@Override
public String getMessage() {
return this.getCause().getMessage();
}
@Override
public String toString() {
return this.getLocalizedMessage();
}
}

View File

@@ -86,7 +86,7 @@ public abstract class ServerLoginPacketListenerImplMixin {
var value = SkinValue.fromProviderContextWithValue(context, result.getSuccessValue().orElse(null));
SkinRestorer.getSkinStorage().setSkin(profile.getId(), value);
} else {
SkinRestorer.LOGGER.warn("Failed to fetch skin: {}", result.getErrorValue().getMessage());
SkinRestorer.LOGGER.warn("Failed to fetch skin '{}:{}'", context.name(), context.argument(), result.getErrorValue());
}
}
}

View File

@@ -9,6 +9,7 @@ import com.mojang.authlib.properties.Property;
import com.mojang.authlib.yggdrasil.YggdrasilEnvironment;
import com.mojang.authlib.yggdrasil.response.MinecraftProfilePropertiesResponse;
import net.lionarius.skinrestorer.SkinRestorer;
import net.lionarius.skinrestorer.exception.TransparentException;
import net.lionarius.skinrestorer.skin.SkinVariant;
import net.lionarius.skinrestorer.util.*;
import net.minecraft.server.players.GameProfileCache;
@@ -51,7 +52,7 @@ public final class MojangSkinProvider implements SkinProvider {
var profile = MojangSkinProvider.getProfile(name);
callback.onProfileLookupSucceeded(profile);
} catch (IOException e) {
callback.onProfileLookupFailed(new GameProfile(null, name), e);
throw new TransparentException(e);
}
}
}, SkinRestorer.getConfigDir().resolve(PROFILE_CACHE_FILENAME).toFile());

View File

@@ -8,7 +8,7 @@ minecraft_version_list=1.19.4
minecraft_version_range=[1.19.4,1.20)
mod_id=skinrestorer
mod_name=SkinRestorer
mod_version=2.4.0
mod_version=2.4.1
mod_author=Lionarius
mod_homepage=https://modrinth.com/mod/skinrestorer
mod_sources=https://github.com/Suiranoil/SkinRestorer