Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -435,11 +435,15 @@ public class ChatMessageManager
|
|||||||
{
|
{
|
||||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueServerMessage(), false),
|
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueServerMessage(), false),
|
||||||
ChatMessageType.GAMEMESSAGE);
|
ChatMessageType.GAMEMESSAGE);
|
||||||
|
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueServerMessage(), false),
|
||||||
|
ChatMessageType.ENGINE);
|
||||||
}
|
}
|
||||||
if (chatColorConfig.opaqueServerMessageHighlight() != null)
|
if (chatColorConfig.opaqueServerMessageHighlight() != null)
|
||||||
{
|
{
|
||||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueServerMessageHighlight(), false),
|
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueServerMessageHighlight(), false),
|
||||||
ChatMessageType.GAMEMESSAGE);
|
ChatMessageType.GAMEMESSAGE);
|
||||||
|
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueServerMessageHighlight(), false),
|
||||||
|
ChatMessageType.ENGINE);
|
||||||
}
|
}
|
||||||
if (chatColorConfig.opaqueGameMessage() != null)
|
if (chatColorConfig.opaqueGameMessage() != null)
|
||||||
{
|
{
|
||||||
@@ -613,11 +617,15 @@ public class ChatMessageManager
|
|||||||
{
|
{
|
||||||
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentServerMessage(), true),
|
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentServerMessage(), true),
|
||||||
ChatMessageType.GAMEMESSAGE);
|
ChatMessageType.GAMEMESSAGE);
|
||||||
|
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentServerMessage(), true),
|
||||||
|
ChatMessageType.ENGINE);
|
||||||
}
|
}
|
||||||
if (chatColorConfig.transparentServerMessageHighlight() != null)
|
if (chatColorConfig.transparentServerMessageHighlight() != null)
|
||||||
{
|
{
|
||||||
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentServerMessageHighlight(), true),
|
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentServerMessageHighlight(), true),
|
||||||
ChatMessageType.GAMEMESSAGE);
|
ChatMessageType.GAMEMESSAGE);
|
||||||
|
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentServerMessageHighlight(), true),
|
||||||
|
ChatMessageType.ENGINE);
|
||||||
}
|
}
|
||||||
if (chatColorConfig.transparentGameMessage() != null)
|
if (chatColorConfig.transparentGameMessage() != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,12 +53,8 @@ import net.runelite.api.GameState;
|
|||||||
import net.runelite.api.ItemComposition;
|
import net.runelite.api.ItemComposition;
|
||||||
import static net.runelite.api.ItemID.*;
|
import static net.runelite.api.ItemID.*;
|
||||||
import net.runelite.api.SpritePixels;
|
import net.runelite.api.SpritePixels;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
|
||||||
import net.runelite.api.events.PostItemComposition;
|
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.config.RuneLiteConfig;
|
import net.runelite.client.config.RuneLiteConfig;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
|
||||||
import net.runelite.client.util.AsyncBufferedImage;
|
import net.runelite.client.util.AsyncBufferedImage;
|
||||||
import net.runelite.http.api.item.ItemClient;
|
import net.runelite.http.api.item.ItemClient;
|
||||||
import net.runelite.http.api.item.ItemPrice;
|
import net.runelite.http.api.item.ItemPrice;
|
||||||
@@ -93,7 +89,6 @@ public class ItemManager
|
|||||||
private Map<Integer, ItemPrice> itemPrices = Collections.emptyMap();
|
private Map<Integer, ItemPrice> itemPrices = Collections.emptyMap();
|
||||||
private Map<Integer, ItemStats> itemStats = Collections.emptyMap();
|
private Map<Integer, ItemStats> itemStats = Collections.emptyMap();
|
||||||
private final LoadingCache<ImageKey, AsyncBufferedImage> itemImages;
|
private final LoadingCache<ImageKey, AsyncBufferedImage> itemImages;
|
||||||
private final LoadingCache<Integer, ItemComposition> itemCompositions;
|
|
||||||
private final LoadingCache<OutlineKey, BufferedImage> itemOutlines;
|
private final LoadingCache<OutlineKey, BufferedImage> itemOutlines;
|
||||||
|
|
||||||
// Worn items with weight reducing property have a different worn and inventory ItemID
|
// Worn items with weight reducing property have a different worn and inventory ItemID
|
||||||
@@ -173,7 +168,7 @@ public class ItemManager
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ItemManager(Client client, ScheduledExecutorService scheduledExecutorService, ClientThread clientThread,
|
public ItemManager(Client client, ScheduledExecutorService scheduledExecutorService, ClientThread clientThread,
|
||||||
OkHttpClient okHttpClient, EventBus eventBus, RuneLiteConfig runeLiteConfig)
|
OkHttpClient okHttpClient, RuneLiteConfig runeLiteConfig)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.clientThread = clientThread;
|
this.clientThread = clientThread;
|
||||||
@@ -195,18 +190,6 @@ public class ItemManager
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
itemCompositions = CacheBuilder.newBuilder()
|
|
||||||
.maximumSize(1024L)
|
|
||||||
.expireAfterAccess(1, TimeUnit.HOURS)
|
|
||||||
.build(new CacheLoader<Integer, ItemComposition>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public ItemComposition load(Integer key) throws Exception
|
|
||||||
{
|
|
||||||
return client.getItemComposition(key);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
itemOutlines = CacheBuilder.newBuilder()
|
itemOutlines = CacheBuilder.newBuilder()
|
||||||
.maximumSize(128L)
|
.maximumSize(128L)
|
||||||
.expireAfterAccess(1, TimeUnit.HOURS)
|
.expireAfterAccess(1, TimeUnit.HOURS)
|
||||||
@@ -218,8 +201,6 @@ public class ItemManager
|
|||||||
return loadItemOutline(key.itemId, key.itemQuantity, key.outlineColor);
|
return loadItemOutline(key.itemId, key.itemQuantity, key.outlineColor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.register(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadPrices()
|
private void loadPrices()
|
||||||
@@ -263,31 +244,6 @@ public class ItemManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onGameStateChanged(final GameStateChanged event)
|
|
||||||
{
|
|
||||||
if (event.getGameState() == GameState.HOPPING || event.getGameState() == GameState.LOGIN_SCREEN)
|
|
||||||
{
|
|
||||||
itemCompositions.invalidateAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onPostItemComposition(PostItemComposition event)
|
|
||||||
{
|
|
||||||
itemCompositions.put(event.getItemComposition().getId(), event.getItemComposition());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invalidates internal item manager item composition cache (but not client item composition cache)
|
|
||||||
* @see Client#getItemCompositionCache()
|
|
||||||
*/
|
|
||||||
public void invalidateItemCompositionCache()
|
|
||||||
{
|
|
||||||
itemCompositions.invalidateAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look up an item's price
|
* Look up an item's price
|
||||||
*
|
*
|
||||||
@@ -432,8 +388,7 @@ public class ItemManager
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemComposition getItemComposition(int itemId)
|
public ItemComposition getItemComposition(int itemId)
|
||||||
{
|
{
|
||||||
assert client.isClientThread() : "getItemComposition must be called on client thread";
|
return client.getItemDefinition(itemId);
|
||||||
return itemCompositions.getUnchecked(itemId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -468,7 +468,6 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
|
|
||||||
private void resetItemCompositionCache()
|
private void resetItemCompositionCache()
|
||||||
{
|
{
|
||||||
itemManager.invalidateItemCompositionCache();
|
|
||||||
client.getItemCompositionCache().reset();
|
client.getItemCompositionCache().reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user