Merge pull request #6430 from Abextm/kill-login-panel
ChatboxPanelManager: Kill panels when logging out.
This commit is contained in:
@@ -32,8 +32,10 @@ import com.google.inject.Singleton;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.vars.InputType;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
@@ -144,32 +146,46 @@ public class ChatboxPanelManager
|
||||
{
|
||||
if (currentInput != null && "resetChatboxInput".equals(ev.getEventName()))
|
||||
{
|
||||
try
|
||||
{
|
||||
currentInput.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.warn("Exception closing {}", currentInput.getClass(), e);
|
||||
}
|
||||
|
||||
eventBus.unregister(currentInput);
|
||||
if (currentInput instanceof KeyListener)
|
||||
{
|
||||
keyManager.unregisterKeyListener((KeyListener) currentInput);
|
||||
}
|
||||
if (currentInput instanceof MouseListener)
|
||||
{
|
||||
mouseManager.unregisterMouseListener((MouseListener) currentInput);
|
||||
}
|
||||
if (currentInput instanceof MouseWheelListener)
|
||||
{
|
||||
mouseManager.unregisterMouseWheelListener((MouseWheelListener) currentInput);
|
||||
}
|
||||
currentInput = null;
|
||||
killCurrentPanel();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged ev)
|
||||
{
|
||||
if (currentInput != null && ev.getGameState() == GameState.LOGIN_SCREEN)
|
||||
{
|
||||
killCurrentPanel();
|
||||
}
|
||||
}
|
||||
|
||||
private void killCurrentPanel()
|
||||
{
|
||||
try
|
||||
{
|
||||
currentInput.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.warn("Exception closing {}", currentInput.getClass(), e);
|
||||
}
|
||||
|
||||
eventBus.unregister(currentInput);
|
||||
if (currentInput instanceof KeyListener)
|
||||
{
|
||||
keyManager.unregisterKeyListener((KeyListener) currentInput);
|
||||
}
|
||||
if (currentInput instanceof MouseListener)
|
||||
{
|
||||
mouseManager.unregisterMouseListener((MouseListener) currentInput);
|
||||
}
|
||||
if (currentInput instanceof MouseWheelListener)
|
||||
{
|
||||
mouseManager.unregisterMouseWheelListener((MouseWheelListener) currentInput);
|
||||
}
|
||||
currentInput = null;
|
||||
}
|
||||
|
||||
public Widget getContainerWidget()
|
||||
{
|
||||
return client.getWidget(WidgetInfo.CHATBOX_CONTAINER);
|
||||
|
||||
Reference in New Issue
Block a user