Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
samolego committed Jun 18, 2021
1 parent 135211c commit db4bedd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.samo_lego.fabrictailor.mixin;

import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.network.ClientConnection;
import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ServerPlayerEntity;
Expand All @@ -22,7 +21,7 @@ public abstract class MixinPlayerManager {
shift = At.Shift.AFTER
)
)
private void onPlayerConnect(ClientConnection clientConnection, ServerPlayerEntity player, CallbackInfo ci) throws CommandSyntaxException {
private void onPlayerConnect(ClientConnection clientConnection, ServerPlayerEntity player, CallbackInfo ci) {
String value = ((TailoredPlayer) player).getSkinValue();
String signature = ((TailoredPlayer) player).getSkinSignature();
if(value == null || signature == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,5 @@ private void readCustomDataFromNbt(NbtCompound tag, CallbackInfo ci) {
this.setSkin(this.skinValue, this.skinSignature, false);
}
}
/*if(this.skinValue == null || this.skinSignature == null) {
System.out.println("Fetching skin! ");
fetchSkinByName(player, player.getGameProfile().getName(), false);
}*/
}
}
13 changes: 7 additions & 6 deletions src/main/java/org/samo_lego/fabrictailor/util/SkinFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,25 +122,26 @@ public static void fetchSkinByName(ServerPlayerEntity player, String playername,

SkullBlockEntity.loadProperties(profile, gameProfile -> {
PropertyMap propertyMap = gameProfile.getProperties();
MinecraftServer server = player.getServer();

// We check if player is online as well as there is
// edge case when skin for your own self doesn't get fetched (#30)
if(propertyMap.containsKey("textures") && server != null && server.getPlayerManager().getPlayer(playername) == null) {
if(propertyMap.containsKey("textures")) {
Property textures = propertyMap.get("textures").iterator().next();
String value = textures.getValue();
String signature = textures.getSignature();
if(
TATERZENS_LOADED && TaterzensCompatibility.setTaterzenSkin(player, value, signature) ||
(((TailoredPlayer) player).setSkin(value, signature, true) && giveFeedback)
!value.equals("") && !signature.equals("") &&
(
TATERZENS_LOADED && TaterzensCompatibility.setTaterzenSkin(player, value, signature) ||
(((TailoredPlayer) player).setSkin(value, signature, true) && giveFeedback)
)
) {
player.sendMessage(
new TranslatedText("command.fabrictailor.skin.set.success").formatted(Formatting.GREEN),
false
);
return;
}

return;
}
// Getting skin data from ely.by api, since it can be used with usernames
// it also includes mojang skins
Expand Down

0 comments on commit db4bedd

Please sign in to comment.