diff --git a/assets/config.csv b/assets/config.csv index 7007008..bdc348e 100644 --- a/assets/config.csv +++ b/assets/config.csv @@ -191,6 +191,7 @@ "Localized Strings","MusicInfo","" "Localized Strings","MusicVolChanged","Volume set to %s!" "Localized Strings","MusicVolCurrent","Volume is at %s!" +"Localized Strings","MusicVolOOB","" "Localized Strings","PerishInfo","Adds a red, 'a n g e r y' overlay to your icon or the icon of a friend you mentioned" "Localized Strings","PingInfo","Will respond with Pong!" "Localized Strings","PingResponse","Pong!" diff --git a/src/commands/general/CommandColor.java b/src/commands/general/CommandColor.java index d159bc0..6d2293b 100644 --- a/src/commands/general/CommandColor.java +++ b/src/commands/general/CommandColor.java @@ -32,7 +32,7 @@ public class CommandColor extends Command public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) { // First, try and parse out the color to make sure we can even get it. - ColorData colorData = theColorAPI.lookupHex(input.args.trim()); + ColorData colorData = theColorAPI.lookupHex(input.args); // Verify the color was even found if(colorData == null) diff --git a/src/network/NetworkTheColorAPI.java b/src/network/NetworkTheColorAPI.java index 07e9b35..76725b6 100644 --- a/src/network/NetworkTheColorAPI.java +++ b/src/network/NetworkTheColorAPI.java @@ -73,9 +73,22 @@ public class NetworkTheColorAPI public ColorData lookupHex(String hex) { + if(hex == null) + return null; + + hex = hex.replace("#", "").trim(); + int len = hex.length(); + + if(len == 0) + return null; + + // Verify we're either a full or half length color. Intermediate colors not supported. + // Alpha is also not supported. + if(len != 6 && len != 3) + return null; + try { - hex = hex.replace("#", "").trim(); String hexUpper = hex.toUpperCase(); // Verify the number is hex.