From f84d5b856869a24b91671b4fbe65b75117897214 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Tue, 11 Jun 2019 22:02:08 +0100 Subject: [PATCH] yad fix --- .../plugins/inferno/InfernoJadOverlay.java | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoJadOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoJadOverlay.java index d6a07c5523..43252b4c95 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoJadOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoJadOverlay.java @@ -6,10 +6,10 @@ * 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. + * 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 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 @@ -29,6 +29,7 @@ import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import javax.inject.Inject; + import net.runelite.api.Client; import net.runelite.api.SpriteID; import net.runelite.client.game.SpriteManager; @@ -40,48 +41,47 @@ import net.runelite.client.ui.overlay.components.ImageComponent; import net.runelite.client.ui.overlay.components.PanelComponent; public class InfernoJadOverlay extends Overlay -{ - private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); + { + private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); + private final Client client; + private final InfernoPlugin plugin; + private final SpriteManager spriteManager; + private final PanelComponent imagePanelComponent = new PanelComponent(); - private final Client client; - private final InfernoPlugin plugin; - private final SpriteManager spriteManager; - private final PanelComponent imagePanelComponent = new PanelComponent(); + @Inject + private InfernoJadOverlay(Client client, InfernoPlugin plugin, SpriteManager spriteManager) + { + setPosition(OverlayPosition.BOTTOM_RIGHT); + setPriority(OverlayPriority.HIGH); + this.client = client; + this.plugin = plugin; + this.spriteManager = spriteManager; + } - @Inject - private InfernoJadOverlay(Client client, InfernoPlugin plugin, SpriteManager spriteManager) - { - setPosition(OverlayPosition.BOTTOM_RIGHT); - setPriority(OverlayPriority.HIGH); - this.client = client; - this.plugin = plugin; - this.spriteManager = spriteManager; - } + @Override + public Dimension render(Graphics2D graphics) + { + final InfernoJadAttack attack = plugin.getAttack(); - @Override - public Dimension render(Graphics2D graphics) - { - final InfernoJadAttack attack = plugin.getAttack(); + if (attack == null) + { + return null; + } - if (attack == null) - { - return null; - } + final BufferedImage prayerImage = getPrayerImage(attack); - final BufferedImage prayerImage = getPrayerImage(attack); + imagePanelComponent.getChildren().clear(); + imagePanelComponent.getChildren().add(new ImageComponent(prayerImage)); + imagePanelComponent.setBackgroundColor(client.isPrayerActive(attack.getPrayer()) + ? ComponentConstants.STANDARD_BACKGROUND_COLOR + : NOT_ACTIVATED_BACKGROUND_COLOR); - imagePanelComponent.getChildren().clear(); - imagePanelComponent.getChildren().add(new ImageComponent(prayerImage)); - imagePanelComponent.setBackgroundColor(client.isPrayerActive(attack.getPrayer()) - ? ComponentConstants.STANDARD_BACKGROUND_COLOR - : NOT_ACTIVATED_BACKGROUND_COLOR); + return imagePanelComponent.render(graphics); + } - return imagePanelComponent.render(graphics); - } - - private BufferedImage getPrayerImage(InfernoJadAttack attack) - { - final int prayerSpriteID = attack == InfernoJadAttack.MAGIC ? SpriteID.PRAYER_PROTECT_FROM_MAGIC : SpriteID.PRAYER_PROTECT_FROM_MISSILES; - return spriteManager.getSprite(prayerSpriteID, 0); - } -} \ No newline at end of file + private BufferedImage getPrayerImage(InfernoJadAttack attack) + { + final int prayerSpriteID = attack == InfernoJadAttack.MAGIC ? SpriteID.PRAYER_PROTECT_FROM_MAGIC : SpriteID.PRAYER_PROTECT_FROM_MISSILES; + return spriteManager.getSprite(prayerSpriteID, 0); + } + }