generated from axieum/fabric-example-mod
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat(chat): show player avatar on login, logout, death and teleport messages feat(cmds): show avatar in custom command feedback where a player is detected
- Loading branch information
Showing
9 changed files
with
189 additions
and
19 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
31 changes: 31 additions & 0 deletions
31
minecord-api/src/main/java/me/axieum/mcmod/minecord/impl/config/MiscConfig.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,31 @@ | ||
package me.axieum.mcmod.minecord.impl.config; | ||
|
||
import me.shedaniel.autoconfig.ConfigData; | ||
import me.shedaniel.autoconfig.annotation.Config; | ||
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Comment; | ||
import static net.dv8tion.jda.api.EmbedBuilder.URL_PATTERN; | ||
|
||
@Config(name = "misc") | ||
public class MiscConfig implements ConfigData | ||
{ | ||
@Comment("True if player avatars are included with embeds") | ||
public boolean enableAvatars = true; | ||
|
||
@Comment(""" | ||
The URL used for retrieving Minecraft player avatars | ||
Usages: ${username} and ${size} (height in pixels)""") | ||
public String avatarUrl = "https://minotar.net/helm/${username}/${size}"; | ||
|
||
@Override | ||
public void validatePostLoad() throws ValidationException | ||
{ | ||
// Validate the avatar URL is valid | ||
if (avatarUrl == null || avatarUrl.isBlank()) { | ||
throw new ValidationException("The avatar URL cannot be blank!"); | ||
} else if (avatarUrl.length() > 2000) { | ||
throw new ValidationException("The avatar URL cannot be longer than 2000 characters!"); | ||
} else if (!URL_PATTERN.matcher(avatarUrl).matches()) { | ||
throw new ValidationException("The avatar URL must be a valid http(s) or attachment url!"); | ||
} | ||
} | ||
} |
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