Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Chat: fix noRecipient message to be after main message
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Dec 22, 2023
1 parent c0664ab commit 822b3e7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ && isUrlAllowed(sender, word)
if (valueStats != null && valueStats.equals(word)) {
return processStats(wordParams, sender);
}

String valueSkin = formattingMap.get("skin");
if (isAsync && valueSkin != null && valueSkin.equals(word)) {
return processSkin(wordParams, sender);
}
}

wordParams.addParameters(textParameters.getParameters());
Expand Down Expand Up @@ -385,6 +390,19 @@ public WordParams processStats(@NotNull WordParams wordParams, @NotNull Player s
return wordParams;
}

public WordParams processSkin(@NotNull WordParams wordParams, @NotNull Player sender) {
String playerAvatar = PlayerUtil.constructAvatarUrl(sender);
FImageComponent fImageComponent = new FImageComponent(playerAvatar);
if (!fImageComponent.isCorrect()) return wordParams;
wordParams.setImageComponent(fImageComponent);
wordParams.setImage(true);

String word = config.getVaultString(sender, this + ".list.skin.format")
.replace("<message>", sender.getName());
wordParams.setText(word);
return wordParams;
}

public WordParams processMarkdownHide(@NotNull WordParams wordParams, @Nullable CommandSender sender, @NotNull String word) {
wordParams.setHide(true);

Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ default:
enable: true
trigger: "%stats%"

skin:
enable: true
trigger: "%skin%"
format: "&&1🎨<message>.png"

url:
enable: true
hover:
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ permissions:
default: true
flectonechat.player-message.formatting.stats:
default: true
flectonechat.player-message.formatting.skin:
default: true
flectonechat.player-message.formatting.url:
default: true
flectonechat.player-message.formatting.markdown-url:
Expand Down

0 comments on commit 822b3e7

Please sign in to comment.