= Updated color to allow for parsing even with text after it

This commit is contained in:
Matthew Cech
2019-09-12 23:18:23 -07:00
parent d681bb6a4d
commit b3187bb89d
2 changed files with 22 additions and 1 deletions
+1
View File
@@ -62,6 +62,7 @@
"Localized Strings","BetBeansInfo","Allows you to bet your beans, set your amount after the command! Warning! House always wins!nSets of 3 will get 2x, 4 will get 10x, and 5 will get 1000x" "Localized Strings","BetBeansInfo","Allows you to bet your beans, set your amount after the command! Warning! House always wins!nSets of 3 will get 2x, 4 will get 10x, and 5 will get 1000x"
"Localized Strings","BetBeansLose","Sorry, you didn't win, try again!" "Localized Strings","BetBeansLose","Sorry, you didn't win, try again!"
"Localized Strings","BetBeansLowBet","Please bet with at least 20 beans!" "Localized Strings","BetBeansLowBet","Please bet with at least 20 beans!"
"Localized Strings","BetBeansMinThreshold","50"
"Localized Strings","BetBeansNotEnough","You don't have enough beans!" "Localized Strings","BetBeansNotEnough","You don't have enough beans!"
"Localized Strings","BetBeansNotValid","That's not a valid bet!" "Localized Strings","BetBeansNotValid","That's not a valid bet!"
"Localized Strings","BetBeansWin","You won %s beans!" "Localized Strings","BetBeansWin","You won %s beans!"
1 Type Key Value
62 Localized Strings BetBeansInfo Allows you to bet your beans, set your amount after the command! Warning! House always wins!nSets of 3 will get 2x, 4 will get 10x, and 5 will get 1000x
63 Localized Strings BetBeansLose Sorry, you didn't win, try again!
64 Localized Strings BetBeansLowBet Please bet with at least 20 beans!
65 Localized Strings BetBeansMinThreshold 50
66 Localized Strings BetBeansNotEnough You don't have enough beans!
67 Localized Strings BetBeansNotValid That's not a valid bet!
68 Localized Strings BetBeansWin You won %s beans!
+21 -1
View File
@@ -31,8 +31,28 @@ public class CommandColor extends Command
@Override @Override
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{ {
if(input.args == null || input.args.length() == 0)
{
res.send(LocStrings.stub("ColorNotSearchable"));
return;
}
String toFind = null;
String[] split = input.args.split(" ");
if(split.length >= 1)
toFind = split[0];
// First, try and parse out the color to make sure we can even get it. // First, try and parse out the color to make sure we can even get it.
ColorData colorData = theColorAPI.lookupHex(input.args.trim()); ColorData colorData = null;
if(toFind == null)
{
colorData = theColorAPI.lookupHex(input.args.trim());
}
else
{
colorData = theColorAPI.lookupHex(toFind.trim());
}
// Verify the color was even found // Verify the color was even found
if(colorData == null) if(colorData == null)