From 96701b44d46ddec093808ab10058c62485976e12 Mon Sep 17 00:00:00 2001
From: Joe Shimell <49585339+JoeShimell@users.noreply.github.com>
Date: Sat, 27 Feb 2021 14:59:17 +0000
Subject: [PATCH] added crafatar as a secondary option for displaying players'
skins
---
pom.xml | 2 +-
src/main/java/uk/co/angrybee/joe/DiscordClient.java | 6 +++++-
src/main/java/uk/co/angrybee/joe/VersionInfo.java | 2 +-
.../uk/co/angrybee/joe/commands/discord/CommandAdd.java | 7 ++++++-
src/main/java/uk/co/angrybee/joe/configs/MainConfig.java | 2 ++
src/main/resources/plugin.yml | 2 +-
6 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index f9006bf..82cadcd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
uk.co.angrybee.joe
discord-whitelister
- 1.4.5
+ 1.4.6
discord-whitelister
https://github.com/JoeShimell/DiscordWhitelisterSpigot
diff --git a/src/main/java/uk/co/angrybee/joe/DiscordClient.java b/src/main/java/uk/co/angrybee/joe/DiscordClient.java
index ea17f96..afd3b8a 100644
--- a/src/main/java/uk/co/angrybee/joe/DiscordClient.java
+++ b/src/main/java/uk/co/angrybee/joe/DiscordClient.java
@@ -459,7 +459,11 @@ public class DiscordClient extends ListenerAdapter
if(DiscordWhitelister.showPlayerSkin)
{
String playerUUID = DiscordClient.minecraftUsernameToUUID(finalNameToRemove);
- embedBuilderSuccess.setThumbnail("https://minotar.net/armor/bust/" + playerUUID + "/100.png");
+
+ if(!MainConfig.getMainConfig().getBoolean("use-crafatar-for-avatars"))
+ embedBuilderSuccess.setThumbnail("https://minotar.net/armor/bust/" + playerUUID + "/100.png");
+ else
+ embedBuilderSuccess.setThumbnail("https://crafatar.com/avatars/" + playerUUID + "?size=100&default=MHF_Steve&overlay.png");
}
EmbedBuilder embedBuilderFailure;
diff --git a/src/main/java/uk/co/angrybee/joe/VersionInfo.java b/src/main/java/uk/co/angrybee/joe/VersionInfo.java
index dfcc886..1796863 100644
--- a/src/main/java/uk/co/angrybee/joe/VersionInfo.java
+++ b/src/main/java/uk/co/angrybee/joe/VersionInfo.java
@@ -10,5 +10,5 @@ public class VersionInfo
return "v." + getVersion();
}
- private static String version = "1.4.5";
+ private static String version = "1.4.6";
}
diff --git a/src/main/java/uk/co/angrybee/joe/commands/discord/CommandAdd.java b/src/main/java/uk/co/angrybee/joe/commands/discord/CommandAdd.java
index b36fd68..fa0d1af 100644
--- a/src/main/java/uk/co/angrybee/joe/commands/discord/CommandAdd.java
+++ b/src/main/java/uk/co/angrybee/joe/commands/discord/CommandAdd.java
@@ -436,7 +436,12 @@ public class CommandAdd
DiscordClient.AddWhitelistRemainingCount(embedBuilderWhitelistSuccess, (timesWhitelisted + 1));
if(DiscordWhitelister.showPlayerSkin)
- embedBuilderWhitelistSuccess.setThumbnail("https://minotar.net/armor/bust/" + playerUUID + "/100.png");
+ {
+ if(!MainConfig.getMainConfig().getBoolean("use-crafatar-for-avatars"))
+ embedBuilderWhitelistSuccess.setThumbnail("https://minotar.net/armor/bust/" + playerUUID + "/100.png");
+ else
+ embedBuilderWhitelistSuccess.setThumbnail("https://crafatar.com/avatars/" + playerUUID + "?size=100&default=MHF_Steve&overlay.png");
+ }
EmbedBuilder embedBuilderWhitelistFailure;
diff --git a/src/main/java/uk/co/angrybee/joe/configs/MainConfig.java b/src/main/java/uk/co/angrybee/joe/configs/MainConfig.java
index f394fe2..d30a2d4 100644
--- a/src/main/java/uk/co/angrybee/joe/configs/MainConfig.java
+++ b/src/main/java/uk/co/angrybee/joe/configs/MainConfig.java
@@ -153,6 +153,8 @@ public class MainConfig
CheckEntry("hide-info-command-replies", false);
+ CheckEntry("use-crafatar-for-avatars", false);
+
// Remove old role entry if found, move role to new array (for people with v1.3.6 or below)
if(whitelisterBotConfig.get("whitelisted-role") != null)
{
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 9a42b4c..f6f95fe 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,5 +1,5 @@
name: DiscordWhitelister
-version: 1.4.5
+version: 1.4.6
author: Joe Shimell
main: uk.co.angrybee.joe.DiscordWhitelister
description: Discord Whitelister.