-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(SkinHandler): SkinsRestorer custom skins hook
- Loading branch information
1 parent
2dc6ab2
commit 5762022
Showing
10 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
core/src/main/java/com/georgev22/skinoverlay/hook/SkinHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.georgev22.skinoverlay.hook; | ||
|
||
import com.georgev22.skinoverlay.utilities.player.PlayerObject; | ||
import com.mojang.authlib.properties.Property; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface SkinHook { | ||
|
||
Property getProperty(@NotNull PlayerObject playerObject); | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
core/src/main/java/com/georgev22/skinoverlay/hook/hooks/SkinsRestorerHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.georgev22.skinoverlay.hook.hooks; | ||
|
||
import com.georgev22.skinoverlay.hook.SkinHook; | ||
import com.georgev22.skinoverlay.utilities.player.PlayerObject; | ||
import com.mojang.authlib.properties.Property; | ||
import net.skinsrestorer.api.SkinsRestorerAPI; | ||
import net.skinsrestorer.api.property.IProperty; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class SkinsRestorerHook implements SkinHook { | ||
|
||
|
||
private final SkinsRestorerAPI skinsRestorerAPI; | ||
|
||
public SkinsRestorerHook() { | ||
skinsRestorerAPI = SkinsRestorerAPI.getApi(); | ||
} | ||
|
||
@Override | ||
public Property getProperty(@NotNull PlayerObject playerObject) { | ||
IProperty iProperty = skinsRestorerAPI.getSkinData(skinsRestorerAPI.getSkinName(playerObject.playerName())); | ||
if (iProperty == null) { | ||
throw new RuntimeException(); | ||
} | ||
return new Property(iProperty.getName(), iProperty.getValue(), iProperty.getSignature()); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters