keyremapping: only update chatbox input and not player name
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/*'
|
/*
|
||||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
* Copyright (c) 2018, Abexlry <abexlry@gmail.com>
|
* Copyright (c) 2018, Abexlry <abexlry@gmail.com>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@@ -33,7 +33,6 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.IconID;
|
|
||||||
import net.runelite.api.VarClientInt;
|
import net.runelite.api.VarClientInt;
|
||||||
import net.runelite.api.VarClientStr;
|
import net.runelite.api.VarClientStr;
|
||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
@@ -159,7 +158,7 @@ public class KeyRemappingPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
if (chatboxFocused() && !typing)
|
if (chatboxFocused() && !typing)
|
||||||
{
|
{
|
||||||
chatboxInput.setText(getPlayerNameWithIcon() + ": " + PRESS_ENTER_TO_CHAT);
|
setChatboxWidgetInput(chatboxInput, PRESS_ENTER_TO_CHAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -179,7 +178,7 @@ public class KeyRemappingPlugin extends Plugin
|
|||||||
Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT);
|
Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT);
|
||||||
if (chatboxInput != null)
|
if (chatboxInput != null)
|
||||||
{
|
{
|
||||||
chatboxInput.setText(getPlayerNameWithIcon() + ": " + PRESS_ENTER_TO_CHAT);
|
setChatboxWidgetInput(chatboxInput, PRESS_ENTER_TO_CHAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,28 +191,19 @@ public class KeyRemappingPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
final boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1;
|
final boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1;
|
||||||
final Color textColor = isChatboxTransparent ? JagexColors.CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND : JagexColors.CHAT_TYPED_TEXT_OPAQUE_BACKGROUND;
|
final Color textColor = isChatboxTransparent ? JagexColors.CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND : JagexColors.CHAT_TYPED_TEXT_OPAQUE_BACKGROUND;
|
||||||
chatboxInput.setText(getPlayerNameWithIcon() + ": " + ColorUtil.wrapWithColorTag(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT) + "*", textColor));
|
setChatboxWidgetInput(chatboxInput, ColorUtil.wrapWithColorTag(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT) + "*", textColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPlayerNameWithIcon()
|
private void setChatboxWidgetInput(Widget widget, String input)
|
||||||
{
|
{
|
||||||
IconID icon;
|
String text = widget.getText();
|
||||||
switch (client.getAccountType())
|
int idx = text.indexOf(':');
|
||||||
|
if (idx != -1)
|
||||||
{
|
{
|
||||||
case IRONMAN:
|
String newText = text.substring(0, idx) + ": " + input;
|
||||||
icon = IconID.IRONMAN;
|
widget.setText(newText);
|
||||||
break;
|
|
||||||
case ULTIMATE_IRONMAN:
|
|
||||||
icon = IconID.ULTIMATE_IRONMAN;
|
|
||||||
break;
|
|
||||||
case HARDCORE_IRONMAN:
|
|
||||||
icon = IconID.HARDCORE_IRONMAN;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return client.getLocalPlayer().getName();
|
|
||||||
}
|
}
|
||||||
return icon + client.getLocalPlayer().getName();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user