DrawMyThing: Remove all found words from the checked string when looking for multiple guesses

This commit is contained in:
libraryaddict 2015-05-15 12:23:05 +12:00
parent 67f1e4ad1f
commit 091f98fa9d

View File

@ -300,16 +300,17 @@ public class Draw extends SoloGame
Player player = event.getPlayer();
String message = event.getMessage().toLowerCase();
if (_guessers.HasPlayer(player))
{
int wordsInMessage = 0;
String message = event.getMessage().toLowerCase().replace(_round.Word.toLowerCase(), "");;
for (String word : _words)
{
if (!word.equals(_round.Word) && message.contains(word.toLowerCase()))
if (message.contains(word.toLowerCase()))
{
message = message.replace(word.toLowerCase(), "");
if (++wordsInMessage >= 3)
{
UtilPlayer.message(player, F.main("Game", "Multiple guesses are not allowed!"));
@ -320,7 +321,7 @@ public class Draw extends SoloGame
}
}
if (message.contains(_round.Word.toLowerCase()))
if (event.getMessage().toLowerCase().contains(_round.Word.toLowerCase()))
{
// First Guess
int score = 1;