Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed BetterProfiles #73

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BetterProfilePanel extends JPanel {
private static final ImageIcon DELETE_HOVER_ICON;

static {
final BufferedImage deleteImg = ImageUtil.getResourceStreamFromClass(BetterProfilesPlugin.class, "delete_icon.png");
final BufferedImage deleteImg = ImageUtil.getResourceStreamFromClass(BetterProfilesPlugin.class, "/net/runelite/client/plugins/betterprofiles/delete_icon.png");
DELETE_ICON = new ImageIcon(deleteImg);
DELETE_HOVER_ICON = new ImageIcon(ImageUtil.alphaOffset(deleteImg, -100));
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,7 @@
package net.runelite.client.plugins.betterprofiles;

import com.google.inject.Provides;

import java.awt.image.BufferedImage;
import java.util.concurrent.ScheduledExecutorService;
import java.security.GeneralSecurityException;
import javax.inject.Inject;
import javax.swing.*;

import lombok.extern.slf4j.Slf4j;
import net.runelite.api.GameState;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
Expand All @@ -45,9 +37,12 @@
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.util.ImageUtil;

import javax.inject.Inject;
import java.awt.image.BufferedImage;
import java.util.concurrent.ScheduledExecutorService;

@PluginDescriptor(
name = "<html><font color=\"#FF9DF9\">[PP]</font> Better Profiles</html>",
enabledByDefault = false,
description = "Allow for a allows you to easily switch between multiple OSRS Accounts - Ported by Piggy",
tags = {"profile", "account", "login", "log in", "pklite"}
)
Expand All @@ -67,6 +62,7 @@ public class BetterProfilesPlugin extends Plugin {

private BetterProfilesPanel panel;
private NavigationButton navButton;
private BufferedImage icon;

@Provides
BetterProfilesConfig getConfig(ConfigManager configManager) {
Expand All @@ -78,16 +74,22 @@ protected void startUp() {
panel = injector.getInstance(BetterProfilesPanel.class);
panel.init();

final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "profiles_icon.png");

navButton = NavigationButton.builder()
.tooltip("Profiles")
.icon(icon)
.priority(8)
.panel(panel)
.build();
if (icon == null) {
icon = ImageUtil.loadImageResource(getClass(), "profiles_icon.png");
}

clientToolbar.addNavigation(navButton);
if (icon != null) {
navButton = NavigationButton.builder()
.tooltip("Profiles")
.icon(icon)
.priority(8)
.panel(panel)
.build();

clientToolbar.addNavigation(navButton);
} else {
log.error("Failed to load profiles_icon.png");
}
}

@Override
Expand All @@ -110,11 +112,7 @@ private void onConfigChanged(ConfigChanged event) {
}
if (!event.getKey().equals("rememberPassword")) {
panel = injector.getInstance(BetterProfilesPanel.class);
try {
panel.redrawProfiles();
} catch (GeneralSecurityException gse) {
log.error("Error redrawing profiles panel", gse);
}
panel.redrawProfiles();
}
}
}
Expand All @@ -123,4 +121,4 @@ private void openPanel() {

}

}
}
Loading