Delay party instruction message if user is not logged in (#7696)

Currently, if the user joins a party whilst on the login screen, they don't get the instructional message on how to leave the party
This commit is contained in:
Hydrox6
2019-02-11 09:33:10 +00:00
committed by Tomas Slusny
parent be8bdaeb7a
commit fbeef87355

View File

@@ -128,6 +128,7 @@ public class PartyPlugin extends Plugin implements KeyListener
private int lastHp, lastPray;
private boolean hotkeyDown, doSync;
private boolean sendAlert;
@Override
public void configure(Binder binder)
@@ -161,6 +162,7 @@ public class PartyPlugin extends Plugin implements KeyListener
keyManager.unregisterKeyListener(this);
hotkeyDown = false;
doSync = false;
sendAlert = false;
}
@Provides
@@ -284,6 +286,12 @@ public class PartyPlugin extends Plugin implements KeyListener
@Subscribe
public void onGameTick(final GameTick event)
{
if (sendAlert && client.getGameState() == GameState.LOGGED_IN)
{
sendAlert = false;
sendInstructionMessage();
}
if (doSync && !party.getMembers().isEmpty())
{
// Request sync
@@ -381,15 +389,7 @@ public class PartyPlugin extends Plugin implements KeyListener
if (localMember != null && partyData.getMemberId().equals(localMember.getMemberId()))
{
final String helpMessage = new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
.append("To leave party hold SHIFT and right click party stats overlay.")
.build();
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.GAME)
.runeLiteFormattedMessage(helpMessage)
.build());
sendAlert = true;
}
}
@@ -510,4 +510,17 @@ public class PartyPlugin extends Plugin implements KeyListener
hotkeyDown = false;
}
}
private void sendInstructionMessage()
{
final String helpMessage = new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
.append("To leave party hold SHIFT and right click party stats overlay.")
.build();
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.GAME)
.runeLiteFormattedMessage(helpMessage)
.build());
}
}