Synchronize usages of ImageIO.read(...)
ImageIO.read(...) is not really thread-safe, as calling it on several threads at the same time can cause NullPointerExceptions and ConcurrentModificationExceptions, as reported in https://bugs.openjdk.java.net/browse/JDK-8058973 and https://bugs.openjdk.java.net/browse/JDK-6986863. This commit changes all usages of this method to synchronize on ImageIO.class, so the method is never run asynchronously.
This commit is contained in:
@@ -95,8 +95,10 @@ public class ItemClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = response.body().byteStream();
|
InputStream in = response.body().byteStream();
|
||||||
BufferedImage imageIcon = ImageIO.read(in);
|
synchronized (ImageIO.class)
|
||||||
return imageIcon;
|
{
|
||||||
|
return ImageIO.read(in);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,10 @@ public class SkillIconManager
|
|||||||
{
|
{
|
||||||
String skillIconPath = "/skill_icons/" + skill.getName().toLowerCase() + ".png";
|
String skillIconPath = "/skill_icons/" + skill.getName().toLowerCase() + ".png";
|
||||||
log.debug("Loading skill icon from {}", skillIconPath);
|
log.debug("Loading skill icon from {}", skillIconPath);
|
||||||
skillImage = ImageIO.read(SkillIconManager.class.getResourceAsStream(skillIconPath));
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
skillImage = ImageIO.read(SkillIconManager.class.getResourceAsStream(skillIconPath));
|
||||||
|
}
|
||||||
imgCache[skillIdx] = skillImage;
|
imgCache[skillIdx] = skillImage;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
|
|||||||
@@ -68,8 +68,11 @@ public class AccountPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LOGIN_IMAGE = ImageIO.read(AccountPlugin.class.getResourceAsStream("login_icon.png"));
|
synchronized (ImageIO.class)
|
||||||
LOGOUT_IMAGE = ImageIO.read(AccountPlugin.class.getResourceAsStream("logout_icon.png"));
|
{
|
||||||
|
LOGIN_IMAGE = ImageIO.read(AccountPlugin.class.getResourceAsStream("login_icon.png"));
|
||||||
|
LOGOUT_IMAGE = ImageIO.read(AccountPlugin.class.getResourceAsStream("logout_icon.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,7 +80,11 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
font = FontManager.getRunescapeFont()
|
font = FontManager.getRunescapeFont()
|
||||||
.deriveFont(Font.BOLD, 24);
|
.deriveFont(Font.BOLD, 24);
|
||||||
clockImage = ImageIO.read(getClass().getResourceAsStream("clock.png"));
|
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
clockImage = ImageIO.read(getClass().getResourceAsStream("clock.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|||||||
@@ -92,9 +92,12 @@ public class ConfigPanel extends PluginPanel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CONFIG_ICON = ImageIO.read(ConfigPanel.class.getResourceAsStream("config_icon.png"));
|
synchronized (ImageIO.class)
|
||||||
UNCHECK_ICON = ImageIO.read(ConfigPanel.class.getResourceAsStream("disabled.png"));
|
{
|
||||||
CHECK_ICON = ImageIO.read(ConfigPanel.class.getResourceAsStream("enabled.png"));
|
CONFIG_ICON = ImageIO.read(ConfigPanel.class.getResourceAsStream("config_icon.png"));
|
||||||
|
UNCHECK_ICON = ImageIO.read(ConfigPanel.class.getResourceAsStream("disabled.png"));
|
||||||
|
CHECK_ICON = ImageIO.read(ConfigPanel.class.getResourceAsStream("enabled.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
package net.runelite.client.plugins.config;
|
package net.runelite.client.plugins.config;
|
||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -68,9 +69,15 @@ public class ConfigPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig);
|
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig);
|
||||||
|
|
||||||
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(getClass().getResourceAsStream("config_icon.png"));
|
||||||
|
}
|
||||||
|
|
||||||
navButton = new NavigationButton(
|
navButton = new NavigationButton(
|
||||||
"Configuration",
|
"Configuration",
|
||||||
ImageIO.read(getClass().getResourceAsStream("config_icon.png")),
|
icon,
|
||||||
() -> configPanel);
|
() -> configPanel);
|
||||||
|
|
||||||
ui.getPluginToolbar().addNavigation(navButton);
|
ui.getPluginToolbar().addNavigation(navButton);
|
||||||
|
|||||||
@@ -200,10 +200,13 @@ public class DevToolsPanel extends PluginPanel
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bBox2DIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("2D_bounding_box.png")));
|
synchronized (ImageIO.class)
|
||||||
bBox3DIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("3D_bounding_box.png")));
|
{
|
||||||
clickBoxIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("2D_clickbox_geometry.png")));
|
bBox2DIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("2D_bounding_box.png")));
|
||||||
bBox3DMousoverIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("mouseover_3D_bounding_box.png")));
|
bBox3DIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("3D_bounding_box.png")));
|
||||||
|
clickBoxIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("2D_clickbox_geometry.png")));
|
||||||
|
bBox3DMousoverIcon = new ImageIcon(ImageIO.read(DevToolsPlugin.class.getResourceAsStream("mouseover_3D_bounding_box.png")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
package net.runelite.client.plugins.devtools;
|
package net.runelite.client.plugins.devtools;
|
||||||
|
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
@@ -67,9 +68,16 @@ public class DevToolsPlugin extends Plugin
|
|||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
final DevToolsPanel panel = injector.getInstance(DevToolsPanel.class);
|
final DevToolsPanel panel = injector.getInstance(DevToolsPanel.class);
|
||||||
|
|
||||||
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(getClass().getResourceAsStream("devtools_icon.png"));
|
||||||
|
}
|
||||||
|
|
||||||
navButton = new NavigationButton(
|
navButton = new NavigationButton(
|
||||||
"Developer Tools",
|
"Developer Tools",
|
||||||
ImageIO.read(getClass().getResourceAsStream("devtools_icon.png")),
|
icon,
|
||||||
() -> panel);
|
() -> panel);
|
||||||
|
|
||||||
ui.getPluginToolbar().addNavigation(navButton);
|
ui.getPluginToolbar().addNavigation(navButton);
|
||||||
|
|||||||
@@ -95,7 +95,10 @@ class FeedPanel extends PluginPanel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RUNELITE_ICON = ImageIO.read(FeedPanel.class.getResourceAsStream("runelite.png"));
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
RUNELITE_ICON = ImageIO.read(FeedPanel.class.getResourceAsStream("runelite.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
@@ -104,7 +107,10 @@ class FeedPanel extends PluginPanel
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OSRS_ICON = ImageIO.read(FeedPanel.class.getResourceAsStream("osrs.png"));
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
OSRS_ICON = ImageIO.read(FeedPanel.class.getResourceAsStream("osrs.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
@@ -184,7 +190,12 @@ class FeedPanel extends PluginPanel
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
avatar.setIcon(new ImageIcon(ImageIO.read(responseBody.byteStream())));
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(responseBody.byteStream());
|
||||||
|
}
|
||||||
|
avatar.setIcon(new ImageIcon(icon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.feed;
|
|||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
@@ -87,9 +88,15 @@ public class FeedPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
feedPanel = new FeedPanel(config, feedSupplier, linkBrowser);
|
feedPanel = new FeedPanel(config, feedSupplier, linkBrowser);
|
||||||
|
|
||||||
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(getClass().getResourceAsStream("icon.png"));
|
||||||
|
}
|
||||||
|
|
||||||
navButton = new NavigationButton(
|
navButton = new NavigationButton(
|
||||||
"News Feed",
|
"News Feed",
|
||||||
ImageIO.read(getClass().getResourceAsStream("icon.png")),
|
icon,
|
||||||
() -> feedPanel);
|
() -> feedPanel);
|
||||||
|
|
||||||
ui.getPluginToolbar().addNavigation(navButton);
|
ui.getPluginToolbar().addNavigation(navButton);
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FightCaveOverlay extends Overlay
|
public class FightCaveOverlay extends Overlay
|
||||||
@@ -110,8 +109,10 @@ public class FightCaveOverlay extends Overlay
|
|||||||
BufferedImage image = null;
|
BufferedImage image = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
InputStream in = FightCaveOverlay.class.getResourceAsStream(path);
|
synchronized (ImageIO.class)
|
||||||
image = ImageIO.read(in);
|
{
|
||||||
|
image = ImageIO.read(FightCaveOverlay.class.getResourceAsStream(path));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -84,7 +84,11 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
protected void startUp() throws IOException
|
protected void startUp() throws IOException
|
||||||
{
|
{
|
||||||
panel = injector.getInstance(GrandExchangePanel.class);
|
panel = injector.getInstance(GrandExchangePanel.class);
|
||||||
BufferedImage icon = ImageIO.read(getClass().getResourceAsStream("ge_icon.png"));
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(getClass().getResourceAsStream("ge_icon.png"));
|
||||||
|
}
|
||||||
button = new NavigationButton("GE Offers", icon, () -> panel);
|
button = new NavigationButton("GE Offers", icon, () -> panel);
|
||||||
ui.getPluginToolbar().addNavigation(button);
|
ui.getPluginToolbar().addNavigation(button);
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,12 @@ class GrandExchangeSearchPanel extends JPanel
|
|||||||
// Search Box
|
// Search Box
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
search = new ImageIcon(ImageIO.read(GrandExchangePlugin.class.getResourceAsStream("search.png")));
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(GrandExchangePlugin.class.getResourceAsStream("search.png"));
|
||||||
|
}
|
||||||
|
search = new ImageIcon(icon);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import java.awt.GridBagLayout;
|
|||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -118,10 +119,15 @@ public class HiscorePanel extends PluginPanel
|
|||||||
inputPanel.setLayout(new BorderLayout(7, 7));
|
inputPanel.setLayout(new BorderLayout(7, 7));
|
||||||
inputPanel.setBorder(subPanelBorder);
|
inputPanel.setBorder(subPanelBorder);
|
||||||
|
|
||||||
Icon search = null;
|
Icon search;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
search = new ImageIcon(ImageIO.read(HiscorePanel.class.getResourceAsStream("search.png")));
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(HiscorePanel.class.getResourceAsStream("search.png"));
|
||||||
|
}
|
||||||
|
search = new ImageIcon(icon);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
@@ -217,13 +223,18 @@ public class HiscorePanel extends PluginPanel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Icon icon = new ImageIcon(ImageIO.read(HiscorePanel.class.getResourceAsStream(
|
BufferedImage iconImage;
|
||||||
endpoint.name().toLowerCase() + ".png")));
|
BufferedImage selectedImage;
|
||||||
Icon selected = new ImageIcon(ImageIO.read(HiscorePanel.class.getResourceAsStream(
|
synchronized (ImageIO.class)
|
||||||
endpoint.name().toLowerCase() + "_selected.png")));
|
{
|
||||||
|
iconImage = ImageIO.read(HiscorePanel.class.getResourceAsStream(
|
||||||
|
endpoint.name().toLowerCase() + ".png"));
|
||||||
|
selectedImage = ImageIO.read(HiscorePanel.class.getResourceAsStream(
|
||||||
|
endpoint.name().toLowerCase() + "_selected.png"));
|
||||||
|
}
|
||||||
JToggleButton button = new JToggleButton();
|
JToggleButton button = new JToggleButton();
|
||||||
button.setIcon(icon);
|
button.setIcon(new ImageIcon(iconImage));
|
||||||
button.setSelectedIcon(selected);
|
button.setSelectedIcon(new ImageIcon(selectedImage));
|
||||||
button.setPreferredSize(new Dimension(24, 24));
|
button.setPreferredSize(new Dimension(24, 24));
|
||||||
button.setBackground(Color.WHITE);
|
button.setBackground(Color.WHITE);
|
||||||
button.setFocusPainted(false);
|
button.setFocusPainted(false);
|
||||||
@@ -344,7 +355,12 @@ public class HiscorePanel extends PluginPanel
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
label.setIcon(new ImageIcon(ImageIO.read(HiscorePanel.class.getResourceAsStream(skillIcon))));
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(HiscorePanel.class.getResourceAsStream(skillIcon));
|
||||||
|
}
|
||||||
|
label.setIcon(new ImageIcon(icon));
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.hiscore;
|
|||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -73,9 +74,16 @@ public class HiscorePlugin extends Plugin
|
|||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
hiscorePanel = injector.getInstance(HiscorePanel.class);
|
hiscorePanel = injector.getInstance(HiscorePanel.class);
|
||||||
|
|
||||||
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(getClass().getResourceAsStream("hiscore.gif"));
|
||||||
|
}
|
||||||
|
|
||||||
navButton = new NavigationButton(
|
navButton = new NavigationButton(
|
||||||
"Hiscore",
|
"Hiscore",
|
||||||
ImageIO.read(getClass().getResourceAsStream("hiscore.gif")),
|
icon,
|
||||||
() -> hiscorePanel);
|
() -> hiscorePanel);
|
||||||
|
|
||||||
ui.getPluginToolbar().addNavigation(navButton);
|
ui.getPluginToolbar().addNavigation(navButton);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.info;
|
package net.runelite.client.plugins.info;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
@@ -48,9 +49,15 @@ public class InfoPlugin extends Plugin
|
|||||||
final InfoPanel panel = injector.getInstance(InfoPanel.class);
|
final InfoPanel panel = injector.getInstance(InfoPanel.class);
|
||||||
panel.init();
|
panel.init();
|
||||||
|
|
||||||
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(getClass().getResourceAsStream("info_icon.png"));
|
||||||
|
}
|
||||||
|
|
||||||
navButton = new NavigationButton(
|
navButton = new NavigationButton(
|
||||||
"Info",
|
"Info",
|
||||||
ImageIO.read(getClass().getResourceAsStream("info_icon.png")),
|
icon,
|
||||||
() -> panel
|
() -> panel
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,10 @@ public enum Book
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return ImageIO.read(Book.class.getResourceAsStream("items/" + name + ".png"));
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
return ImageIO.read(Book.class.getResourceAsStream("items/" + name + ".png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException | IllegalArgumentException e)
|
catch (IOException | IllegalArgumentException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
package net.runelite.client.plugins.kourendlibrary;
|
package net.runelite.client.plugins.kourendlibrary;
|
||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -81,9 +82,15 @@ public class KourendLibraryPlugin extends Plugin
|
|||||||
panel = injector.getInstance(KourendLibraryPanel.class);
|
panel = injector.getInstance(KourendLibraryPanel.class);
|
||||||
panel.init();
|
panel.init();
|
||||||
|
|
||||||
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(Book.class.getResourceAsStream("panel_icon.png"));
|
||||||
|
}
|
||||||
|
|
||||||
navButton = new NavigationButton(
|
navButton = new NavigationButton(
|
||||||
"Kourend Library",
|
"Kourend Library",
|
||||||
ImageIO.read(Book.class.getResourceAsStream("panel_icon.png")),
|
icon,
|
||||||
() -> panel
|
() -> panel
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.notes;
|
package net.runelite.client.plugins.notes;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -65,9 +66,15 @@ public class NotesPlugin extends Plugin
|
|||||||
panel = injector.getInstance(NotesPanel.class);
|
panel = injector.getInstance(NotesPanel.class);
|
||||||
panel.init(config);
|
panel.init(config);
|
||||||
|
|
||||||
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(getClass().getResourceAsStream("notes_icon.png"));
|
||||||
|
}
|
||||||
|
|
||||||
navButton = new NavigationButton(
|
navButton = new NavigationButton(
|
||||||
"Notes",
|
"Notes",
|
||||||
ImageIO.read(getClass().getResourceAsStream("notes_icon.png")),
|
icon,
|
||||||
() -> panel
|
() -> panel
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ package net.runelite.client.plugins.poh;
|
|||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -101,10 +100,12 @@ public enum PohIcons
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = PohIcons.class.getResourceAsStream(getImageResource() + ".png");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
image = ImageIO.read(in);
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
image = ImageIO.read(PohIcons.class.getResourceAsStream(getImageResource() + ".png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import java.awt.geom.AffineTransform;
|
|||||||
import java.awt.image.AffineTransformOp;
|
import java.awt.image.AffineTransformOp;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
@@ -432,8 +431,10 @@ public class PuzzleSolverOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
InputStream in = PuzzleSolverOverlay.class.getResourceAsStream("arrow.png");
|
synchronized (ImageIO.class)
|
||||||
downArrow = ImageIO.read(in);
|
{
|
||||||
|
downArrow = ImageIO.read(PuzzleSolverOverlay.class.getResourceAsStream("arrow.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import com.google.inject.Provides;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -601,12 +600,12 @@ public class RaidsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
return raidsIcon;
|
return raidsIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = RaidsPlugin.class.getResourceAsStream("raids_icon.png");
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
raidsIcon = ImageIO.read(in);
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
raidsIcon = ImageIO.read(RaidsPlugin.class.getResourceAsStream("raids_icon.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -151,8 +151,13 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BufferedImage iconImage = ImageIO.read(ScreenshotPlugin.class.getResourceAsStream("screenshot.png"));
|
BufferedImage iconImage;
|
||||||
BufferedImage invertedIconImage = ImageIO.read(ScreenshotPlugin.class.getResourceAsStream("screenshot_inverted.png"));
|
BufferedImage invertedIconImage;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
iconImage = ImageIO.read(ScreenshotPlugin.class.getResourceAsStream("screenshot.png"));
|
||||||
|
invertedIconImage = ImageIO.read(ScreenshotPlugin.class.getResourceAsStream("screenshot_inverted.png"));
|
||||||
|
}
|
||||||
|
|
||||||
SwingUtilities.invokeLater(() ->
|
SwingUtilities.invokeLater(() ->
|
||||||
{
|
{
|
||||||
@@ -391,7 +396,11 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
try (InputStream reportButton = ScreenshotPlugin.class.getResourceAsStream("report_button.png"))
|
try (InputStream reportButton = ScreenshotPlugin.class.getResourceAsStream("report_button.png"))
|
||||||
{
|
{
|
||||||
BufferedImage reportButtonImage = ImageIO.read(reportButton);
|
BufferedImage reportButtonImage;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
reportButtonImage = ImageIO.read(reportButton);
|
||||||
|
}
|
||||||
|
|
||||||
int x = gameOffsetX + 403;
|
int x = gameOffsetX + 403;
|
||||||
int y = gameOffsetY + image.getHeight() - reportButtonImage.getHeight() - 1;
|
int y = gameOffsetY + image.getHeight() - reportButtonImage.getHeight() - 1;
|
||||||
|
|||||||
@@ -76,7 +76,11 @@ public class SpecOrbOverlay extends Overlay
|
|||||||
this.client = client;
|
this.client = client;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BufferedImage icon = ImageIO.read(getClass().getResourceAsStream("special_orb_icon.png"));
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(getClass().getResourceAsStream("special_orb_icon.png"));
|
||||||
|
}
|
||||||
orb = new MinimapOrb(SPECIAL_ORB_BACKGROUND_COLOR, SPECIAL_ORB_BACKGROUND_COLOR, icon);
|
orb = new MinimapOrb(SPECIAL_ORB_BACKGROUND_COLOR, SPECIAL_ORB_BACKGROUND_COLOR, icon);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.timers;
|
|||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -99,10 +98,12 @@ public enum GameTimer
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream in = GameTimer.class.getResourceAsStream(imageResource + ".png");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
image = ImageIO.read(in);
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
image = ImageIO.read(GameTimer.class.getResourceAsStream(imageResource + ".png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.xptracker;
|
|||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.google.inject.Binder;
|
import com.google.inject.Binder;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -103,10 +104,16 @@ public class XpTrackerPlugin extends Plugin
|
|||||||
log.warn("Error looking up worlds list", e);
|
log.warn("Error looking up worlds list", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BufferedImage icon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(getClass().getResourceAsStream("xp.png"));
|
||||||
|
}
|
||||||
|
|
||||||
xpPanel = new XpPanel(this, client, skillIconManager);
|
xpPanel = new XpPanel(this, client, skillIconManager);
|
||||||
navButton = new NavigationButton(
|
navButton = new NavigationButton(
|
||||||
"XP Tracker",
|
"XP Tracker",
|
||||||
ImageIO.read(getClass().getResourceAsStream("xp.png")),
|
icon,
|
||||||
() -> xpPanel);
|
() -> xpPanel);
|
||||||
|
|
||||||
ui.getPluginToolbar().addNavigation(navButton);
|
ui.getPluginToolbar().addNavigation(navButton);
|
||||||
|
|||||||
@@ -96,7 +96,10 @@ public class ClientUI extends JFrame
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
icon = ImageIO.read(ClientUI.class.getResourceAsStream("/runelite.png"));
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
icon = ImageIO.read(ClientUI.class.getResourceAsStream("/runelite.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,8 +128,13 @@ public class TitleToolbar extends JPanel
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BufferedImage discordIcon = ImageIO.read(ClientUI.class.getResourceAsStream("discord.png"));
|
BufferedImage discordIcon;
|
||||||
BufferedImage invertedIcon = ImageIO.read(ClientUI.class.getResourceAsStream("discord_inverted.png"));
|
BufferedImage invertedIcon;
|
||||||
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
discordIcon = ImageIO.read(ClientUI.class.getResourceAsStream("discord.png"));
|
||||||
|
invertedIcon = ImageIO.read(ClientUI.class.getResourceAsStream("discord_inverted.png"));
|
||||||
|
}
|
||||||
|
|
||||||
JButton discordButton = new JButton();
|
JButton discordButton = new JButton();
|
||||||
discordButton.setToolTipText("Join Discord");
|
discordButton.setToolTipText("Join Discord");
|
||||||
|
|||||||
@@ -58,7 +58,10 @@ public class MinimapOrb implements RenderableEntity
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FRAME = ImageIO.read(MinimapOrb.class.getResourceAsStream("minimap_orb_background.png"));
|
synchronized (ImageIO.class)
|
||||||
|
{
|
||||||
|
FRAME = ImageIO.read(MinimapOrb.class.getResourceAsStream("minimap_orb_background.png"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user