api: add welcome chat message type

Update chat history plugin to check the message type of the welcome
message.
This commit is contained in:
Adam
2019-11-20 12:04:25 -05:00
parent b565f29049
commit 5057e48d10
2 changed files with 8 additions and 3 deletions

View File

@@ -148,6 +148,10 @@ public enum ChatMessageType
* A message that times out after 10 seconds. * A message that times out after 10 seconds.
*/ */
TENSECTIMEOUT(107), TENSECTIMEOUT(107),
/**
* The "Welcome to RuneScape" message
*/
WELCOME(108),
/** /**
* An unknown message type. * An unknown message type.
*/ */

View File

@@ -111,7 +111,8 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
{ {
// Start sending old messages right after the welcome message, as that is most reliable source // Start sending old messages right after the welcome message, as that is most reliable source
// of information that chat history was reset // of information that chat history was reset
if (chatMessage.getMessage().equals(WELCOME_MESSAGE)) ChatMessageType chatMessageType = chatMessage.getType();
if (chatMessageType == ChatMessageType.WELCOME && chatMessage.getMessage().equals(WELCOME_MESSAGE))
{ {
if (!config.retainChatHistory()) if (!config.retainChatHistory())
{ {
@@ -128,7 +129,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
return; return;
} }
switch (chatMessage.getType()) switch (chatMessageType)
{ {
case PRIVATECHATOUT: case PRIVATECHATOUT:
case PRIVATECHAT: case PRIVATECHAT:
@@ -150,7 +151,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
case FRIENDSCHAT: case FRIENDSCHAT:
case CONSOLE: case CONSOLE:
final QueuedMessage queuedMessage = QueuedMessage.builder() final QueuedMessage queuedMessage = QueuedMessage.builder()
.type(chatMessage.getType()) .type(chatMessageType)
.name(chatMessage.getName()) .name(chatMessage.getName())
.sender(chatMessage.getSender()) .sender(chatMessage.getSender())
.value(nbsp(chatMessage.getMessage())) .value(nbsp(chatMessage.getMessage()))