Merge pull request #3421 from Adam-/chatcolor
runelite-client: add chat recolor plugin
This commit is contained in:
@@ -24,9 +24,16 @@
|
||||
*/
|
||||
package net.runelite.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* Enumeration of message types that can be received in the chat.
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ChatMessageType
|
||||
{
|
||||
/**
|
||||
@@ -124,9 +131,14 @@ public enum ChatMessageType
|
||||
|
||||
private final int type;
|
||||
|
||||
ChatMessageType(int type)
|
||||
private static final Map<Integer, ChatMessageType> CHAT_MESSAGE_TYPES = new HashMap<>();
|
||||
|
||||
static
|
||||
{
|
||||
this.type = type;
|
||||
for (ChatMessageType chatMessageType : values())
|
||||
{
|
||||
CHAT_MESSAGE_TYPES.put(chatMessageType.type, chatMessageType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,23 +150,6 @@ public enum ChatMessageType
|
||||
*/
|
||||
public static ChatMessageType of(int type)
|
||||
{
|
||||
for (ChatMessageType ct : ChatMessageType.values())
|
||||
{
|
||||
if (ct.type == type)
|
||||
{
|
||||
return ct;
|
||||
}
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the raw type value of the message type.
|
||||
*
|
||||
* @return the raw type
|
||||
*/
|
||||
public int getType()
|
||||
{
|
||||
return type;
|
||||
return CHAT_MESSAGE_TYPES.getOrDefault(type, UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.account.SessionManager;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
@@ -73,6 +74,13 @@ public class RuneLiteModule extends AbstractModule
|
||||
return configManager.getConfig(RuneLiteConfig.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ChatColorConfig provideChatColorConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(ChatColorConfig.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
EventBus provideEventBus()
|
||||
|
||||
@@ -25,16 +25,28 @@
|
||||
package net.runelite.client.chat;
|
||||
|
||||
import java.awt.Color;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(exclude = "color")
|
||||
@EqualsAndHashCode(exclude = {"color", "isDefault"})
|
||||
public class ChatColor
|
||||
{
|
||||
private ChatColorType type;
|
||||
private Color color;
|
||||
private boolean transparent;
|
||||
private boolean isDefault;
|
||||
|
||||
public ChatColor(ChatColorType type, Color color, boolean transparent)
|
||||
{
|
||||
this(type, color, transparent, false);
|
||||
}
|
||||
|
||||
public ChatColor(ChatColorType type, Color color, boolean transparent, boolean isDefault)
|
||||
{
|
||||
this.type = type;
|
||||
this.color = color;
|
||||
this.transparent = transparent;
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,14 +26,14 @@ package net.runelite.client.chat;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import java.awt.Color;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -46,24 +46,30 @@ import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.ResizeableChanged;
|
||||
import net.runelite.api.events.SetMessage;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class ChatMessageManager
|
||||
{
|
||||
private final Map<ChatMessageType, Set<ChatColor>> colorCache = new HashMap<>();
|
||||
private final Multimap<ChatMessageType, ChatColor> colorCache = HashMultimap.create();
|
||||
private final Provider<Client> clientProvider;
|
||||
private final ScheduledExecutorService executor;
|
||||
private final ChatColorConfig chatColorConfig;
|
||||
private int transparencyVarbit = -1;
|
||||
private final Queue<QueuedMessage> queuedMessages = new ConcurrentLinkedQueue<>();
|
||||
|
||||
@Inject
|
||||
public ChatMessageManager(Provider<Client> clientProvider, ScheduledExecutorService executor)
|
||||
private ChatMessageManager(Provider<Client> clientProvider, ScheduledExecutorService executor,
|
||||
ChatColorConfig chatColorConfig)
|
||||
{
|
||||
this.clientProvider = clientProvider;
|
||||
this.executor = executor;
|
||||
this.chatColorConfig = chatColorConfig;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -84,14 +90,390 @@ public class ChatMessageManager
|
||||
refreshAll();
|
||||
}
|
||||
|
||||
public ChatMessageManager cacheColor(final ChatColor chatColor, final ChatMessageType... types)
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("textrecolor"))
|
||||
{
|
||||
loadColors();
|
||||
refreshAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onSetMessage(SetMessage setMessage)
|
||||
{
|
||||
final Client client = clientProvider.get();
|
||||
MessageNode messageNode = setMessage.getMessageNode();
|
||||
ChatMessageType chatMessageType = setMessage.getType();
|
||||
|
||||
boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1;
|
||||
Color usernameColor = null;
|
||||
Color senderColor = null;
|
||||
|
||||
switch (chatMessageType)
|
||||
{
|
||||
case PRIVATE_MESSAGE_RECEIVED_MOD:
|
||||
case PRIVATE_MESSAGE_RECEIVED:
|
||||
case PRIVATE_MESSAGE_SENT:
|
||||
usernameColor = isChatboxTransparent ? chatColorConfig.transparentPrivateUsernames() : chatColorConfig.opaquePrivateUsernames();
|
||||
break;
|
||||
|
||||
case TRADE:
|
||||
case AUTOCHAT:
|
||||
case PUBLIC:
|
||||
usernameColor = isChatboxTransparent ? chatColorConfig.transparentUsername() : chatColorConfig.opaqueUsername();
|
||||
break;
|
||||
|
||||
case CLANCHAT:
|
||||
usernameColor = isChatboxTransparent ? chatColorConfig.transparentClanUsernames() : chatColorConfig.opaqueClanUsernames();
|
||||
break;
|
||||
}
|
||||
|
||||
senderColor = isChatboxTransparent ? chatColorConfig.transparentClanChannelName() : chatColorConfig.opaqueClanChannelName();
|
||||
|
||||
if (usernameColor != null)
|
||||
{
|
||||
messageNode.setName(wrapTextWithColour(messageNode.getName(), usernameColor));
|
||||
}
|
||||
|
||||
String sender = setMessage.getSender();
|
||||
if (senderColor != null && !Strings.isNullOrEmpty(sender))
|
||||
{
|
||||
messageNode.setSender(wrapTextWithColour(sender, senderColor));
|
||||
}
|
||||
|
||||
final Collection<ChatColor> chatColors = colorCache.get(chatMessageType);
|
||||
for (ChatColor chatColor : chatColors)
|
||||
{
|
||||
if (chatColor.isTransparent() != isChatboxTransparent || chatColor.getType() != ChatColorType.NORMAL || chatColor.isDefault())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
messageNode.setValue(wrapTextWithColour(messageNode.getValue(), chatColor.getColor()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static String wrapTextWithColour(String text, Color colour)
|
||||
{
|
||||
return "<col=" + Integer.toHexString(colour.getRGB() & 0xFFFFFF) + ">" + text + "</col>";
|
||||
}
|
||||
|
||||
private static Color getDefaultColor(ChatMessageType type, boolean transparent)
|
||||
{
|
||||
if (!transparent)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case PUBLIC:
|
||||
return Color.decode("#0000FF");
|
||||
case PRIVATE_MESSAGE_SENT:
|
||||
case PRIVATE_MESSAGE_RECEIVED:
|
||||
return Color.decode("#00FFFF");
|
||||
case CLANCHAT:
|
||||
return Color.decode("#7F0000");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case PUBLIC:
|
||||
return Color.decode("#9090FF");
|
||||
case PRIVATE_MESSAGE_SENT:
|
||||
case PRIVATE_MESSAGE_RECEIVED:
|
||||
return Color.decode("#00FFFF");
|
||||
case CLANCHAT:
|
||||
return Color.decode("#7F0000");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void loadColors()
|
||||
{
|
||||
colorCache.clear();
|
||||
|
||||
// Apply defaults
|
||||
for (ChatMessageType chatMessageType : ChatMessageType.values())
|
||||
{
|
||||
Color defaultTransparent = getDefaultColor(chatMessageType, true);
|
||||
if (defaultTransparent != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, defaultTransparent, true, true), chatMessageType);
|
||||
}
|
||||
|
||||
Color defaultOpaque = getDefaultColor(chatMessageType, false);
|
||||
if (defaultOpaque != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, defaultOpaque, false, true), chatMessageType);
|
||||
}
|
||||
}
|
||||
|
||||
if (chatColorConfig.opaquePublicChat() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaquePublicChat(), false),
|
||||
ChatMessageType.PUBLIC);
|
||||
}
|
||||
if (chatColorConfig.opaquePublicChatHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaquePublicChatHighlight(), false),
|
||||
ChatMessageType.PUBLIC);
|
||||
}
|
||||
if (chatColorConfig.opaquePrivateMessageSent() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaquePrivateMessageSent(), false),
|
||||
ChatMessageType.PRIVATE_MESSAGE_SENT);
|
||||
}
|
||||
if (chatColorConfig.opaquePrivateMessageSentHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaquePrivateMessageSentHighlight(), false),
|
||||
ChatMessageType.PRIVATE_MESSAGE_SENT);
|
||||
}
|
||||
if (chatColorConfig.opaquePrivateMessageReceived() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaquePrivateMessageReceived(), false),
|
||||
ChatMessageType.PRIVATE_MESSAGE_RECEIVED);
|
||||
}
|
||||
if (chatColorConfig.opaquePrivateMessageReceivedHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaquePrivateMessageReceivedHighlight(), false),
|
||||
ChatMessageType.PRIVATE_MESSAGE_RECEIVED);
|
||||
}
|
||||
if (chatColorConfig.opaqueClanChatInfo() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatInfo(), false),
|
||||
ChatMessageType.CLANCHAT_INFO);
|
||||
}
|
||||
if (chatColorConfig.opaqueClanChatMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatMessage(), false),
|
||||
ChatMessageType.CLANCHAT);
|
||||
}
|
||||
if (chatColorConfig.opaqueClanChatMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatMessageHighlight(), false),
|
||||
ChatMessageType.CLANCHAT);
|
||||
}
|
||||
if (chatColorConfig.opaqueAutochatMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueAutochatMessage(), false),
|
||||
ChatMessageType.AUTOCHAT);
|
||||
}
|
||||
if (chatColorConfig.opaqueAutochatMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueAutochatMessageHighlight(), false),
|
||||
ChatMessageType.AUTOCHAT);
|
||||
}
|
||||
if (chatColorConfig.opaqueTradeChatMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueTradeChatMessage(), false),
|
||||
ChatMessageType.TRADE);
|
||||
}
|
||||
if (chatColorConfig.opaqueTradeChatMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueTradeChatMessageHighlight(), false),
|
||||
ChatMessageType.TRADE);
|
||||
}
|
||||
if (chatColorConfig.opaqueServerMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueServerMessage(), false),
|
||||
ChatMessageType.SERVER);
|
||||
}
|
||||
if (chatColorConfig.opaqueServerMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueServerMessageHighlight(), false),
|
||||
ChatMessageType.SERVER);
|
||||
}
|
||||
if (chatColorConfig.opaqueGameMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueGameMessage(), false),
|
||||
ChatMessageType.GAME);
|
||||
}
|
||||
if (chatColorConfig.opaqueGameMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueGameMessageHighlight(), false),
|
||||
ChatMessageType.GAME);
|
||||
}
|
||||
if (chatColorConfig.opaqueExamine() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueExamine(), false),
|
||||
ChatMessageType.EXAMINE_OBJECT);
|
||||
}
|
||||
if (chatColorConfig.opaqueExamineHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueExamineHighlight(), false),
|
||||
ChatMessageType.EXAMINE_OBJECT);
|
||||
}
|
||||
if (chatColorConfig.opaqueExamine() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueExamine(), false),
|
||||
ChatMessageType.EXAMINE_NPC);
|
||||
}
|
||||
if (chatColorConfig.opaqueExamineHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueExamineHighlight(), false),
|
||||
ChatMessageType.EXAMINE_NPC);
|
||||
}
|
||||
if (chatColorConfig.opaqueExamine() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueExamine(), false),
|
||||
ChatMessageType.EXAMINE_ITEM);
|
||||
}
|
||||
if (chatColorConfig.opaqueExamineHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueExamineHighlight(), false),
|
||||
ChatMessageType.EXAMINE_ITEM);
|
||||
}
|
||||
if (chatColorConfig.opaqueFiltered() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueFiltered(), false),
|
||||
ChatMessageType.FILTERED);
|
||||
}
|
||||
if (chatColorConfig.opaqueFilteredHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueFilteredHighlight(), false),
|
||||
ChatMessageType.FILTERED);
|
||||
}
|
||||
|
||||
//Transparent Chat Colours
|
||||
if (chatColorConfig.transparentPublicChat() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentPublicChat(), true),
|
||||
ChatMessageType.PUBLIC);
|
||||
}
|
||||
if (chatColorConfig.transparentPublicChatHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPublicChatHighlight(), true),
|
||||
ChatMessageType.PUBLIC);
|
||||
}
|
||||
if (chatColorConfig.transparentPrivateMessageSent() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentPrivateMessageSent(), true),
|
||||
ChatMessageType.PRIVATE_MESSAGE_SENT);
|
||||
}
|
||||
if (chatColorConfig.transparentPrivateMessageSentHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPrivateMessageSentHighlight(), true),
|
||||
ChatMessageType.PRIVATE_MESSAGE_SENT);
|
||||
}
|
||||
if (chatColorConfig.transparentPrivateMessageReceived() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentPrivateMessageReceived(), true),
|
||||
ChatMessageType.PRIVATE_MESSAGE_RECEIVED);
|
||||
}
|
||||
if (chatColorConfig.transparentPrivateMessageReceivedHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPrivateMessageReceivedHighlight(), true),
|
||||
ChatMessageType.PRIVATE_MESSAGE_RECEIVED);
|
||||
}
|
||||
if (chatColorConfig.transparentClanChatInfo() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatInfo(), true),
|
||||
ChatMessageType.CLANCHAT_INFO);
|
||||
}
|
||||
if (chatColorConfig.transparentClanChatMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatMessage(), true),
|
||||
ChatMessageType.CLANCHAT);
|
||||
}
|
||||
if (chatColorConfig.transparentClanChatMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatMessageHighlight(), true),
|
||||
ChatMessageType.CLANCHAT);
|
||||
}
|
||||
if (chatColorConfig.transparentAutochatMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentAutochatMessage(), true),
|
||||
ChatMessageType.AUTOCHAT);
|
||||
}
|
||||
if (chatColorConfig.transparentAutochatMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentAutochatMessageHighlight(), true),
|
||||
ChatMessageType.AUTOCHAT);
|
||||
}
|
||||
if (chatColorConfig.transparentTradeChatMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentTradeChatMessage(), true),
|
||||
ChatMessageType.TRADE);
|
||||
}
|
||||
if (chatColorConfig.transparentTradeChatMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentTradeChatMessageHighlight(), true),
|
||||
ChatMessageType.TRADE);
|
||||
}
|
||||
if (chatColorConfig.transparentServerMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentServerMessage(), true),
|
||||
ChatMessageType.SERVER);
|
||||
}
|
||||
if (chatColorConfig.transparentServerMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentServerMessageHighlight(), true),
|
||||
ChatMessageType.SERVER);
|
||||
}
|
||||
if (chatColorConfig.transparentGameMessage() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentGameMessage(), true),
|
||||
ChatMessageType.GAME);
|
||||
}
|
||||
if (chatColorConfig.transparentGameMessageHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentGameMessageHighlight(), true),
|
||||
ChatMessageType.GAME);
|
||||
}
|
||||
if (chatColorConfig.transparentExamine() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentExamine(), true),
|
||||
ChatMessageType.EXAMINE_OBJECT);
|
||||
}
|
||||
if (chatColorConfig.transparentExamineHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentExamineHighlight(), true),
|
||||
ChatMessageType.EXAMINE_OBJECT);
|
||||
}
|
||||
if (chatColorConfig.transparentExamine() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentExamine(), true),
|
||||
ChatMessageType.EXAMINE_NPC);
|
||||
}
|
||||
if (chatColorConfig.transparentExamineHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentExamineHighlight(), true),
|
||||
ChatMessageType.EXAMINE_NPC);
|
||||
}
|
||||
if (chatColorConfig.transparentExamine() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentExamine(), true),
|
||||
ChatMessageType.EXAMINE_ITEM);
|
||||
}
|
||||
if (chatColorConfig.transparentExamineHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentExamineHighlight(), true),
|
||||
ChatMessageType.EXAMINE_ITEM);
|
||||
}
|
||||
if (chatColorConfig.transparentFiltered() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentFiltered(), true),
|
||||
ChatMessageType.FILTERED);
|
||||
}
|
||||
if (chatColorConfig.transparentFilteredHighlight() != null)
|
||||
{
|
||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentFilteredHighlight(), true),
|
||||
ChatMessageType.FILTERED);
|
||||
}
|
||||
}
|
||||
|
||||
private ChatMessageManager cacheColor(final ChatColor chatColor, final ChatMessageType... types)
|
||||
{
|
||||
for (ChatMessageType chatMessageType : types)
|
||||
{
|
||||
colorCache.putIfAbsent(chatMessageType, new HashSet<>());
|
||||
final Set<ChatColor> chatColors = colorCache.get(chatMessageType);
|
||||
chatColors.remove(chatColor);
|
||||
chatColors.add(chatColor);
|
||||
// color is excluded from equals/hashCode on ChatColor
|
||||
colorCache.remove(chatMessageType, chatColor);
|
||||
colorCache.put(chatMessageType, chatColor);
|
||||
}
|
||||
|
||||
return this;
|
||||
@@ -117,10 +499,10 @@ public class ChatMessageManager
|
||||
|
||||
// this updates chat cycle
|
||||
client.addChatMessage(
|
||||
message.getType(),
|
||||
MoreObjects.firstNonNull(message.getName(), ""),
|
||||
MoreObjects.firstNonNull(message.getValue(), message.getRuneLiteFormattedMessage()),
|
||||
message.getSender());
|
||||
message.getType(),
|
||||
MoreObjects.firstNonNull(message.getName(), ""),
|
||||
MoreObjects.firstNonNull(message.getValue(), message.getRuneLiteFormattedMessage()),
|
||||
message.getSender());
|
||||
|
||||
// Get last message from line buffer (the one we just added)
|
||||
final ChatLineBuffer chatLineBuffer = client.getChatLineMap().get(message.getType().getType());
|
||||
@@ -141,7 +523,7 @@ public class ChatMessageManager
|
||||
|
||||
final Client client = clientProvider.get();
|
||||
final boolean transparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) != 0;
|
||||
final Set<ChatColor> chatColors = colorCache.get(target.getType());
|
||||
final Collection<ChatColor> chatColors = colorCache.get(target.getType());
|
||||
|
||||
// If we do not have any colors cached, simply set clean message
|
||||
if (chatColors == null || chatColors.isEmpty())
|
||||
@@ -155,7 +537,7 @@ public class ChatMessageManager
|
||||
|
||||
private String recolorMessage(boolean transparent, String message, ChatMessageType messageType)
|
||||
{
|
||||
final Set<ChatColor> chatColors = colorCache.get(messageType);
|
||||
final Collection<ChatColor> chatColors = colorCache.get(messageType);
|
||||
final AtomicReference<String> resultMessage = new AtomicReference<>(message);
|
||||
|
||||
// Replace custom formatting with actual colors
|
||||
|
||||
@@ -0,0 +1,459 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Hydrox6 <ikada@protonmail.ch>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.config;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
@ConfigGroup(
|
||||
keyName = "textrecolor",
|
||||
name = "Chat Text Recolor",
|
||||
description = "Configuration for chat text recoloring"
|
||||
)
|
||||
public interface ChatColorConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 31,
|
||||
keyName = "opaquePublicChat",
|
||||
name = "Public chat",
|
||||
description = "Color of Public chat"
|
||||
)
|
||||
Color opaquePublicChat();
|
||||
|
||||
@ConfigItem(
|
||||
position = 32,
|
||||
keyName = "opaquePublicChatHighlight",
|
||||
name = "Public chat highlight",
|
||||
description = "Color of highlights in Public chat"
|
||||
)
|
||||
default Color opaquePublicChatHighlight()
|
||||
{
|
||||
return Color.decode("#000000");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 33,
|
||||
keyName = "opaquePrivateMessageSent",
|
||||
name = "Sent private messages",
|
||||
description = "Color of Private messages you've sent"
|
||||
)
|
||||
Color opaquePrivateMessageSent();
|
||||
|
||||
@ConfigItem(
|
||||
position = 34,
|
||||
keyName = "opaquePrivateMessageSentHighlight",
|
||||
name = "Sent private messages highlight",
|
||||
description = "Color of highlights in Private messages you've sent"
|
||||
)
|
||||
default Color opaquePrivateMessageSentHighlight()
|
||||
{
|
||||
return Color.decode("#002783");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 35,
|
||||
keyName = "opaquePrivateMessageReceived",
|
||||
name = "Recieved private messages",
|
||||
description = "Color of Private messages you've received"
|
||||
)
|
||||
Color opaquePrivateMessageReceived();
|
||||
|
||||
@ConfigItem(
|
||||
position = 36,
|
||||
keyName = "opaquePrivateMessageReceivedHighlight",
|
||||
name = "Received private messages highlight",
|
||||
description = "Color of highlights in Private messages you've received"
|
||||
)
|
||||
default Color opaquePrivateMessageReceivedHighlight()
|
||||
{
|
||||
return Color.decode("#002783");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 37,
|
||||
keyName = "opaqueClanChatInfo",
|
||||
name = "Clan chat info",
|
||||
description = "Clan Chat Information (eg. when joining a channel)"
|
||||
)
|
||||
Color opaqueClanChatInfo();
|
||||
|
||||
@ConfigItem(
|
||||
position = 38,
|
||||
keyName = "opaqueClanChatMessage",
|
||||
name = "Clan chat message",
|
||||
description = "Color of Clan Chat Messages"
|
||||
)
|
||||
Color opaqueClanChatMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 39,
|
||||
keyName = "opaqueClanChatMessageHighlight",
|
||||
name = "Clan chat message highlight",
|
||||
description = "Color of highlights in Clan Chat Messages"
|
||||
)
|
||||
default Color opaqueClanChatMessageHighlight()
|
||||
{
|
||||
return Color.decode("#000000");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 40,
|
||||
keyName = "opaqueAutochatMessage",
|
||||
name = "Autochat",
|
||||
description = "Color of Autochat messages"
|
||||
)
|
||||
Color opaqueAutochatMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 41,
|
||||
keyName = "opaqueAutochatMessageHighlight",
|
||||
name = "Autochat highlight",
|
||||
description = "Color of highlights in Autochat messages"
|
||||
)
|
||||
Color opaqueAutochatMessageHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 42,
|
||||
keyName = "opaqueTradeChatMessage",
|
||||
name = "Trade chat",
|
||||
description = "Color of Trade Chat Messages"
|
||||
)
|
||||
Color opaqueTradeChatMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 43,
|
||||
keyName = "opaqueTradeChatMessageHighlight",
|
||||
name = "Trade chat highlight",
|
||||
description = "Color of highlights in Trade Chat Messages"
|
||||
)
|
||||
Color opaqueTradeChatMessageHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 44,
|
||||
keyName = "opaqueServerMessage",
|
||||
name = "Server message",
|
||||
description = "Color of Server Messages (eg. 'Welcome to Runescape')"
|
||||
)
|
||||
Color opaqueServerMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 45,
|
||||
keyName = "opaqueServerMessageHighlight",
|
||||
name = "Server message highlight",
|
||||
description = "Color of highlights in Server Messages"
|
||||
)
|
||||
Color opaqueServerMessageHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 46,
|
||||
keyName = "opaqueGameMessage",
|
||||
name = "Game message",
|
||||
description = "Color of Game Messages"
|
||||
)
|
||||
Color opaqueGameMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 47,
|
||||
keyName = "opaqueGameMessageHighlight",
|
||||
name = "Game message highlight",
|
||||
description = "Color of highlights in Game Messages"
|
||||
)
|
||||
Color opaqueGameMessageHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 48,
|
||||
keyName = "opaqueExamine",
|
||||
name = "Examine",
|
||||
description = "Color of Examine Text"
|
||||
)
|
||||
Color opaqueExamine();
|
||||
|
||||
@ConfigItem(
|
||||
position = 49,
|
||||
keyName = "opaqueExamineHighlight",
|
||||
name = "Examine Highlight",
|
||||
description = "Color of highlights in Examine Text"
|
||||
)
|
||||
Color opaqueExamineHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 50,
|
||||
keyName = "opaqueFiltered",
|
||||
name = "Filtered",
|
||||
description = "Color of Filtered Text (messages that aren't shown when Game messages are filtered)"
|
||||
)
|
||||
Color opaqueFiltered();
|
||||
|
||||
@ConfigItem(
|
||||
position = 51,
|
||||
keyName = "opaqueFilteredHighlight",
|
||||
name = "Filtered Highlight",
|
||||
description = "Color of highlights in Filtered Text"
|
||||
)
|
||||
Color opaqueFilteredHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 52,
|
||||
keyName = "opaqueUsername",
|
||||
name = "Usernames",
|
||||
description = "Color of Usernames"
|
||||
)
|
||||
Color opaqueUsername();
|
||||
|
||||
@ConfigItem(
|
||||
position = 53,
|
||||
keyName = "opaquePrivateUsernames",
|
||||
name = "Private chat usernames",
|
||||
description = "Color of Usernames in Private Chat"
|
||||
)
|
||||
Color opaquePrivateUsernames();
|
||||
|
||||
@ConfigItem(
|
||||
position = 54,
|
||||
keyName = "opaqueClanChannelName",
|
||||
name = "Chan channel Name",
|
||||
description = "Color of Clan Channel Name"
|
||||
)
|
||||
Color opaqueClanChannelName();
|
||||
|
||||
@ConfigItem(
|
||||
position = 55,
|
||||
keyName = "opaqueClanUsernames",
|
||||
name = "Clan usernames",
|
||||
description = "Color of Usernames in Clan Chat"
|
||||
)
|
||||
Color opaqueClanUsernames();
|
||||
|
||||
@ConfigItem(
|
||||
position = 61,
|
||||
keyName = "transparentPublicChat",
|
||||
name = "Public chat (transparent)",
|
||||
description = "Color of Public chat (transparent)"
|
||||
)
|
||||
Color transparentPublicChat();
|
||||
|
||||
@ConfigItem(
|
||||
position = 62,
|
||||
keyName = "transparentPublicChatHighlight",
|
||||
name = "Public chat highlight (transparent)",
|
||||
description = "Color of highlights in Public chat (transparent)"
|
||||
)
|
||||
default Color transparentPublicChatHighlight()
|
||||
{
|
||||
return Color.decode("#FFFFFF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 63,
|
||||
keyName = "transparentPrivateMessageSent",
|
||||
name = "Sent private messages (transparent)",
|
||||
description = "Color of Private messages you've sent (transparent)"
|
||||
)
|
||||
Color transparentPrivateMessageSent();
|
||||
|
||||
@ConfigItem(
|
||||
position = 64,
|
||||
keyName = "transparentPrivateMessageSentHighlight",
|
||||
name = "Sent private messages highlight (transparent)",
|
||||
description = "Color of highlights in Private messages you've sent (transparent)"
|
||||
)
|
||||
default Color transparentPrivateMessageSentHighlight()
|
||||
{
|
||||
return Color.decode("#FFFFFF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 65,
|
||||
keyName = "transparentPrivateMessageReceived",
|
||||
name = "Received private messages (transparent)",
|
||||
description = "Color of Private messages you've received (transparent)"
|
||||
)
|
||||
Color transparentPrivateMessageReceived();
|
||||
|
||||
@ConfigItem(
|
||||
position = 66,
|
||||
keyName = "transparentPrivateMessageReceivedHighlight",
|
||||
name = "Received private messages highlight (transparent)",
|
||||
description = "Color of highlights in Private messages you've received (transparent)"
|
||||
)
|
||||
default Color transparentPrivateMessageReceivedHighlight()
|
||||
{
|
||||
return Color.decode("#FFFFFF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 67,
|
||||
keyName = "transparentClanChatInfo",
|
||||
name = "Clan chat info (transparent)",
|
||||
description = "Clan Chat Information (eg. when joining a channel) (transparent)"
|
||||
)
|
||||
Color transparentClanChatInfo();
|
||||
|
||||
@ConfigItem(
|
||||
position = 68,
|
||||
keyName = "transparentClanChatMessage",
|
||||
name = "Clan chat message (transparent)",
|
||||
description = "Color of Clan Chat Messages (transparent)"
|
||||
)
|
||||
Color transparentClanChatMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 69,
|
||||
keyName = "transparentClanChatMessageHighlight",
|
||||
name = "Clan chat message highlight (transparent)",
|
||||
description = "Color of highlights in Clan Chat Messages (transparent)"
|
||||
)
|
||||
default Color transparentClanChatMessageHighlight()
|
||||
{
|
||||
return Color.decode("#FFFFFF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 70,
|
||||
keyName = "transparentAutochatMessage",
|
||||
name = "Autochat (transparent)",
|
||||
description = "Color of Autochat messages (transparent)"
|
||||
)
|
||||
Color transparentAutochatMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 71,
|
||||
keyName = "transparentAutochatMessageHighlight",
|
||||
name = "Autochat highlight (transparent)",
|
||||
description = "Color of highlights in Autochat messages (transparent)"
|
||||
)
|
||||
Color transparentAutochatMessageHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 72,
|
||||
keyName = "transparentTradeChatMessage",
|
||||
name = "Trade chat (transparent)",
|
||||
description = "Color of Trade Chat Messages (transparent)"
|
||||
)
|
||||
Color transparentTradeChatMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 73,
|
||||
keyName = "transparentTradeChatMessageHighlight",
|
||||
name = "Trade chat highlight (transparent)",
|
||||
description = "Color of highlights in Trade Chat Messages (transparent)"
|
||||
)
|
||||
Color transparentTradeChatMessageHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 74,
|
||||
keyName = "transparentServerMessage",
|
||||
name = "Server message (transparent)",
|
||||
description = "Color of Server Messages (eg. 'Welcome to Runescape') (transparent)"
|
||||
)
|
||||
Color transparentServerMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 75,
|
||||
keyName = "transparentServerMessageHighlight",
|
||||
name = "Server message highlight (transparent)",
|
||||
description = "Color of highlights in Server Messages (transparent)"
|
||||
)
|
||||
Color transparentServerMessageHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 76,
|
||||
keyName = "transparentGameMessage",
|
||||
name = "Game message (transparent)",
|
||||
description = "Color of Game Messages (transparent)"
|
||||
)
|
||||
Color transparentGameMessage();
|
||||
|
||||
@ConfigItem(
|
||||
position = 77,
|
||||
keyName = "transparentGameMessageHighlight",
|
||||
name = "Game message highlight (transparent)",
|
||||
description = "Color of highlights in Game Messages (transparent)"
|
||||
)
|
||||
Color transparentGameMessageHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 78,
|
||||
keyName = "transparentExamine",
|
||||
name = "Examine (transparent)",
|
||||
description = "Color of Examine Text (transparent)"
|
||||
)
|
||||
Color transparentExamine();
|
||||
|
||||
@ConfigItem(
|
||||
position = 79,
|
||||
keyName = "transparentExamineHighlight",
|
||||
name = "Examine Highlight (transparent)",
|
||||
description = "Color of highlights in Examine Text (transparent)"
|
||||
)
|
||||
Color transparentExamineHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 80,
|
||||
keyName = "transparentFiltered",
|
||||
name = "Filtered (transparent)",
|
||||
description = "Color of Filtered Text (messages that aren't shown when Game messages are filtered) (transparent)"
|
||||
)
|
||||
Color transparentFiltered();
|
||||
|
||||
@ConfigItem(
|
||||
position = 81,
|
||||
keyName = "transparentFilteredHighlight",
|
||||
name = "Filtered Highlight (transparent)",
|
||||
description = "Color of highlights in Filtered Text (transparent)"
|
||||
)
|
||||
Color transparentFilteredHighlight();
|
||||
|
||||
@ConfigItem(
|
||||
position = 82,
|
||||
keyName = "transparentUsername",
|
||||
name = "Usernames (transparent)",
|
||||
description = "Color of Usernames (transparent)"
|
||||
)
|
||||
Color transparentUsername();
|
||||
|
||||
@ConfigItem(
|
||||
position = 83,
|
||||
keyName = "transparentPrivateUsernames",
|
||||
name = "Private chat usernames (transparent)",
|
||||
description = "Color of Usernames in Private Chat (transparent)"
|
||||
)
|
||||
Color transparentPrivateUsernames();
|
||||
|
||||
@ConfigItem(
|
||||
position = 84,
|
||||
keyName = "transparentClanChannelName",
|
||||
name = "Chan channel Name (transparent)",
|
||||
description = "Color of Clan Channel Name (transparent)"
|
||||
)
|
||||
Color transparentClanChannelName();
|
||||
|
||||
@ConfigItem(
|
||||
position = 85,
|
||||
keyName = "transparentClanUsernames",
|
||||
name = "Clan usernames (transparent)",
|
||||
description = "Color of Usernames in Clan Chat (transparent)"
|
||||
)
|
||||
Color transparentClanUsernames();
|
||||
}
|
||||
@@ -43,6 +43,7 @@ import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -390,11 +391,25 @@ public class ConfigManager
|
||||
{
|
||||
ConfigItem item = method.getAnnotation(ConfigItem.class);
|
||||
|
||||
if (item == null || !method.isDefault())
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!method.isDefault())
|
||||
{
|
||||
if (override)
|
||||
{
|
||||
String current = getConfiguration(group.keyName(), item.keyName());
|
||||
// only unset if already set
|
||||
if (current != null)
|
||||
{
|
||||
unsetConfiguration(group.keyName(), item.keyName());
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!override)
|
||||
{
|
||||
String current = getConfiguration(group.keyName(), item.keyName());
|
||||
@@ -415,9 +430,15 @@ public class ConfigManager
|
||||
continue;
|
||||
}
|
||||
|
||||
String current = getConfiguration(group.keyName(), item.keyName());
|
||||
String valueString = objectToString(defaultValue);
|
||||
if (Objects.equals(current, valueString))
|
||||
{
|
||||
continue; // already set to the default value
|
||||
}
|
||||
|
||||
log.debug("Setting default configuration value for {}.{} to {}", group.keyName(), item.keyName(), defaultValue);
|
||||
|
||||
String valueString = objectToString(defaultValue);
|
||||
setConfiguration(group.keyName(), item.keyName(), valueString);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.chatcommands;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -57,136 +56,4 @@ public interface ChatCommandsConfig extends Config
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "hexColorPublic",
|
||||
name = "Public chat",
|
||||
description = "Color of Public chat"
|
||||
)
|
||||
default Color getPublicRecolor()
|
||||
{
|
||||
return Color.decode("#0000FF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "hexColorPublicH",
|
||||
name = "Public chat highlight",
|
||||
description = "Color of Public chat highlight"
|
||||
)
|
||||
default Color getPublicHRecolor()
|
||||
{
|
||||
return Color.decode("#000000");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "hexColorPrivate",
|
||||
name = "Private chat",
|
||||
description = "Color of Private chat"
|
||||
)
|
||||
default Color getPrivateRecolor()
|
||||
{
|
||||
return Color.decode("#0088FF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "hexColorPrivateH",
|
||||
name = "Private chat highlight",
|
||||
description = "Color of Private chat highlight"
|
||||
)
|
||||
default Color getPrivateHRecolor()
|
||||
{
|
||||
return Color.decode("#002783");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "hexColorCc",
|
||||
name = "Clan chat",
|
||||
description = "Color of Clan chat"
|
||||
)
|
||||
default Color getCcRecolor()
|
||||
{
|
||||
return Color.decode("#7f0000");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "hexColorCcH",
|
||||
name = "Clan chat Highlight",
|
||||
description = "Color of Clan chat highlight"
|
||||
)
|
||||
default Color getCcHRecolor()
|
||||
{
|
||||
return Color.decode("#000000");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "transparentHexColorPublic",
|
||||
name = "Transparent public chat",
|
||||
description = "Color of Public chat"
|
||||
)
|
||||
default Color getTransparentPublicRecolor()
|
||||
{
|
||||
return Color.decode("#9090FF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "transparentHexColorPublicH",
|
||||
name = "Transparent public chat highlight",
|
||||
description = "Color of Public chat highlight"
|
||||
)
|
||||
default Color getTransparentPublicHRecolor()
|
||||
{
|
||||
return Color.decode("#FFFFFF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "transparentHexColorPrivate",
|
||||
name = "Transparent private chat",
|
||||
description = "Color of Private chat"
|
||||
)
|
||||
default Color getTransparentPrivateRecolor()
|
||||
{
|
||||
return Color.decode("#FFFFFF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "transparentHexColorPrivateH",
|
||||
name = "Transparent private chat highlight",
|
||||
description = "Color of Private chat highlight"
|
||||
)
|
||||
default Color getTransparentPrivateHRecolor()
|
||||
{
|
||||
return Color.decode("#00FFFF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
keyName = "transparentHexColorCc",
|
||||
name = "Transparent clan chat",
|
||||
description = "Color of Clan chat"
|
||||
)
|
||||
default Color getTransparentCcRecolor()
|
||||
{
|
||||
return Color.decode("#Ef5050");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 13,
|
||||
keyName = "transparentHexColorCcH",
|
||||
name = "Transparent clan chat Highlight",
|
||||
description = "Color of Clan chat highlight"
|
||||
)
|
||||
default Color getTransparentCcHRecolor()
|
||||
{
|
||||
return Color.decode("#FFFFFF");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,7 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.SetMessage;
|
||||
import net.runelite.client.chat.ChatColor;
|
||||
import net.runelite.client.chat.ChatColorType;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
@@ -83,67 +80,12 @@ public class ChatCommandsPlugin extends Plugin
|
||||
@Inject
|
||||
private ScheduledExecutorService executor;
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
cacheConfiguredColors();
|
||||
chatMessageManager.refreshAll();
|
||||
}
|
||||
|
||||
@Provides
|
||||
ChatCommandsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(ChatCommandsConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChange(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState().equals(GameState.LOGIN_SCREEN))
|
||||
{
|
||||
cacheConfiguredColors();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("chatcommands"))
|
||||
{
|
||||
cacheConfiguredColors();
|
||||
chatMessageManager.refreshAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void cacheConfiguredColors()
|
||||
{
|
||||
chatMessageManager
|
||||
.cacheColor(new ChatColor(ChatColorType.NORMAL, config.getPublicRecolor(), false),
|
||||
ChatMessageType.PUBLIC)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, config.getPublicHRecolor(), false),
|
||||
ChatMessageType.PUBLIC)
|
||||
.cacheColor(new ChatColor(ChatColorType.NORMAL, config.getPrivateRecolor(), false),
|
||||
ChatMessageType.PRIVATE_MESSAGE_SENT, ChatMessageType.PRIVATE_MESSAGE_RECEIVED)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, config.getPrivateHRecolor(), false),
|
||||
ChatMessageType.PRIVATE_MESSAGE_SENT, ChatMessageType.PRIVATE_MESSAGE_RECEIVED)
|
||||
.cacheColor(new ChatColor(ChatColorType.NORMAL, config.getCcRecolor(), false),
|
||||
ChatMessageType.CLANCHAT)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, config.getCcHRecolor(), false),
|
||||
ChatMessageType.CLANCHAT)
|
||||
.cacheColor(new ChatColor(ChatColorType.NORMAL, config.getTransparentPublicRecolor(), true),
|
||||
ChatMessageType.PUBLIC)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, config.getTransparentPublicHRecolor(), true),
|
||||
ChatMessageType.PUBLIC)
|
||||
.cacheColor(new ChatColor(ChatColorType.NORMAL, config.getTransparentPrivateRecolor(), true),
|
||||
ChatMessageType.PRIVATE_MESSAGE_SENT, ChatMessageType.PRIVATE_MESSAGE_RECEIVED)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, config.getTransparentPrivateHRecolor(), true),
|
||||
ChatMessageType.PRIVATE_MESSAGE_SENT, ChatMessageType.PRIVATE_MESSAGE_RECEIVED)
|
||||
.cacheColor(new ChatColor(ChatColorType.NORMAL, config.getTransparentCcRecolor(), true),
|
||||
ChatMessageType.CLANCHAT)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, config.getTransparentCcHRecolor(), true),
|
||||
ChatMessageType.CLANCHAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the chat message is a command.
|
||||
*
|
||||
|
||||
@@ -67,6 +67,7 @@ import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigDescriptor;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -119,17 +120,20 @@ public class ConfigPanel extends PluginPanel
|
||||
private final ConfigManager configManager;
|
||||
private final ScheduledExecutorService executorService;
|
||||
private final RuneLiteConfig runeLiteConfig;
|
||||
private final ChatColorConfig chatColorConfig;
|
||||
private final IconTextField searchBar = new IconTextField();
|
||||
private Map<String, JPanel> children = new TreeMap<>();
|
||||
private int scrollBarPosition = 0;
|
||||
|
||||
public ConfigPanel(PluginManager pluginManager, ConfigManager configManager, ScheduledExecutorService executorService, RuneLiteConfig runeLiteConfig)
|
||||
public ConfigPanel(PluginManager pluginManager, ConfigManager configManager, ScheduledExecutorService executorService,
|
||||
RuneLiteConfig runeLiteConfig, ChatColorConfig chatColorConfig)
|
||||
{
|
||||
super();
|
||||
this.pluginManager = pluginManager;
|
||||
this.configManager = configManager;
|
||||
this.executorService = executorService;
|
||||
this.runeLiteConfig = runeLiteConfig;
|
||||
this.chatColorConfig = chatColorConfig;
|
||||
|
||||
searchBar.setIcon(SEARCH);
|
||||
searchBar.setPreferredSize(new Dimension(100, 30));
|
||||
@@ -198,9 +202,18 @@ public class ConfigPanel extends PluginPanel
|
||||
newChildren.put(pluginName, groupPanel);
|
||||
});
|
||||
|
||||
addCoreConfig(newChildren, "RuneLite", runeLiteConfig);
|
||||
addCoreConfig(newChildren, "Chat Color", chatColorConfig);
|
||||
|
||||
children = newChildren;
|
||||
openConfigList();
|
||||
}
|
||||
|
||||
private void addCoreConfig(Map<String, JPanel> newChildren, String configName, Config config)
|
||||
{
|
||||
final JPanel groupPanel = buildGroupPanel();
|
||||
|
||||
JLabel name = new JLabel("RuneLite");
|
||||
JLabel name = new JLabel(configName);
|
||||
name.setForeground(Color.WHITE);
|
||||
|
||||
groupPanel.add(name, BorderLayout.CENTER);
|
||||
@@ -209,17 +222,14 @@ public class ConfigPanel extends PluginPanel
|
||||
buttonPanel.setLayout(new GridLayout(1, 2));
|
||||
groupPanel.add(buttonPanel, BorderLayout.LINE_END);
|
||||
|
||||
final JLabel editConfigButton = buildConfigButton(runeLiteConfig);
|
||||
final JLabel editConfigButton = buildConfigButton(config);
|
||||
buttonPanel.add(editConfigButton);
|
||||
|
||||
final JLabel toggleButton = buildToggleButton(null);
|
||||
toggleButton.setVisible(false);
|
||||
buttonPanel.add(toggleButton);
|
||||
|
||||
newChildren.put("RuneLite", groupPanel);
|
||||
|
||||
children = newChildren;
|
||||
openConfigList();
|
||||
newChildren.put(configName, groupPanel);
|
||||
}
|
||||
|
||||
private JPanel buildGroupPanel()
|
||||
@@ -494,16 +504,19 @@ public class ConfigPanel extends PluginPanel
|
||||
|
||||
if (cid.getType() == Color.class)
|
||||
{
|
||||
String existing = configManager.getConfiguration(cd.getGroup().keyName(), cid.getItem().keyName());
|
||||
Color existingColor = existing == null ? Color.BLACK : Color.decode(existing);
|
||||
|
||||
JButton colorPicker = new JButton("Pick a color");
|
||||
colorPicker.setFocusable(false);
|
||||
colorPicker.setBackground(Color.decode(configManager.getConfiguration(cd.getGroup().keyName(), cid.getItem().keyName())));
|
||||
colorPicker.setBackground(existingColor);
|
||||
colorPicker.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e)
|
||||
{
|
||||
final JFrame parent = new JFrame();
|
||||
JColorChooser jColorChooser = new JColorChooser(Color.decode(configManager.getConfiguration(cd.getGroup().keyName(), cid.getItem().keyName())));
|
||||
JColorChooser jColorChooser = new JColorChooser(existingColor);
|
||||
jColorChooser.getSelectionModel().addChangeListener(e1 -> colorPicker.setBackground(jColorChooser.getColor()));
|
||||
parent.addWindowListener(new WindowAdapter()
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.SwingUtilities;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.events.PluginChanged;
|
||||
@@ -61,13 +62,16 @@ public class ConfigPlugin extends Plugin
|
||||
@Inject
|
||||
private RuneLiteConfig runeLiteConfig;
|
||||
|
||||
@Inject
|
||||
private ChatColorConfig chatColorConfig;
|
||||
|
||||
private ConfigPanel configPanel;
|
||||
private NavigationButton navButton;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig);
|
||||
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig, chatColorConfig);
|
||||
|
||||
BufferedImage icon;
|
||||
synchronized (ImageIO.class)
|
||||
|
||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.dailytaskindicators;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
@@ -37,7 +36,6 @@ import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.vars.AccountType;
|
||||
import net.runelite.client.chat.ChatColor;
|
||||
import net.runelite.client.chat.ChatColorType;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
@@ -74,7 +72,6 @@ public class DailyTasksPlugin extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
hasSentHerbMsg = hasSentStavesMsg = hasSentEssenceMsg = false;
|
||||
cacheColors();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,11 +161,6 @@ public class DailyTasksPlugin extends Plugin
|
||||
return value == 0; // 1 = can't claim
|
||||
}
|
||||
|
||||
private void cacheColors()
|
||||
{
|
||||
chatMessageManager.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, Color.RED, false), ChatMessageType.GAME).refreshAll();
|
||||
}
|
||||
|
||||
private void sendChatMessage(String chatMessage)
|
||||
{
|
||||
final String message = new ChatMessageBuilder()
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.plugins.examine;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup(
|
||||
keyName = "examine",
|
||||
name = "Examine",
|
||||
description = "Configuration for examine plugin"
|
||||
)
|
||||
public interface ExamineConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "hexColorExamine",
|
||||
name = "Examine messages",
|
||||
description = "Color of examine messages"
|
||||
)
|
||||
default Color getExamineRecolor()
|
||||
{
|
||||
return Color.decode("#000000");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "hexColorExamineH",
|
||||
name = "Examine messages highlight",
|
||||
description = "Color of examine messages highlight"
|
||||
)
|
||||
default Color getExamineHRecolor()
|
||||
{
|
||||
return Color.decode("#0000FF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "transparentHexColorExamine",
|
||||
name = "Transparent examine messages",
|
||||
description = "Color of examine messages"
|
||||
)
|
||||
default Color getTransparentExamineRecolor()
|
||||
{
|
||||
return Color.decode("#FFFFFF");
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "transparentHexColorExamineH",
|
||||
name = "Transparent examine messages highlight",
|
||||
description = "Color of examine messages highlight"
|
||||
)
|
||||
default Color getTransparentExamineHRecolor()
|
||||
{
|
||||
return Color.decode("#9090FF");
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.examine;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayDeque;
|
||||
@@ -37,10 +36,8 @@ import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -48,12 +45,10 @@ import net.runelite.api.widgets.WidgetInfo;
|
||||
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
|
||||
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
||||
import net.runelite.api.widgets.WidgetItem;
|
||||
import net.runelite.client.chat.ChatColor;
|
||||
import net.runelite.client.chat.ChatColorType;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.chat.QueuedMessage;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -83,9 +78,6 @@ public class ExaminePlugin extends Plugin
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ExamineConfig config;
|
||||
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
@@ -95,51 +87,11 @@ public class ExaminePlugin extends Plugin
|
||||
@Inject
|
||||
private ScheduledExecutorService executor;
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
cacheConfiguredColors();
|
||||
chatMessageManager.refreshAll();
|
||||
}
|
||||
|
||||
@Provides
|
||||
ExamineConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(ExamineConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("examine"))
|
||||
{
|
||||
cacheConfiguredColors();
|
||||
chatMessageManager.refreshAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void cacheConfiguredColors()
|
||||
{
|
||||
chatMessageManager
|
||||
.cacheColor(new ChatColor(ChatColorType.NORMAL, config.getExamineRecolor(), false),
|
||||
ChatMessageType.EXAMINE_ITEM, ChatMessageType.EXAMINE_NPC, ChatMessageType.EXAMINE_OBJECT)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, config.getExamineHRecolor(), false),
|
||||
ChatMessageType.EXAMINE_ITEM, ChatMessageType.EXAMINE_NPC, ChatMessageType.EXAMINE_OBJECT)
|
||||
.cacheColor(new ChatColor(ChatColorType.NORMAL, config.getTransparentExamineRecolor(), true),
|
||||
ChatMessageType.EXAMINE_ITEM, ChatMessageType.EXAMINE_NPC, ChatMessageType.EXAMINE_OBJECT)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, config.getTransparentExamineHRecolor(), true),
|
||||
ChatMessageType.EXAMINE_ITEM, ChatMessageType.EXAMINE_NPC, ChatMessageType.EXAMINE_OBJECT);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChange(GameStateChanged event)
|
||||
{
|
||||
pending.clear();
|
||||
|
||||
if (event.getGameState().equals(GameState.LOGIN_SCREEN))
|
||||
{
|
||||
cacheConfiguredColors();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.raids;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -46,18 +45,17 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InstanceTemplates;
|
||||
import net.runelite.api.ObjectID;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.Varbits;
|
||||
import static net.runelite.api.Perspective.SCENE_SIZE;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetHiddenChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.chat.ChatColor;
|
||||
import net.runelite.client.chat.ChatColorType;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
@@ -156,11 +154,6 @@ public class RaidsPlugin extends Plugin
|
||||
updateInfoBoxState();
|
||||
}
|
||||
|
||||
if (config.pointsMessage())
|
||||
{
|
||||
cacheColors();
|
||||
}
|
||||
|
||||
updateLists();
|
||||
}
|
||||
|
||||
@@ -176,11 +169,6 @@ public class RaidsPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (config.pointsMessage())
|
||||
{
|
||||
cacheColors();
|
||||
}
|
||||
|
||||
if (event.getKey().equals("raidsTimer"))
|
||||
{
|
||||
updateInfoBoxState();
|
||||
@@ -379,15 +367,6 @@ public class RaidsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void cacheColors()
|
||||
{
|
||||
chatMessageManager.cacheColor(new ChatColor(ChatColorType.NORMAL, Color.BLACK, false), ChatMessageType.CLANCHAT_INFO)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, Color.RED, false), ChatMessageType.CLANCHAT_INFO)
|
||||
.cacheColor(new ChatColor(ChatColorType.NORMAL, Color.WHITE, true), ChatMessageType.CLANCHAT_INFO)
|
||||
.cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, Color.RED, true), ChatMessageType.CLANCHAT_INFO)
|
||||
.refreshAll();
|
||||
}
|
||||
|
||||
public int getRotationMatches()
|
||||
{
|
||||
String rotation = raid.getRotationString().toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user