Added confirmation message to mail sent

This commit is contained in:
Teriuihi 2022-02-15 03:07:56 +01:00
parent fa79491088
commit 59781f486d
2 changed files with 7 additions and 0 deletions

View File

@ -397,6 +397,7 @@ public final class Config {
public static String mailNoUser = "<red>A player with this name hasn't logged in recently.";
public static String mailReceived = "<yellow><click:run_command:/mail list unread>New mail from <sender>, click to view</click></yellow>";
public static String mailUnread = "<green><click:run_command:/mail list unread>You have <amount> unread mail, click to view it.</click></green>";
public static String mailSent = "<green>Successfully send mail to <player_name></green>: <#2e8b57><message></#2e8b57>";
public static List<String> mailCommandAlias = new ArrayList<>();
private static void mailSettings() {
mailHeader = getString("settings.mail.header", mailHeader);
@ -405,6 +406,7 @@ public final class Config {
mailCommandAlias = getList("settings.mail.command-aliases", Lists.newArrayList("gmail"));
mailReceived = getString("settings.mail.mail-received", mailReceived);
mailUnread = getString("settings.mail.mail-unread", mailUnread);
mailSent = getString("settings.mail.mail-sent", mailSent);
}
}

View File

@ -17,6 +17,7 @@ import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ServerConnection;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import net.kyori.adventure.text.minimessage.placeholder.Replacement;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import org.jetbrains.annotations.Nullable;
@ -211,6 +212,10 @@ public class ChatHandler {
Map<String, Replacement<?>> placeholders = new HashMap<>();
placeholders.put("sender", Replacement.miniMessage(senderName));
optionalPlayer.ifPresent(player -> player.sendMessage(Utility.parseMiniMessage(Config.mailReceived, placeholders)));
commandSource.sendMessage(Utility.parseMiniMessage(Config.mailSent,
Placeholder.component("player_name", chatUser.getDisplayName()),
Placeholder.miniMessage("message", message)
));
}
public void readMail(CommandSource commandSource, String targetPlayer) {