mirror of
https://github.com/Suiranoil/SkinRestorer.git
synced 2026-01-16 04:42:12 +00:00
inject at cancel-safe position
This commit is contained in:
@@ -26,15 +26,19 @@ public abstract class ServerLoginPacketListenerImplMixin {
|
|||||||
@Unique
|
@Unique
|
||||||
private CompletableFuture<Void> skinrestorer$pendingSkin;
|
private CompletableFuture<Void> skinrestorer$pendingSkin;
|
||||||
|
|
||||||
@Inject(method = "handleAcceptedLogin", at = @At(value = "INVOKE",
|
@Shadow
|
||||||
target = "Lnet/minecraft/server/players/PlayerList;canPlayerLogin(Ljava/net/SocketAddress;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/network/chat/Component;"),
|
protected abstract GameProfile createFakeProfile(GameProfile original);
|
||||||
cancellable = true)
|
|
||||||
|
@Inject(method = "handleAcceptedLogin", at = @At(value = "HEAD"), cancellable = true)
|
||||||
public void waitForSkin(CallbackInfo ci) {
|
public void waitForSkin(CallbackInfo ci) {
|
||||||
if (skinrestorer$pendingSkin == null) {
|
if (skinrestorer$pendingSkin == null) {
|
||||||
skinrestorer$pendingSkin = CompletableFuture.supplyAsync(() -> {
|
skinrestorer$pendingSkin = CompletableFuture.supplyAsync(() -> {
|
||||||
final var profile = gameProfile;
|
var profile = gameProfile;
|
||||||
|
|
||||||
assert profile != null;
|
assert profile != null;
|
||||||
|
|
||||||
|
if (!profile.isComplete())
|
||||||
|
profile = createFakeProfile(profile);
|
||||||
|
|
||||||
var originalSkin = PlayerUtils.getPlayerSkin(profile);
|
var originalSkin = PlayerUtils.getPlayerSkin(profile);
|
||||||
|
|
||||||
if (SkinRestorer.getSkinStorage().hasSavedSkin(profile.getId())) {
|
if (SkinRestorer.getSkinStorage().hasSavedSkin(profile.getId())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user