Add support for custom channel aliases and improve string formatting consistency

This commit is contained in:
akastijn 2025-07-29 19:11:14 +02:00
parent eb30750134
commit 3bfd358e78
3 changed files with 117 additions and 62 deletions

View File

@ -38,9 +38,9 @@ public final class Config {
CONFIGPATH = new File(File.separator + "mnt" + File.separator + "configs" + File.separator + "ChatPlugin"); CONFIGPATH = new File(File.separator + "mnt" + File.separator + "configs" + File.separator + "ChatPlugin");
CONFIG_FILE = new File(CONFIGPATH, "config.yml"); CONFIG_FILE = new File(CONFIGPATH, "config.yml");
configLoader = YamlConfigurationLoader.builder() configLoader = YamlConfigurationLoader.builder()
.file(CONFIG_FILE) .file(CONFIG_FILE)
.nodeStyle(NodeStyle.BLOCK) .nodeStyle(NodeStyle.BLOCK)
.build(); .build();
if (!CONFIG_FILE.getParentFile().exists()) { if (!CONFIG_FILE.getParentFile().exists()) {
if (!CONFIG_FILE.getParentFile().mkdirs()) { if (!CONFIG_FILE.getParentFile().mkdirs()) {
return; return;
@ -182,11 +182,12 @@ public final class Config {
private static void settings() { private static void settings() {
PREFIXGROUPS = getList("settings.prefix-groups", PREFIXGROUPS = getList("settings.prefix-groups",
Lists.newArrayList("discord", "socialmedia", "eventteam", "eventleader", "youtube", "twitch", "developer")); Lists.newArrayList("discord", "socialmedia", "eventteam", "eventleader", "youtube", "twitch",
"developer"));
CONFLICTINGPREFIXGROUPS = getList("settings.prefix-conflicts-groups", CONFLICTINGPREFIXGROUPS = getList("settings.prefix-conflicts-groups",
Lists.newArrayList("eventteam", "eventleader")); Lists.newArrayList("eventteam", "eventleader"));
STAFFGROUPS = getList("settings.staff-groups", STAFFGROUPS = getList("settings.staff-groups",
Lists.newArrayList("trainee", "moderator", "headmod", "admin", "manager", "owner")); Lists.newArrayList("trainee", "moderator", "headmod", "admin", "manager", "owner"));
CONSOLENAME = getString("settings.console-name", CONSOLENAME); CONSOLENAME = getString("settings.console-name", CONSOLENAME);
CONSOLEUUID = UUID.fromString(getString("settings.console-uuid", CONSOLEUUID.toString())); CONSOLEUUID = UUID.fromString(getString("settings.console-uuid", CONSOLEUUID.toString()));
MINIMIUMSTAFFRANK = getString("settings.minimum-staff-rank", MINIMIUMSTAFFRANK); MINIMIUMSTAFFRANK = getString("settings.minimum-staff-rank", MINIMIUMSTAFFRANK);
@ -196,8 +197,10 @@ public final class Config {
public static List<String> MESSAGECOMMANDALIASES = new ArrayList<>(); public static List<String> MESSAGECOMMANDALIASES = new ArrayList<>();
public static List<String> REPLYCOMMANDALIASES = new ArrayList<>(); public static List<String> REPLYCOMMANDALIASES = new ArrayList<>();
public static String MESSAGESENDER = "<hover:show_text:Click to reply><click:suggest_command:/msg <receivername> ><light_purple>(Me -> <gray><receiver></gray>)</hover> <message>"; public static String MESSAGESENDER =
public static String MESSAGERECIEVER = "<hover:show_text:Click to reply><click:suggest_command:/msg <sendername> ><light_purple>(<gray><sender></gray> on <server> -> Me)</hover> <message>"; "<hover:show_text:Click to reply><click:suggest_command:/msg <receivername> ><light_purple>(Me -> <gray><receiver></gray>)</hover> <message>";
public static String MESSAGERECIEVER =
"<hover:show_text:Click to reply><click:suggest_command:/msg <sendername> ><light_purple>(<gray><sender></gray> on <server> -> Me)</hover> <message>";
public static String MESSAGESPY = "<gray>(<gray><sendername></gray> -> <receivername>) <message>"; public static String MESSAGESPY = "<gray>(<gray><sendername></gray> -> <receivername>) <message>";
public static String RECEIVER_DOES_NOT_EXIST = "<red><player> is not a valid player.</red>"; public static String RECEIVER_DOES_NOT_EXIST = "<red><player> is not a valid player.</red>";
@ -212,7 +215,8 @@ public final class Config {
RECEIVER_DOES_NOT_EXIST = getString("commands.message.receiver-does-not-exist", RECEIVER_DOES_NOT_EXIST); RECEIVER_DOES_NOT_EXIST = getString("commands.message.receiver-does-not-exist", RECEIVER_DOES_NOT_EXIST);
} }
public static String GCFORMAT = "<white><light_purple><prefix></light_purple> <gray><sender></gray> <hover:show_text:on <server>><yellow>to Global</yellow></hover><gray>: <message>"; public static String GCFORMAT =
"<white><light_purple><prefix></light_purple> <gray><sender></gray> <hover:show_text:on <server>><yellow>to Global</yellow></hover><gray>: <message>";
public static String GCPERMISSION = "proxy.globalchat"; public static String GCPERMISSION = "proxy.globalchat";
public static List<String> GCALIAS = new ArrayList<>(); public static List<String> GCALIAS = new ArrayList<>();
public static String GCNOTENABLED = "You don't have global chat enabled."; public static String GCNOTENABLED = "You don't have global chat enabled.";
@ -228,7 +232,8 @@ public final class Config {
GCCOOLDOWN = getInt("commands.globalchat.cooldown", GCCOOLDOWN); GCCOOLDOWN = getInt("commands.globalchat.cooldown", GCCOOLDOWN);
} }
public static String CHATFORMAT = "<white><light_purple><prefixall> <gray><hover:show_text:Click to message <sendername>><click:suggest_command:/msg <sendername> ><sender></hover>: <white><message>"; public static String CHATFORMAT =
"<white><light_purple><prefixall> <gray><hover:show_text:Click to message <sendername>><click:suggest_command:/msg <sendername> ><sender></hover>: <white><message>";
public static String URLFORMAT = "<click:OPEN_URL:<clickurl>><url></click>"; public static String URLFORMAT = "<click:OPEN_URL:<clickurl>><url></click>";
private static void Chat() { private static void Chat() {
@ -237,7 +242,8 @@ public final class Config {
} }
public static List<String> GACECOMMANDALIASES = new ArrayList<>(); public static List<String> GACECOMMANDALIASES = new ArrayList<>();
public static String GACFORMAT = "<hover:show_text:Click to reply><click:suggest_command:/acg ><yellow>(<sender> on <server> -> Team)</hover> <message>"; public static String GACFORMAT =
"<hover:show_text:Click to reply><click:suggest_command:/acg ><yellow>(<sender> on <server> -> Team)</hover> <message>";
private static void globalAdminChat() { private static void globalAdminChat() {
GACECOMMANDALIASES = getList("commands.globaladminchat.aliases", Lists.newArrayList("acg")); GACECOMMANDALIASES = getList("commands.globaladminchat.aliases", Lists.newArrayList("acg"));
@ -269,12 +275,14 @@ public final class Config {
} }
public static String PARTY_FORMAT = "<dark_aqua>(<gray><sender></gray><hover:show_text:\"on <server>\"> → <party></hover>) <message>"; public static String PARTY_FORMAT =
public static String PARTY_SPY = "<i><gray>PC:</gray><dark_gray> <dark_gray><username></dark_gray>: <dark_gray><party></dark_gray> <message></dark_gray></i>"; "<dark_aqua>(<gray><sender></gray><hover:show_text:\"on <server>\"> → <party></hover>) <message>";
public static String PARTY_SPY =
"<i><gray>PC:</gray><dark_gray> <dark_gray><username></dark_gray>: <dark_gray><party></dark_gray> <message></dark_gray></i>";
public static String NO_PERMISSION = "<red>You don't have permission to use this command.</red>"; public static String NO_PERMISSION = "<red>You don't have permission to use this command.</red>";
public static String NO_CONSOLE = "<red>This command can not be used by console</red>"; public static String NO_CONSOLE = "<red>This command can not be used by console</red>";
public static String CREATED_PARTY = "<green>You created a chat party called: " + public static String CREATED_PARTY = "<green>You created a chat party called: " +
"'<gold><party_name></gold>' with the password: '<gold><party_password></gold>'</green>"; "'<gold><party_name></gold>' with the password: '<gold><party_password></gold>'</green>";
public static String NOT_IN_A_PARTY = "<red>You're not in a chat party.</red>"; public static String NOT_IN_A_PARTY = "<red>You're not in a chat party.</red>";
public static String NOT_YOUR_PARTY = "<red>You don't own this chat party.</red>"; public static String NOT_YOUR_PARTY = "<red>You don't own this chat party.</red>";
public static String NOT_A_PARTY = "<red>This chat party does not exist.</red>"; public static String NOT_A_PARTY = "<red>This chat party does not exist.</red>";
@ -284,9 +292,11 @@ public final class Config {
public static String INVALID_PASSWORD = "<red>Invalid password.</red>"; public static String INVALID_PASSWORD = "<red>Invalid password.</red>";
public static String JOINED_PARTY = "<green>You joined <party_name>!</green>"; public static String JOINED_PARTY = "<green>You joined <party_name>!</green>";
public static String PLAYER_JOINED_PARTY = "<green><player_name> joined <party_name>!</green>"; public static String PLAYER_JOINED_PARTY = "<green><player_name> joined <party_name>!</green>";
public static String NOTIFY_FINDING_NEW_OWNER = "<dark_aqua>Since you own this chat party a new party owner will be chosen.<dark_aqua>"; public static String NOTIFY_FINDING_NEW_OWNER =
"<dark_aqua>Since you own this chat party a new party owner will be chosen.<dark_aqua>";
public static String LEFT_PARTY = "<green>You have left the chat party!</green>"; public static String LEFT_PARTY = "<green>You have left the chat party!</green>";
public static String OWNER_LEFT_PARTY = "<dark_aqua>[ChatParty]: <old_owner> left the chat party, the new party owner is <new_owner></dark_aqua>"; public static String OWNER_LEFT_PARTY =
"<dark_aqua>[ChatParty]: <old_owner> left the chat party, the new party owner is <new_owner></dark_aqua>";
public static String PLAYER_LEFT_PARTY = "<dark_aqua>[ChatParty]: <player_name> left the chat party!</dark_aqua>"; public static String PLAYER_LEFT_PARTY = "<dark_aqua>[ChatParty]: <player_name> left the chat party!</dark_aqua>";
public static String NEW_PARTY_OWNER = "<dark_aqua>[ChatParty]: <old_owner> transferred the party to <new_owner>!"; public static String NEW_PARTY_OWNER = "<dark_aqua>[ChatParty]: <old_owner> transferred the party to <new_owner>!";
public static String CANT_REMOVE_PARTY_OWNER = "<red>You can't remove yourself, please leave instead.</red>"; public static String CANT_REMOVE_PARTY_OWNER = "<red>You can't remove yourself, please leave instead.</red>";
@ -297,14 +307,16 @@ public final class Config {
public static String ALREADY_IN_THIS_PARTY = "<red>You're already in <party>!</red>"; public static String ALREADY_IN_THIS_PARTY = "<red>You're already in <party>!</red>";
public static String SENT_PARTY_INV = "<green>You send a chat party invite to <player>!</green>"; public static String SENT_PARTY_INV = "<green>You send a chat party invite to <player>!</green>";
public static String JOIN_PARTY_CLICK_MESSAGE = "<click:run_command:'/party join <party> <party_password>'>" + public static String JOIN_PARTY_CLICK_MESSAGE = "<click:run_command:'/party join <party> <party_password>'>" +
"<dark_aqua>You received an invite to join <party>, click this message to accept.</dark_aqua></click>"; "<dark_aqua>You received an invite to join <party>, click this message to accept.</dark_aqua></click>";
public static String PARTY_MEMBER_LOGGED_ON = "<dark_aqua>[ChatParty] <player> joined Altitude...</dark_aqua>"; public static String PARTY_MEMBER_LOGGED_ON = "<dark_aqua>[ChatParty] <player> joined Altitude...</dark_aqua>";
public static String PARTY_MEMBER_LOGGED_OFF = "<dark_aqua>[ChatParty] <player> left Altitude...</dark_aqua>"; public static String PARTY_MEMBER_LOGGED_OFF = "<dark_aqua>[ChatParty] <player> left Altitude...</dark_aqua>";
public static String RENAMED_PARTY = "<dark_aqua>[ChatParty] <owner> changed the party name from <old_name> to <new_name>!</dark_aqua>"; public static String RENAMED_PARTY =
"<dark_aqua>[ChatParty] <owner> changed the party name from <old_name> to <new_name>!</dark_aqua>";
public static String CHANGED_PASSWORD = "<green>Password was set to <password></green>"; public static String CHANGED_PASSWORD = "<green>Password was set to <password></green>";
public static String DISBAND_PARTY_CONFIRM = "<green><bold>Are you sure you want to disband your party?</bold> " + public static String DISBAND_PARTY_CONFIRM = "<green><bold>Are you sure you want to disband your party?</bold> " +
"Type <gold>/party disband confirm <party></gold> to confirm."; "Type <gold>/party disband confirm <party></gold> to confirm.";
public static String DISBANDED_PARTY = "<dark_aqua>[ChatParty] <owner> has disbanded <party>, everyone has been removed.</dark_aqua>"; public static String DISBANDED_PARTY =
"<dark_aqua>[ChatParty] <owner> has disbanded <party>, everyone has been removed.</dark_aqua>";
public static String PARTY_INFO = """ public static String PARTY_INFO = """
<gold><bold>Chat party info</bold>: <gold><bold>Chat party info</bold>:
</gold><green>Name: <dark_aqua><party></dark_aqua> </gold><green>Name: <dark_aqua><party></dark_aqua>
@ -353,16 +365,25 @@ public final class Config {
public static String PARTY_HELP_WRAPPER = "<gold>ChatParty help:\n<commands></gold>"; public static String PARTY_HELP_WRAPPER = "<gold>ChatParty help:\n<commands></gold>";
public static String PARTY_HELP_HELP = "<green>Show this menu: <gold>/party help</gold></green>"; public static String PARTY_HELP_HELP = "<green>Show this menu: <gold>/party help</gold></green>";
public static String PARTY_HELP_CREATE = "<green>Create a party: <gold>/party create <party_name> <party_password></gold></green>"; public static String PARTY_HELP_CREATE =
public static String PARTY_HELP_INFO = "<green>Show info about your current party: <gold>/party info</gold></green>"; "<green>Create a party: <gold>/party create <party_name> <party_password></gold></green>";
public static String PARTY_HELP_INVITE = "<green>Invite a user to your party: <gold>/party invite <username></gold></green>"; public static String PARTY_HELP_INFO =
public static String PARTY_HELP_JOIN = "<green>Join a party: <gold>/party join <party_name> <party_password></gold></green>"; "<green>Show info about your current party: <gold>/party info</gold></green>";
public static String PARTY_HELP_INVITE =
"<green>Invite a user to your party: <gold>/party invite <username></gold></green>";
public static String PARTY_HELP_JOIN =
"<green>Join a party: <gold>/party join <party_name> <party_password></gold></green>";
public static String PARTY_HELP_LEAVE = "<green>Leave your current party: <gold>/party leave</gold></green>"; public static String PARTY_HELP_LEAVE = "<green>Leave your current party: <gold>/party leave</gold></green>";
public static String PARTY_HELP_NAME = "<green>Change the name of your party: <gold>/party name <new_name></gold></green>"; public static String PARTY_HELP_NAME =
public static String PARTY_HELP_OWNER = "<green>Change the owner of your party: <gold>/party owner <new_owner_name></gold></green>"; "<green>Change the name of your party: <gold>/party name <new_name></gold></green>";
public static String PARTY_HELP_PASSWORD = "<green>Change the password of your party: <gold>/party password <new_password></gold></green>"; public static String PARTY_HELP_OWNER =
public static String PARTY_HELP_REMOVE = "<green>Remove a member from your party: <gold>/party remove <member_name></gold></green>"; "<green>Change the owner of your party: <gold>/party owner <new_owner_name></gold></green>";
public static String PARTY_HELP_DISBAND = "<green>Remove everyone from your party and disband it: <gold>/party disband</gold></green>"; public static String PARTY_HELP_PASSWORD =
"<green>Change the password of your party: <gold>/party password <new_password></gold></green>";
public static String PARTY_HELP_REMOVE =
"<green>Remove a member from your party: <gold>/party remove <member_name></gold></green>";
public static String PARTY_HELP_DISBAND =
"<green>Remove everyone from your party and disband it: <gold>/party disband</gold></green>";
public static String PARTY_HELP_CHAT = "<green>Talk in party chat: <gold>/p <message></gold></green>"; public static String PARTY_HELP_CHAT = "<green>Talk in party chat: <gold>/p <message></gold></green>";
private static void partyHelp() { private static void partyHelp() {
@ -385,12 +406,14 @@ public final class Config {
public static ComponentLike TOGGLED_ON = null; public static ComponentLike TOGGLED_ON = null;
public static ComponentLike TOGGLED_OFF = null; public static ComponentLike TOGGLED_OFF = null;
public static double LOCAL_DISTANCE; public static double LOCAL_DISTANCE;
public static String CHANNEL_SPY = "<i><gray>SPY:</gray> <dark_gray>(<dark_gray><sender> → <channel>) <message></dark_gray>"; public static String CHANNEL_SPY =
"<i><gray>SPY:</gray> <dark_gray>(<dark_gray><sender> → <channel>) <message></dark_gray>";
private static void chatChannels() { private static void chatChannels() {
ConfigurationNode node = getNode("chat-channels"); ConfigurationNode node = getNode("chat-channels");
if (node.empty()) { if (node.empty()) {
getString("chat-channels.ac.format", "<white><gray><sender></gray> <hover:show_text:on <server>><yellow>to <channel></yellow></hover><gray>: <message>"); getString("chat-channels.ac.format",
"<white><gray><sender></gray> <hover:show_text:on <server>><yellow>to <channel></yellow></hover><gray>: <message>");
getList("chat-channels.ac.servers", List.of("lobby")); getList("chat-channels.ac.servers", List.of("lobby"));
getBoolean("chat-channels.ac.proxy", false); getBoolean("chat-channels.ac.proxy", false);
node = getNode("chat-channels"); node = getNode("chat-channels");
@ -400,15 +423,17 @@ public final class Config {
String channelName = Objects.requireNonNull(configurationNode.key()).toString(); String channelName = Objects.requireNonNull(configurationNode.key()).toString();
String key = "chat-channels." + channelName + "."; String key = "chat-channels." + channelName + ".";
new CustomChannel(channelName, new CustomChannel(channelName,
getString(key + "format", ""), getString(key + "format", ""),
getList(key + "servers", Collections.EMPTY_LIST), getList(key + "servers", Collections.EMPTY_LIST),
getBoolean(key + "proxy", false), getList(key + "alias", Collections.EMPTY_LIST),
getBoolean(key + "local", false) getBoolean(key + "proxy", false),
getBoolean(key + "local", false)
); );
} }
CUSTOM_CHANNEL_TOGGLED = getString("chat-channels-messages.channel-toggled", CUSTOM_CHANNEL_TOGGLED); CUSTOM_CHANNEL_TOGGLED = getString("chat-channels-messages.channel-toggled", CUSTOM_CHANNEL_TOGGLED);
TOGGLED_ON = Utility.parseMiniMessage(getString("chat-channels-messages.channel-on", "<green>on</green><gray>")); TOGGLED_ON =
Utility.parseMiniMessage(getString("chat-channels-messages.channel-on", "<green>on</green><gray>"));
TOGGLED_OFF = Utility.parseMiniMessage(getString("chat-channels-messages.channel-off", "<red>off</red><gray>")); TOGGLED_OFF = Utility.parseMiniMessage(getString("chat-channels-messages.channel-off", "<red>off</red><gray>"));
LOCAL_DISTANCE = getDouble("chat-channels-messages.local-distance", 200.0); LOCAL_DISTANCE = getDouble("chat-channels-messages.local-distance", 200.0);
CHANNEL_SPY = getString("chat-channels-messages.spy", CHANNEL_SPY); CHANNEL_SPY = getString("chat-channels-messages.spy", CHANNEL_SPY);
@ -443,12 +468,16 @@ public final class Config {
} }
public static String mailHeader = "===== List Mails ====='"; public static String mailHeader = "===== List Mails ====='";
public static String mailBody = "<white>From:</white> [<staffprefix>] <sender> <white><hover:show_text:'<date>'><time_ago> day(s) ago</hover>: </white><message>"; public static String mailBody =
"<white>From:</white> [<staffprefix>] <sender> <white><hover:show_text:'<date>'><time_ago> day(s) ago</hover>: </white><message>";
public static String mailFooter = "======================"; public static String mailFooter = "======================";
public static String mailNoUser = "<red>A player with this name hasn't logged in recently."; 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 mailReceived =
public static String mailUnread = "<green><click:run_command:/mail list unread>You have <amount> unread mail, click to view it.</click></green>"; "<yellow><click:run_command:/mail list unread>New mail from <sender>, click to view</click></yellow>";
public static String mailSent = "<green>Successfully send mail to <player_name></green>: <#2e8b57><message></#2e8b57>"; 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 List<String> mailCommandAlias = new ArrayList<>();
public static int mailDisplayDelay = 5; public static int mailDisplayDelay = 5;
@ -464,8 +493,10 @@ public final class Config {
} }
public static HashMap<String, Long> serverChannelId = new HashMap<>(); public static HashMap<String, Long> serverChannelId = new HashMap<>();
public static String REPORT_SENT = "<green>Your report was sent, staff will contact you asap to help resolve your issue!</green>"; public static String REPORT_SENT =
public static String REPORT_TOO_SHORT = "<red>Please ensure your report is descriptive. We require at least 3 words per report</red>"; "<green>Your report was sent, staff will contact you asap to help resolve your issue!</green>";
public static String REPORT_TOO_SHORT =
"<red>Please ensure your report is descriptive. We require at least 3 words per report</red>";
private static void loadChannelIds() { private static void loadChannelIds() {
serverChannelId.clear(); serverChannelId.clear();
@ -500,7 +531,8 @@ public final class Config {
} }
public static String HELP_REPORT = "<red>/report <message></red>"; public static String HELP_REPORT = "<red>/report <message></red>";
public static String FIRST_JOIN = "<green>* Welcome <light_purple><player></light_purple> to Altitude! They've joined for the first time.</green>"; public static String FIRST_JOIN =
"<green>* Welcome <light_purple><player></light_purple> to Altitude! They've joined for the first time.</green>";
private static void loadMessages() { private static void loadMessages() {
HELP_REPORT = getString("settings.mail.mail-sent", HELP_REPORT); HELP_REPORT = getString("settings.mail.mail-sent", HELP_REPORT);
@ -509,7 +541,8 @@ public final class Config {
public static String EMOTELIST_HEADER = "<bold>Available Chat Emotes</bold><newline>"; public static String EMOTELIST_HEADER = "<bold>Available Chat Emotes</bold><newline>";
public static String EMOTELIST_ITEM = "<insert:\"<regex>\"><gold><regex></gold> : <emote></insert><newline>"; public static String EMOTELIST_ITEM = "<insert:\"<regex>\"><gold><regex></gold> : <emote></insert><newline>";
public static String EMOTELIST_FOOTER = "<green>----<< <gray>Prev</gray> <page> <gray>/</gray> <pages> <gray>Next</gray> >>----"; public static String EMOTELIST_FOOTER =
"<green>----<< <gray>Prev</gray> <page> <gray>/</gray> <pages> <gray>Next</gray> >>----";
private static void emoteListCommand() { private static void emoteListCommand() {
EMOTELIST_HEADER = getString("commands.emotelist.header", EMOTELIST_HEADER); EMOTELIST_HEADER = getString("commands.emotelist.header", EMOTELIST_HEADER);
@ -521,31 +554,41 @@ public final class Config {
public static String NICK_CHANGED = "<yellow>Your nickname was changed to <nickname><yellow>."; public static String NICK_CHANGED = "<yellow>Your nickname was changed to <nickname><yellow>.";
public static String NICK_NOT_CHANGED = "<yellow>Your nickname request was denied."; public static String NICK_NOT_CHANGED = "<yellow>Your nickname request was denied.";
public static String NICK_RESET = "<yellow>Nickname changed back to normal."; public static String NICK_RESET = "<yellow>Nickname changed back to normal.";
public static String NICK_CHANGED_OTHERS = "<gold><targetplayer><yellow>'s nickname was changed to <nickname><yellow>."; public static String NICK_CHANGED_OTHERS =
public static String NICK_TARGET_NICK_CHANGE = "<yellow>Your nickname was changed to <nickname> <yellow>by <sendernick><yellow>"; "<gold><targetplayer><yellow>'s nickname was changed to <nickname><yellow>.";
public static String NICK_TARGET_NICK_CHANGE =
"<yellow>Your nickname was changed to <nickname> <yellow>by <sendernick><yellow>";
public static String NICK_RESET_OTHERS = "<gold><player><gold>'s <yellow>nickname was reset back to normal."; public static String NICK_RESET_OTHERS = "<gold><player><gold>'s <yellow>nickname was reset back to normal.";
public static String NICK_INVALID_CHARACTERS = "<yellow>You can only use letters and numbers in nicknames."; public static String NICK_INVALID_CHARACTERS = "<yellow>You can only use letters and numbers in nicknames.";
public static String NICK_INVALID_LENGTH = "<yellow>Nicknames need to be between 3 to 16 characters long."; public static String NICK_INVALID_LENGTH = "<yellow>Nicknames need to be between 3 to 16 characters long.";
public static String NICK_PLAYER_NOT_ONLINE = "<red>That player is not online."; public static String NICK_PLAYER_NOT_ONLINE = "<red>That player is not online.";
public static String NICK_BLOCKED_COLOR_CODES = "<yellow>You have blocked color codes in that nickname."; public static String NICK_BLOCKED_COLOR_CODES = "<yellow>You have blocked color codes in that nickname.";
public static String NICK_USER_NOT_FOUND = "<red>Failed to set nickname from player, try again from a server this player has been on before."; public static String NICK_USER_NOT_FOUND =
public static String NICK_ACCEPTED = "<green>You accepted <targetplayer><green>'s nickname. They are now called <newnick><green>."; "<red>Failed to set nickname from player, try again from a server this player has been on before.";
public static String NICK_DENIED = "<green>You denied <targetplayer><green>'s nickname. They are still called <oldnick><green>."; public static String NICK_ACCEPTED =
"<green>You accepted <targetplayer><green>'s nickname. They are now called <newnick><green>.";
public static String NICK_DENIED =
"<green>You denied <targetplayer><green>'s nickname. They are still called <oldnick><green>.";
public static String NICK_ALREADY_HANDLED = "<red><targetplayer><red>'s nickname was already accepted or denied."; public static String NICK_ALREADY_HANDLED = "<red><targetplayer><red>'s nickname was already accepted or denied.";
public static String NICK_NO_LUCKPERMS = "<red>Due to an issue with LuckPerms /nick try won't work at the moment."; public static String NICK_NO_LUCKPERMS = "<red>Due to an issue with LuckPerms /nick try won't work at the moment.";
public static String NICK_TOO_SOON = "<red>Please wait <time><red> until requesting a new nickname"; 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_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_REQUEST_NEW = "<green>New nickname request by <player><green>!";
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_TRYOUT =
public static String NICK_REQUESTED = "<green>Your requested to be nicknamed <nick><green> has been received. Staff will accept or deny this request asap!"; "<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_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."; public static String NICK_TAKEN =
"<red>Someone else already has this nickname, or has this name as their username.";
public static String NICK_REQUESTS_ON_LOGIN = "<green>Current nick requests: <amount>"; public static String NICK_REQUESTS_ON_LOGIN = "<green>Current nick requests: <amount>";
public static long NICK_WAIT_TIME = 86400000; public static long NICK_WAIT_TIME = 86400000;
public static List<String> NICK_ITEM_LORE = new ArrayList<>(); public static List<String> NICK_ITEM_LORE = new ArrayList<>();
public static List<String> NICK_BLOCKED_COLOR_CODESLIST = new ArrayList<>(); public static List<String> NICK_BLOCKED_COLOR_CODESLIST = new ArrayList<>();
public static List<String> NICK_ALLOWED_COLOR_CODESLIST = new ArrayList<>(); public static List<String> NICK_ALLOWED_COLOR_CODESLIST = new ArrayList<>();
public static String NICK_CURRENT = "<gold>Current nickname: <nickname><white>(<insert:\"<currentnickname>\"><currentnickname></insert>)"; public static String NICK_CURRENT =
"<gold>Current nickname: <nickname><white>(<insert:\"<currentnickname>\"><currentnickname></insert>)";
private static void nicknameSettings() { private static void nicknameSettings() {
NICK_CHANGED = getString("nicknames.messages.nick-changed", NICK_CHANGED); NICK_CHANGED = getString("nicknames.messages.nick-changed", NICK_CHANGED);
@ -572,9 +615,13 @@ public final class Config {
NICK_TAKEN = getString("nicknames.messages.nick-taken", NICK_TAKEN); NICK_TAKEN = getString("nicknames.messages.nick-taken", NICK_TAKEN);
NICK_REQUESTS_ON_LOGIN = getString("nicknames.messages.nick-reauests-on-login", NICK_REQUESTS_ON_LOGIN); NICK_REQUESTS_ON_LOGIN = getString("nicknames.messages.nick-reauests-on-login", NICK_REQUESTS_ON_LOGIN);
NICK_WAIT_TIME = getLong("nicknames.wait-time", NICK_WAIT_TIME); NICK_WAIT_TIME = getLong("nicknames.wait-time", NICK_WAIT_TIME);
NICK_ITEM_LORE = getList("nicknames.item-lore", List.of("<aqua>New nick: <newnick>", "<aqua>Old nick: <oldnick>", "<aqua>Last changed: <lastchanged>", "<green>Left click to Accept <light_purple>| <red>Right click to Deny")); NICK_ITEM_LORE = getList("nicknames.item-lore",
List.of("<aqua>New nick: <newnick>", "<aqua>Old nick: <oldnick>", "<aqua>Last changed: <lastchanged>",
"<green>Left click to Accept <light_purple>| <red>Right click to Deny"));
NICK_BLOCKED_COLOR_CODESLIST = getList("nicknames.blocked-color-codes", List.of("&k", "&l", "&n", "&m", "&o")); NICK_BLOCKED_COLOR_CODESLIST = getList("nicknames.blocked-color-codes", List.of("&k", "&l", "&n", "&m", "&o"));
NICK_ALLOWED_COLOR_CODESLIST = getList("nicknames.allowed-color-codes", List.of("&0", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9", "&a", "&b", "&c", "&d", "&e", "&f", "&r")); NICK_ALLOWED_COLOR_CODESLIST = getList("nicknames.allowed-color-codes",
List.of("&0", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9", "&a", "&b", "&c", "&d", "&e", "&f",
"&r"));
NICK_CURRENT = getString("nicknames.messages.nick-current", NICK_CURRENT); NICK_CURRENT = getString("nicknames.messages.nick-current", NICK_CURRENT);
} }
@ -583,7 +630,8 @@ public final class Config {
private static void deathMessagesSettings() { private static void deathMessagesSettings() {
DEATH_MESSAGES_MAX_PER_PERIOD = getInt("death-messages.max-per-period", DEATH_MESSAGES_MAX_PER_PERIOD); DEATH_MESSAGES_MAX_PER_PERIOD = getInt("death-messages.max-per-period", DEATH_MESSAGES_MAX_PER_PERIOD);
DEATH_MESSAGES_LIMIT_PERIOD_MINUTES = getInt("death-messages.limit-period-minutes", DEATH_MESSAGES_LIMIT_PERIOD_MINUTES); DEATH_MESSAGES_LIMIT_PERIOD_MINUTES =
getInt("death-messages.limit-period-minutes", DEATH_MESSAGES_LIMIT_PERIOD_MINUTES);
} }
public static long CHAT_LOG_DELETE_OLDER_THAN_DAYS = 31; public static long CHAT_LOG_DELETE_OLDER_THAN_DAYS = 31;

View File

@ -1,19 +1,27 @@
package com.alttd.chat.objects.channels; package com.alttd.chat.objects.channels;
import java.util.*; import java.util.List;
public class CustomChannel extends Channel { public class CustomChannel extends Channel {
private final List<String> servers; private final List<String> servers;
private final List<String> aliases;
public CustomChannel(String channelName, String format, List<String> servers, boolean proxy, boolean local) { public CustomChannel(String channelName, String format, List<String> servers, List<String> aliases, boolean proxy,
boolean local) {
super(channelName, format, proxy, local); super(channelName, format, proxy, local);
this.permission = "chat.channel." + channelName.toLowerCase(); this.permission = "chat.channel." + channelName.toLowerCase();
this.channelName = channelName; this.channelName = channelName;
this.format = format; this.format = format;
this.servers = servers; this.servers = servers;
this.proxy = proxy; this.proxy = proxy;
this.aliases = aliases;
} }
public List<String> getServers() { public List<String> getServers() {
return servers; return servers;
} }
public List<String> getAliases() {
return aliases;
}
} }

View File

@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class ChatChannel extends BukkitCommand { public class ChatChannel extends BukkitCommand {
@ -28,7 +27,7 @@ public class ChatChannel extends BukkitCommand {
this.command = channel.getChannelName().toLowerCase(); this.command = channel.getChannelName().toLowerCase();
this.description = "Chat channel named " + channel.getChannelName() + "."; this.description = "Chat channel named " + channel.getChannelName() + ".";
this.usageMessage = "/" + command + " <message>"; this.usageMessage = "/" + command + " <message>";
this.setAliases(Collections.emptyList()); this.setAliases(channel.getAliases());
activeCommands.add(this); activeCommands.add(this);
this.toggleableForCustomChannel = new ToggleableForCustomChannel(channel); this.toggleableForCustomChannel = new ToggleableForCustomChannel(channel);
} }
@ -43,7 +42,7 @@ public class ChatChannel extends BukkitCommand {
player.sendRichMessage(Config.CUSTOM_CHANNEL_TOGGLED, TagResolver.resolver( player.sendRichMessage(Config.CUSTOM_CHANNEL_TOGGLED, TagResolver.resolver(
Placeholder.unparsed("channel", channel.getChannelName()), Placeholder.unparsed("channel", channel.getChannelName()),
Placeholder.component("status", toggleableForCustomChannel.toggle(player.getUniqueId()) Placeholder.component("status", toggleableForCustomChannel.toggle(player.getUniqueId())
? Config.TOGGLED_ON : Config.TOGGLED_OFF))); ? Config.TOGGLED_ON : Config.TOGGLED_OFF)));
return false; return false;
} }