[FEAT] Way to get the real player name and avatar in Server embeds
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
version_major=0
|
||||
version_minor=0
|
||||
version_patch=57
|
||||
version_patch=58
|
||||
|
||||
shade_group=com.hypherionmc.sdlink.shaded.
|
||||
|
||||
|
@@ -36,6 +36,10 @@ public class DiscordAuthor {
|
||||
@Getter
|
||||
private GameProfile profile = null;
|
||||
|
||||
@Getter String realPlayerAvatar = "";
|
||||
|
||||
@Getter String realPlayerName = "";
|
||||
|
||||
/**
|
||||
* Internal. Use {@link #of(String, String, String)}
|
||||
*
|
||||
@@ -78,6 +82,16 @@ public class DiscordAuthor {
|
||||
);
|
||||
}
|
||||
|
||||
public DiscordAuthor setPlayerAvatar(String usr, String userid) {
|
||||
realPlayerAvatar = SDLinkConfig.INSTANCE.chatConfig.playerAvatarType.resolve(SDLinkPlatform.minecraftHelper.isOnlineMode() ? userid : usr);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DiscordAuthor setPlayerName(String name) {
|
||||
this.realPlayerName = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DiscordAuthor setGameProfile(GameProfile profile) {
|
||||
this.profile = profile;
|
||||
this.username = profile.getName();
|
||||
|
@@ -173,6 +173,8 @@ public final class DiscordMessage {
|
||||
.replace("%author%", this.author.getDisplayName())
|
||||
.replace("%avatar%", this.author.getAvatar())
|
||||
.replace("%message_contents%", this.message)
|
||||
.replace("%player_avatar%", this.author.getRealPlayerAvatar())
|
||||
.replace("%player_name%", this.author.getRealPlayerName())
|
||||
.replace("%username%", this.author.getUsername());
|
||||
|
||||
DataObject object = DataObject.fromJson(embedJson);
|
||||
|
Reference in New Issue
Block a user