add options for sale,bid,listing colours for discord webhook

Took 3 minutes
This commit is contained in:
Kiran Hart 2022-07-20 21:50:29 -04:00
parent 12cad78f9b
commit 3288cf4d56
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
2 changed files with 6 additions and 2 deletions

View File

@ -256,7 +256,9 @@ public class AuctionAPI {
hook.setUsername(Settings.DISCORD_MSG_USERNAME.getString());
hook.setAvatarUrl(Settings.DISCORD_MSG_PFP.getString());
String[] possibleColours = Settings.DISCORD_MSG_DEFAULT_COLOUR.getString().split("-");
String color = isBid ? Settings.DISCORD_MSG_DEFAULT_COLOUR_BID.getString() : isNew ? Settings.DISCORD_MSG_DEFAULT_COLOUR.getString() : Settings.DISCORD_MSG_DEFAULT_COLOUR_SALE.getString();
String[] possibleColours = color.split("-");
Color colour = Settings.DISCORD_MSG_USE_RANDOM_COLOUR.getBoolean()
? Color.getHSBColor(ThreadLocalRandom.current().nextFloat() * 360F, ThreadLocalRandom.current().nextFloat() * 101F, ThreadLocalRandom.current().nextFloat() * 101F)
: Color.getHSBColor(Float.parseFloat(possibleColours[0]) / 360, Float.parseFloat(possibleColours[1]) / 100, Float.parseFloat(possibleColours[2]) / 100);
@ -307,7 +309,7 @@ public class AuctionAPI {
hook.setUsername(Settings.DISCORD_MSG_USERNAME.getString());
hook.setAvatarUrl(Settings.DISCORD_MSG_PFP.getString());
String[] possibleColours = Settings.DISCORD_MSG_DEFAULT_COLOUR.getString().split("-");
String[] possibleColours = Settings.DISCORD_MSG_DEFAULT_COLOUR_BID.getString().split("-");
Color colour = Settings.DISCORD_MSG_USE_RANDOM_COLOUR.getBoolean()
? Color.getHSBColor(ThreadLocalRandom.current().nextFloat() * 360F, ThreadLocalRandom.current().nextFloat() * 101F, ThreadLocalRandom.current().nextFloat() * 101F)
: Color.getHSBColor(Float.parseFloat(possibleColours[0]) / 360, Float.parseFloat(possibleColours[1]) / 100, Float.parseFloat(possibleColours[2]) / 100);

View File

@ -250,6 +250,8 @@ public class Settings {
public static final ConfigSetting DISCORD_MSG_PFP = new ConfigSetting(config, "discord.user.avatar picture", "https://cdn.kiranhart.com/spigot/auctionhouse/icon.png", "The avatar image of the discord user");
public static final ConfigSetting DISCORD_MSG_USE_RANDOM_COLOUR = new ConfigSetting(config, "discord.msg.use random colour", true, "colour of the message bar");
public static final ConfigSetting DISCORD_MSG_DEFAULT_COLOUR = new ConfigSetting(config, "discord.msg.default colour", "137-100-100", "The color of the embed, it needs to be in hsb format.", "Separate the numbers with a -");
public static final ConfigSetting DISCORD_MSG_DEFAULT_COLOUR_BID = new ConfigSetting(config, "discord.msg.default colour bid", "137-100-100", "The color of the embed during a bid, it needs to be in hsb format.", "Separate the numbers with a -");
public static final ConfigSetting DISCORD_MSG_DEFAULT_COLOUR_SALE = new ConfigSetting(config, "discord.msg.default colour sale", "137-100-100", "The color of the embed during a sale, it needs to be in hsb format.", "Separate the numbers with a -");
public static final ConfigSetting DISCORD_MSG_START_TITLE = new ConfigSetting(config, "discord.msg.auction start title", "New Auction Available", "The title of the message when a new auction is made");
public static final ConfigSetting DISCORD_MSG_FINISH_TITLE = new ConfigSetting(config, "discord.msg.auction finish title", "Auction Finished", "The title of the message when an auction finishes");
public static final ConfigSetting DISCORD_MSG_BID_TITLE = new ConfigSetting(config, "discord.msg.auction bid title", "New Bid Placed", "The title of the message when a new bid is placed");