key remapping: fix clearing input when plugin is turned on
This commit is contained in:
@@ -191,23 +191,18 @@ class KeyRemappingListener extends MouseAdapter implements KeyListener
|
||||
switch (e.getKeyCode())
|
||||
{
|
||||
case KeyEvent.VK_ENTER:
|
||||
case KeyEvent.VK_ESCAPE:
|
||||
plugin.setTyping(false);
|
||||
clientThread.invoke(plugin::lockChat);
|
||||
break;
|
||||
case KeyEvent.VK_ESCAPE:
|
||||
plugin.setTyping(false);
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, "");
|
||||
plugin.lockChat();
|
||||
});
|
||||
break;
|
||||
case KeyEvent.VK_BACK_SPACE:
|
||||
// Only lock chat on backspace when the typed text is now empty
|
||||
if (Strings.isNullOrEmpty(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT)))
|
||||
{
|
||||
plugin.setTyping(false);
|
||||
clientThread.invoke(plugin::lockChat);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +183,8 @@ public class KeyRemappingPlugin extends Plugin
|
||||
if (chatboxInput != null)
|
||||
{
|
||||
chatboxInput.setText(getPlayerNameWithIcon() + ": " + PRESS_ENTER_TO_CHAT);
|
||||
// Typed text can be non-empty on plugin start, so clear it now
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user