info: Merge nested if statements

This commit is contained in:
sdburns1998
2019-07-07 14:41:11 +02:00
parent fb90fec070
commit 2f32c50353
2 changed files with 9 additions and 15 deletions

View File

@@ -147,12 +147,9 @@ public class InfoPanel extends PluginPanel
emailLabel.enableAutoLinkHandler(false);
emailLabel.addHyperlinkListener(e ->
{
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType()) && e.getURL() != null)
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType()) && e.getURL() != null && e.getURL().toString().equals(RUNELITE_LOGIN))
{
if (e.getURL().toString().equals(RUNELITE_LOGIN))
{
executor.execute(sessionManager::login);
}
executor.execute(sessionManager::login);
}
});

View File

@@ -68,18 +68,15 @@ public class JRichTextPane extends JEditorPane
{
linkHandler = e ->
{
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType()) && e.getURL() != null)
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType()) && e.getURL() != null && Desktop.isDesktopSupported())
{
if (Desktop.isDesktopSupported())
try
{
try
{
Desktop.getDesktop().browse(e.getURL().toURI());
}
catch (URISyntaxException | IOException ex)
{
log.warn("Error opening link", ex);
}
Desktop.getDesktop().browse(e.getURL().toURI());
}
catch (URISyntaxException | IOException ex)
{
log.warn("Error opening link", ex);
}
}
};