chatchannel: remove target mode
this was added to vanilla with `/@c` & friends
This commit is contained in:
@@ -68,17 +68,6 @@ public interface ChatChannelConfig extends Config
|
||||
return 20;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "targetMode",
|
||||
name = "Target mode",
|
||||
description = "Enables target changing mode via /f, /c, and /g which controls which channel messages are sent to.",
|
||||
position = 1
|
||||
)
|
||||
default boolean targetMode()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "clanChatIcons",
|
||||
name = "Chat Icons",
|
||||
|
||||
@@ -41,7 +41,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.runelite.api.ChatLineBuffer;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.ChatPlayer;
|
||||
@@ -77,8 +76,6 @@ import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.chat.QueuedMessage;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -123,9 +120,6 @@ public class ChatChannelPlugin extends Plugin
|
||||
@Inject
|
||||
private ChatColorConfig chatColorConfig;
|
||||
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
|
||||
private List<String> chats;
|
||||
/**
|
||||
* queue of temporary messages added to the client
|
||||
@@ -136,21 +130,6 @@ public class ChatChannelPlugin extends Plugin
|
||||
|
||||
private boolean kickConfirmed = false;
|
||||
|
||||
private boolean inputWarning;
|
||||
|
||||
@AllArgsConstructor
|
||||
private enum InputMode
|
||||
{
|
||||
FRIEND("Friends Chat", ChatMessageType.FRIENDSCHAT),
|
||||
CLAN("Clan Chat", ChatMessageType.CLAN_CHAT),
|
||||
GUEST("Guest Clan Chat", ChatMessageType.CLAN_GUEST_CHAT);
|
||||
|
||||
private final String prompt;
|
||||
private final ChatMessageType chatMessageType;
|
||||
}
|
||||
|
||||
private InputMode inputMode;
|
||||
|
||||
@Provides
|
||||
ChatChannelConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -174,15 +153,6 @@ public class ChatChannelPlugin extends Plugin
|
||||
chats = null;
|
||||
clientThread.invoke(() -> colorIgnoredPlayers(Color.WHITE));
|
||||
rebuildFriendsChat();
|
||||
|
||||
if (inputMode != null)
|
||||
{
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
switchTypingMode(null);
|
||||
client.runScript(ScriptID.CHAT_PROMPT_INIT);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -197,15 +167,6 @@ public class ChatChannelPlugin extends Plugin
|
||||
|
||||
Color ignoreColor = config.showIgnores() ? config.showIgnoresColor() : Color.WHITE;
|
||||
clientThread.invoke(() -> colorIgnoredPlayers(ignoreColor));
|
||||
|
||||
if (inputMode != null && !config.targetMode())
|
||||
{
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
switchTypingMode(null);
|
||||
client.runScript(ScriptID.CHAT_PROMPT_INIT);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,72 +586,6 @@ public class ChatChannelPlugin extends Plugin
|
||||
clientThread.invokeLater(() -> confirmKickPlayer(kickPlayerName));
|
||||
break;
|
||||
}
|
||||
case "preChatSendpublic":
|
||||
{
|
||||
if (!config.targetMode())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String chatboxInput = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT);
|
||||
switch (chatboxInput)
|
||||
{
|
||||
case "/p":
|
||||
switchTypingMode(null);
|
||||
break;
|
||||
case "/f":
|
||||
switchTypingMode(InputMode.FRIEND);
|
||||
break;
|
||||
case "/c":
|
||||
switchTypingMode(InputMode.CLAN);
|
||||
break;
|
||||
case "/g":
|
||||
switchTypingMode(InputMode.GUEST);
|
||||
break;
|
||||
default:
|
||||
if (inputMode != null)
|
||||
{
|
||||
final int[] intStack = client.getIntStack();
|
||||
final int intStackSize = client.getIntStackSize();
|
||||
intStack[intStackSize - 1] = inputMode.chatMessageType.getType(); // chat message type
|
||||
intStack[intStackSize - 2] = 0; // prefix length
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "setChatboxInput":
|
||||
{
|
||||
Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT);
|
||||
if (chatboxInput != null && inputMode != null)
|
||||
{
|
||||
String text = chatboxInput.getText();
|
||||
int idx = text.indexOf(": ");
|
||||
if (idx != -1)
|
||||
{
|
||||
String newText = inputMode.prompt + ": " + text.substring(idx + 2);
|
||||
chatboxInput.setText(newText);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void switchTypingMode(InputMode mode)
|
||||
{
|
||||
inputMode = mode;
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, "");
|
||||
|
||||
if (mode != null && !inputWarning)
|
||||
{
|
||||
inputWarning = true;
|
||||
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
.type(ChatMessageType.CONSOLE)
|
||||
.runeLiteFormattedMessage("You've entered " + inputMode.prompt + " typing mode. All typed messages will be sent to your " +
|
||||
inputMode.prompt.toLowerCase() + ". Use /p to reset to public chat.")
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user