Search in sources :

Example 1 with GpgClientCommand

use of com.faforever.client.fa.relay.GpgClientCommand in project downlords-faf-client by FAForever.

the class GpgGameMessageTypeAdapterTest method testRead.

@Test
public void testRead() throws Exception {
    JsonReader in = mock(JsonReader.class);
    when(in.nextString()).thenReturn(GpgClientCommand.CHAT.getString());
    GpgClientCommand gpgClientCommand = instance.read(in);
    assertEquals(GpgClientCommand.CHAT, gpgClientCommand);
}
Also used : GpgClientCommand(com.faforever.client.fa.relay.GpgClientCommand) JsonReader(com.google.gson.stream.JsonReader) Test(org.junit.Test)

Example 2 with GpgClientCommand

use of com.faforever.client.fa.relay.GpgClientCommand in project downlords-faf-client by FAForever.

the class IceAdapterImpl method onGpgGameMessage.

@Subscribe
public void onGpgGameMessage(GpgGameMessageEvent event) {
    GpgGameMessage gpgGameMessage = event.getGpgGameMessage();
    GpgClientCommand command = gpgGameMessage.getCommand();
    if (command == GpgClientCommand.REHOST) {
        eventBus.post(new RehostRequestEvent());
        return;
    }
    if (command == GpgClientCommand.GAME_FULL) {
        eventBus.post(new GameFullEvent());
        return;
    }
    fafService.sendGpgGameMessage(gpgGameMessage);
}
Also used : GpgClientCommand(com.faforever.client.fa.relay.GpgClientCommand) RehostRequestEvent(com.faforever.client.fa.relay.event.RehostRequestEvent) GameFullEvent(com.faforever.client.fa.relay.event.GameFullEvent) GpgGameMessage(com.faforever.client.fa.relay.GpgGameMessage) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

GpgClientCommand (com.faforever.client.fa.relay.GpgClientCommand)2 GpgGameMessage (com.faforever.client.fa.relay.GpgGameMessage)1 GameFullEvent (com.faforever.client.fa.relay.event.GameFullEvent)1 RehostRequestEvent (com.faforever.client.fa.relay.event.RehostRequestEvent)1 Subscribe (com.google.common.eventbus.Subscribe)1 JsonReader (com.google.gson.stream.JsonReader)1 Test (org.junit.Test)1