chat history: rebuild pmbox when all is cleared
Additionally it is unnecessary to manually remove messages when the clear option is vanilla, since it will do it already
This commit is contained in:
@@ -47,6 +47,12 @@ public final class ScriptID
|
||||
@ScriptArguments(integer = 1, string = 1)
|
||||
public static final int CHATBOX_INPUT = 96;
|
||||
|
||||
/**
|
||||
* Rebuilds the chatbox and the pmbox
|
||||
*/
|
||||
@ScriptArguments()
|
||||
public static final int SPLITPM_CHANGED = 83;
|
||||
|
||||
/**
|
||||
* Rebuilds the chatbox
|
||||
*/
|
||||
|
||||
@@ -317,6 +317,14 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
||||
|
||||
log.debug("Clearing chatbox history for tab {}", tab);
|
||||
|
||||
clearMessageQueue(tab);
|
||||
|
||||
if (tab.getAfter() == null)
|
||||
{
|
||||
// if the tab has a vanilla Clear option, it isn't necessary to delete the messages ourselves.
|
||||
return;
|
||||
}
|
||||
|
||||
boolean removed = false;
|
||||
for (ChatMessageType msgType : tab.getMessageTypes())
|
||||
{
|
||||
@@ -339,10 +347,9 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
||||
|
||||
if (removed)
|
||||
{
|
||||
clientThread.invoke(() -> client.runScript(ScriptID.BUILD_CHATBOX));
|
||||
// this rebuilds both the chatbox and the pmbox
|
||||
clientThread.invoke(() -> client.runScript(ScriptID.SPLITPM_CHANGED));
|
||||
}
|
||||
|
||||
clearMessageQueue(tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user