Compare commits

...

2 Commits

Author SHA1 Message Date
Len ea705c879f Allow nick request from nick preview message 2025-02-07 20:45:21 +01:00
Len f5c0a0676c Delay unread mail message and also send it as a title message 2025-02-07 20:44:59 +01:00
3 changed files with 18 additions and 5 deletions

View File

@ -424,6 +424,7 @@ public final class Config {
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<>();
public static int mailDisplayDelay = 5;
private static void mailSettings() {
mailHeader = getString("settings.mail.header", mailHeader);
mailBody = getString("settings.mail.message", mailBody);
@ -432,6 +433,7 @@ public final class Config {
mailReceived = getString("settings.mail.mail-received", mailReceived);
mailUnread = getString("settings.mail.mail-unread", mailUnread);
mailSent = getString("settings.mail.mail-sent", mailSent);
mailDisplayDelay = getInt("settings.mail.delay", mailDisplayDelay);
}
public static HashMap<String, Long> serverChannelId = new HashMap<>();
@ -503,7 +505,7 @@ public final class Config {
public static String NICK_TOO_SOON = "<red>Please wait <time><red> until requesting a new nickname";
public static String NICK_REQUEST_PLACED = "<green>Replaced your previous request <oldrequestednick><green> with <newrequestednick><green>.";
public static String NICK_REQUEST_NEW = "<green>New nickname request by <player><green>!";
public static String NICK_TRYOUT = "<white><prefix><white> <nick><gray>: <white>Hi, this is what my new nickname could look like!";
public static String NICK_TRYOUT = "<white><prefix><white> <nick><gray>: <white><click:suggest_command:/nick request <nickrequest>>Hi, this is what my new nickname could look like! Click this message to request.";
public static String NICK_REQUESTED = "<green>Your requested to be nicknamed <nick><green> has been received. Staff will accept or deny this request asap!";
public static String NICK_REVIEW_WAITING = "<green>There are <amount> nicknames waiting for review!";
public static String NICK_TAKEN = "<red>Someone else already has this nickname, or has this name as their username.";

View File

@ -95,7 +95,8 @@ public class Nicknames implements CommandExecutor, TabCompleter {
sender.sendMessage(Utility.parseMiniMessage(Config.NICK_TRYOUT,
Placeholder.component("prefix", Utility.applyColor(api.getUserManager().getUser(player.getUniqueId())
.getCachedData().getMetaData().getPrefix())), // TODO pull this from chatuser?
Placeholder.component("nick", Utility.applyColor(args[1]))));
Placeholder.component("nick", Utility.applyColor(args[1])),
Placeholder.unparsed("nickrequest", args[1])));
}
} else {
sender.sendMessage(Utility.parseMiniMessage(Config.NICK_NO_LUCKPERMS));

View File

@ -23,8 +23,10 @@ import com.velocitypowered.api.proxy.server.RegisteredServer;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import net.kyori.adventure.title.Title;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class ProxyPlayerListener {
@ -68,9 +70,17 @@ public class ProxyPlayerListener {
List<Mail> unReadMail = chatUser.getUnReadMail();
if (unReadMail.isEmpty())
return;
player.sendMessage(Utility.parseMiniMessage(Config.mailUnread,
Placeholder.unparsed("amount", String.valueOf(unReadMail.size()))
));
VelocityChat plugin = VelocityChat.getPlugin();
plugin.getProxy().getScheduler().buildTask(plugin, () -> {
if (!player.isActive())
return;
Component message = Utility.parseMiniMessage(Config.mailUnread,
Placeholder.unparsed("amount", String.valueOf(unReadMail.size())));
player.sendMessage(message);
player.showTitle(Title.title(message, Component.empty()));
}).delay(Config.mailDisplayDelay * 50L, TimeUnit.MILLISECONDS).schedule();
}
@Subscribe