Skip to content

Commit

Permalink
Add "test_listener" client command
Browse files Browse the repository at this point in the history
This command is needed for testing of JNI client listener bridge.
  • Loading branch information
dnk777 committed Jul 30, 2017
1 parent 9ff26fe commit ebbc531
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/protocol_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ class GenericClientProtocolExecutor : public AbstractClientProtocolExecutor, Cha
void DoConnectRequest();
void DoDisconnectRequest();

#ifndef PUBLIC_BUILD
void Command_TestListener( CommandParser &parser );
#endif

void Send() {
channel.Send();
lastSentAt = Millis();
Expand Down
14 changes: 14 additions & 0 deletions src/protocol_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ GenericClientProtocolExecutor::GenericClientProtocolExecutor( Client *client_,

clientCommandHandlers.Register( "connect", &GPTE::Command_Connect );
clientCommandHandlers.Register( "disconnect", &GPTE::Command_Disconnect );
#ifndef PUBLIC_BUILD
clientCommandHandlers.Register( "test_listener", &GPTE::Command_TestListener );
#endif

clientCommandHandlers.NewGenerationTag();

Expand Down Expand Up @@ -171,6 +174,17 @@ void GenericClientProtocolExecutor::DoDisconnectRequest() {
SetState( CA_DISCONNECTED );
}

#ifndef PUBLIC_BUILD
void GenericClientProtocolExecutor::Command_TestListener( CommandParser &parser ) {
client->SetShownPlayerName( "Player" );
client->SetMessageOfTheDay( "Message of the day" );
client->PrintCenteredMessage( "King of Bongo!" );
client->PrintChatMessage( "Player(1)", "Hello, world!" );
client->PrintTeamChatMessage( "Player(1)", "Hello, world!" );
client->PrintTVChatMessage( "Player(1)", "Hello, world!" );
}
#endif

GenericClientProtocolExecutor *GenericClientProtocolExecutor::New( Console *console, Client *client, System *system, int protocolVersion ) {
if( protocolVersion != PROTOCOL21 ) {
return nullptr;
Expand Down

0 comments on commit ebbc531

Please sign in to comment.