Skip to content

Commit

Permalink
rename default variant to classing
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Nov 23, 2024
1 parent 8b2048f commit bbf1c98
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ public void setTextureSignature(String textureSignature) {
public enum SkinVariant {
AUTO,
SLIM,
DEFAULT
CLASSIC
}
}
2 changes: 1 addition & 1 deletion src/main/java/de/oliver/fancynpcs/NpcManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public void loadNpcs() {
String signature = npcConfig.getString("npcs." + id + ".skin.signature");

if (value != null && !value.isEmpty() && signature != null && !signature.isEmpty()) {
SkinData oldSkin = new SkinData(skinIdentifier, SkinData.SkinVariant.DEFAULT, value, signature);
SkinData oldSkin = new SkinData(skinIdentifier, SkinData.SkinVariant.CLASSIC, value, signature);
FancyNpcs.getInstance().getSkinManagerImpl().getFileCache().addSkin(oldSkin);
FancyNpcs.getInstance().getSkinManagerImpl().getMemCache().addSkin(oldSkin);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/de/oliver/fancynpcs/skins/SkinManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public SkinData getByUUID(UUID uuid, SkinData.SkinVariant variant) {

SkinData skinData = new SkinData(
uuid.toString(),
SkinData.SkinVariant.DEFAULT,
SkinData.SkinVariant.CLASSIC,
skinInfo.texture().data().value(),
skinInfo.texture().data().signature()
);
Expand Down Expand Up @@ -133,7 +133,7 @@ public SkinData getByUsername(String username, SkinData.SkinVariant variant) {

SkinData skinData = new SkinData(
uuid.toString(),
SkinData.SkinVariant.DEFAULT,
SkinData.SkinVariant.CLASSIC,
skinInfo.texture().data().value(),
skinInfo.texture().data().signature()
);
Expand Down Expand Up @@ -166,7 +166,7 @@ public SkinData getByURL(String url, SkinData.SkinVariant variant) {

SkinData skinData = new SkinData(
url,
SkinData.SkinVariant.DEFAULT,
SkinData.SkinVariant.CLASSIC,
skinInfo.texture().data().value(),
skinInfo.texture().data().signature()
);
Expand Down Expand Up @@ -198,7 +198,7 @@ public SkinData getByFile(String filePath, SkinData.SkinVariant variant) {

SkinData skinData = new SkinData(
filePath,
SkinData.SkinVariant.DEFAULT,
SkinData.SkinVariant.CLASSIC,
skinInfo.texture().data().value(),
skinInfo.texture().data().signature()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SkinCacheFile implements SkinCache {
private final JDB storage;

public SkinCacheFile() {
this.storage = new JDB("plugins/FancyNpcs/.skinCache");
this.storage = new JDB("plugins/FancyNpcs/.cache");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void testSkinByUUID(Player player) {

expect(skin).toBeDefined();
expect(skin.getIdentifier()).toEqual(player.getUniqueId().toString());
expect(skin.getVariant()).toEqual(SkinData.SkinVariant.DEFAULT);
expect(skin.getVariant()).toEqual(SkinData.SkinVariant.CLASSIC);
expect(skin.getTextureValue()).toBeDefined();
expect(skin.getTextureValue().length()).toBeGreaterThan(0);
expect(skin.getTextureSignature()).toBeDefined();
Expand All @@ -41,7 +41,7 @@ public void testSkinByUsername(Player player) {

expect(skin).toBeDefined();
expect(skin.getIdentifier()).toEqual(player.getName());
expect(skin.getVariant()).toEqual(SkinData.SkinVariant.DEFAULT);
expect(skin.getVariant()).toEqual(SkinData.SkinVariant.CLASSIC);
expect(skin.getTextureValue()).toBeDefined();
expect(skin.getTextureValue().length()).toBeGreaterThan(0);
expect(skin.getTextureSignature()).toBeDefined();
Expand All @@ -53,7 +53,7 @@ public void testSkinByURL(Player player) {

expect(skin).toBeDefined();
expect(skin.getIdentifier()).toEqual("https://s.namemc.com/i/de7d8a3ffd1f584c.png");
expect(skin.getVariant()).toEqual(SkinData.SkinVariant.DEFAULT);
expect(skin.getVariant()).toEqual(SkinData.SkinVariant.CLASSIC);
expect(skin.getTextureValue()).toBeDefined();
expect(skin.getTextureValue().length()).toBeGreaterThan(0);
expect(skin.getTextureSignature()).toBeDefined();
Expand All @@ -67,23 +67,12 @@ public void testSkinByFile(Player player) {

expect(skin).toBeDefined();
expect(skin.getIdentifier()).toEqual("plugins/FancyNpcs/testskin.png");
expect(skin.getVariant()).toEqual(SkinData.SkinVariant.DEFAULT);
expect(skin.getVariant()).toEqual(SkinData.SkinVariant.CLASSIC);
expect(skin.getTextureValue()).toBeDefined();
expect(skin.getTextureValue().length()).toBeGreaterThan(0);
expect(skin.getTextureSignature()).toBeDefined();
expect(skin.getTextureSignature().length()).toBeGreaterThan(0);

new File("plugins/FancyNpcs/testskin.png").delete();
}

@FNTest(name = "Test get skin")
public void testGetSkin(Player player) {
SkinData skin = skinFetcher.get("skinname", "value", "signature", SkinData.SkinVariant.AUTO);

expect(skin).toBeDefined();
expect(skin.getIdentifier()).toEqual("skinname");
expect(skin.getVariant()).toEqual(SkinData.SkinVariant.DEFAULT);
expect(skin.getTextureValue()).toEqual("value");
expect(skin.getTextureSignature()).toEqual("signature");
}
}

0 comments on commit bbf1c98

Please sign in to comment.