Added a configurable booster message for server

Made server and discord booster message separate
This commit is contained in:
Teriuihi 2022-09-11 05:05:39 +02:00
parent a8cae97ef8
commit bb1479591e
2 changed files with 11 additions and 2 deletions

View File

@ -193,12 +193,14 @@ public final class Config {
public static String INVALID_DONOR_RANK = "<red><rank> is not a valid donor rank.</red>";
public static String DEMOTE_MESSAGE = "<red>Your <rank> rank was refunded and removed. Contact staff if you're unsure what caused this.</red>";
public static String PROMOTE_MESSAGE = "<green>Thank you for your support! We applied the <rank> rank to your account.</green>";
public static String BOOST_SERVER_MESSAGE = "<light_purple>* <player> activated an <dark_purple><booster></dark_purple> booster!</light_purple>";
private static void loadMessages() {
INVALID_USER = getString("messages.invalid-user", INVALID_USER);
INVALID_ACTION = getString("messages.invalid-action", INVALID_ACTION);
INVALID_DONOR_RANK = getString("messages.invalid-donor-rank", INVALID_DONOR_RANK);
DEMOTE_MESSAGE = getString("messages.demote", DEMOTE_MESSAGE);
PROMOTE_MESSAGE = getString("messages.promote", PROMOTE_MESSAGE);
BOOST_SERVER_MESSAGE = getString("messages.boost-server", BOOST_SERVER_MESSAGE);
}
public static boolean DEBUG = false;

View File

@ -121,9 +121,16 @@ public class BoosterCommand {
addAllMcMMOBoosters(username, duration, multiplier);
else
VelocityBoosters.getPlugin().getBoosterManager().addBooster(new VelocityBooster(boosterType, username, duration, multiplier));
String msg = "[" + username + "] purchased booster of type [" + Utils.capitalize(boosterType.getBoosterName()) + "]"; //TODO check if there was a booster active already and change message based on that
String boosterName = Utils.capitalize(boosterType.getBoosterName());
String msg = "[" + username + "] purchased booster of type [" + boosterName + "]"; //Add to config for discord only
DiscordSendMessage.sendEmbed(Config.BOOST_ANNOUNCE_CHANNEL, "Booster Purchased", msg);
VelocityBoosters.getPlugin().getProxy().sendMessage(MiniMessage.miniMessage().deserialize(msg));
TagResolver templates = TagResolver.resolver(
Placeholder.unparsed("player", username),
Placeholder.unparsed("booster", boosterName));
VelocityBoosters.getPlugin().getProxy().sendMessage(MiniMessage.miniMessage()
.deserialize(Config.BOOST_SERVER_MESSAGE, templates));
VelocityBoosters.getPlugin().getLogger().info(msg);
return 1;
})