Skip to content

Commit

Permalink
Send ServerErrorMessage if invite already open
Browse files Browse the repository at this point in the history
  • Loading branch information
jacwah committed Sep 3, 2015
1 parent de43a78 commit fae3972
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
@@ -1,6 +1,7 @@
package com.cardshifter.server.model;

import com.cardshifter.api.*;
import com.cardshifter.api.outgoing.*;
import com.cardshifter.core.game.*;
import org.apache.log4j.*;

Expand Down Expand Up @@ -40,6 +41,8 @@ public void createAndSend(ClientIO sender, ClientIO receiver, String gameType) {
if (invite != null) {
logger.info("Sending [" + invite + "] to [" + receiver + "]");
invite.sendInvite(receiver);
} else {
sender.sendToClient(new ServerErrorMessage("You already have a game invitation open."));
}
}

Expand Down
Expand Up @@ -228,11 +228,8 @@ public void testOnlyOneInvite() throws IOException, InterruptedException {
client1.await(PlayerConfigMessage.class);
client1.await(ChatMessage.class);

// Don't expect a new game to be started, ensure that no NewGameMessage is sent by
// awaiting a request made after the StartGameRequest
client1.send(new StartGameRequest(2, getTestMod()));
client1.send(new ServerQueryMessage(Request.USERS));
client1.await(UserStatusMessage.class);
client1.await(ServerErrorMessage.class);
}

}

0 comments on commit fae3972

Please sign in to comment.