Skip to content

Commit

Permalink
feat: Update skinsRestorerVersion to 15.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeV220 committed Nov 3, 2023
1 parent 5284cc9 commit 6f4bebd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import com.georgev22.skinoverlay.handler.SProperty;
import com.georgev22.skinoverlay.hook.SkinHook;
import com.georgev22.skinoverlay.utilities.player.PlayerObject;
import net.skinsrestorer.api.SkinsRestorerAPI;
import net.skinsrestorer.api.property.IProperty;
import net.skinsrestorer.api.SkinsRestorer;
import net.skinsrestorer.api.SkinsRestorerProvider;
import net.skinsrestorer.api.property.SkinProperty;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.IOException;
import java.util.Optional;
import java.util.concurrent.ExecutionException;

/**
Expand All @@ -23,7 +25,7 @@ public class SkinsRestorerHook implements SkinHook {
/**
* SkinsRestorerAPI object for accessing the SkinsRestorer API.
*/
private final SkinsRestorerAPI skinsRestorerAPI;
private final SkinsRestorer skinsRestorerAPI;

/**
* SkinOverlay object for accessing the SkinOverlay plugin.
Expand All @@ -35,7 +37,7 @@ public class SkinsRestorerHook implements SkinHook {
* Initializes the SkinsRestorerAPI object.
*/
public SkinsRestorerHook() {
skinsRestorerAPI = SkinsRestorerAPI.getApi();
skinsRestorerAPI = SkinsRestorerProvider.get();
}

/**
Expand All @@ -53,15 +55,8 @@ public SkinsRestorerHook() {
@Nullable
public SProperty getProperty(@NotNull PlayerObject playerObject) throws IOException, ExecutionException, InterruptedException {
try {
String skinName = skinsRestorerAPI.getSkinName(playerObject.playerName());
if (skinName == null) {
return null;
}
IProperty iProperty = skinsRestorerAPI.getSkinData(skinName);
if (iProperty == null) {
return null;
}
return new SProperty(iProperty.getName(), iProperty.getValue(), iProperty.getSignature());
Optional<SkinProperty> property = skinsRestorerAPI.getPlayerStorage().getSkinForPlayer(playerObject.playerUUID(), playerObject.playerName());
return property.map(skinProperty -> new SProperty(SkinProperty.TEXTURES_NAME, skinProperty.getValue(), skinProperty.getSignature())).orElse(null);
} catch (Exception exception) {
return skinOverlay.getDefaultSkinHook().getProperty(playerObject);
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ libraryLoaderVersion = 1.6.1
mineskinVersion = e00167583d
acfVersion = 0.5.1-G-3.0-SNAPSHOT
bstatsVersion = 3.0.2
skinsRestorerVersion = 14.2.10
skinsRestorerVersion = 15.0.3
adventureVersion = 4.14.0
adventurePlatformVersion = 4.3.0
log4jVersion = 2.20.0
Expand Down

0 comments on commit 6f4bebd

Please sign in to comment.