diff --git a/build.gradle b/build.gradle index 6d667e0b55..f070c391cb 100644 --- a/build.gradle +++ b/build.gradle @@ -43,6 +43,7 @@ ext { httpcore = '4.4.12' httpmime = '4.5.9' javassist = '3.25.0-GA' + javax = '1.3.2' javaxInject = '1' jbsdiff = '1.0' jclCore = '2.8' diff --git a/runelite-client/build.gradle b/runelite-client/build.gradle index 2a0f3402c0..af4c991767 100644 --- a/runelite-client/build.gradle +++ b/runelite-client/build.gradle @@ -11,6 +11,7 @@ description = 'RuneLite Client' dependencies { annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok + compileOnly group: 'javax.annotation', name: 'javax.annotation-api', version: javax compileOnly group: 'net.runelite', name: 'orange-extensions', version: orangeExtensions compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPlugin.java index a003e9fc07..9ae984da09 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/equipmentinspector/EquipmentInspectorPlugin.java @@ -290,7 +290,7 @@ public class EquipmentInspectorPlugin extends Plugin StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice); } chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) + .type(ChatMessageType.CONSOLE) .runeLiteFormattedMessage(new ChatMessageBuilder() .append(ChatColorType.HIGHLIGHT) .append("Risked Value: ") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PlayerSpellEffect.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PlayerSpellEffect.java index dcebed7ba0..7c7123fc1f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PlayerSpellEffect.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/PlayerSpellEffect.java @@ -31,9 +31,9 @@ import lombok.Getter; @AllArgsConstructor public enum PlayerSpellEffect { - BIND("Bind", 181, 4800, true, 0, TimerType.FREEZE), - SNARE("Snare", 180, 9600, true, 1, TimerType.FREEZE), - ENTANGLE("Entangle", 179, 14400, true, 2, TimerType.FREEZE), + BIND("Bind", 181, 4800, false, 0, TimerType.FREEZE), + SNARE("Snare", 180, 9600, false, 1, TimerType.FREEZE), + ENTANGLE("Entangle", 179, 14400, false, 2, TimerType.FREEZE), RUSH("Ice Rush", 361, 4800, false, 3, TimerType.FREEZE), BURST("Ice Burst", 363, 9600, false, 4, TimerType.FREEZE), BLITZ("Ice Blitz", 367, 14400, false, 5, TimerType.FREEZE), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletTimer.java index 5bfe9acc35..815c131db3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletTimer.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletTimer.java @@ -223,7 +223,7 @@ class GauntletTimer extends Overlay .append(elapsedTime); chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) + .type(ChatMessageType.CONSOLE) .runeLiteFormattedMessage(prepmessage.build()) .build()); } @@ -246,7 +246,7 @@ class GauntletTimer extends Overlay .append(elapsedTotalTime); chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) + .type(ChatMessageType.CONSOLE) .runeLiteFormattedMessage(challengedurationmessage.build()) .build()); @@ -261,7 +261,7 @@ class GauntletTimer extends Overlay .append(elapsedBossTime); chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.FRIENDSCHATNOTIFICATION) + .type(ChatMessageType.CONSOLE) .runeLiteFormattedMessage(prepdeathmessage.build()) .build()); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java index e44b35e94e..f3d1dcc3f6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerConfig.java @@ -47,7 +47,11 @@ public interface GroundMarkerConfig extends Config FIVE("5"), SIX("6"), SEVEN("7"), - EIGHT("8"); + EIGHT("8"), + NINE("9"), + TEN("10"), + ELEVEN("11"), + TWELVE("12"); private final String name; @@ -78,11 +82,11 @@ public interface GroundMarkerConfig extends Config @ConfigItem( position = 1, keyName = "markerColor", - name = "Default Marked tile Color", + name = "Default tile Color", description = "Configures the default color of marked tiles", hidden = true, unhide = "amount", - unhideValue = "1 || 2 || 3 || 4 || 5 || 6 || 7 || 8" + unhideValue = "1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" ) default Color markerColor() { @@ -97,7 +101,7 @@ public interface GroundMarkerConfig extends Config description = "Configures the color of the 2nd group of marked tiles", hidden = true, unhide = "amount", - unhideValue = "2 || 3 || 4 || 5 || 6 || 7 || 8" + unhideValue = "2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" ) default Color markerColor2() { @@ -112,7 +116,7 @@ public interface GroundMarkerConfig extends Config description = "Configures the color of the 3rd group of marked tiles", hidden = true, unhide = "amount", - unhideValue = "3 || 4 || 5 || 6 || 7 || 8" + unhideValue = "3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" ) default Color markerColor3() { @@ -127,7 +131,7 @@ public interface GroundMarkerConfig extends Config description = "Configures the color of the 4th group of marked tiles", hidden = true, unhide = "amount", - unhideValue = "4 || 5 || 6 || 7 || 8" + unhideValue = "4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" ) default Color markerColor4() { @@ -142,7 +146,7 @@ public interface GroundMarkerConfig extends Config description = "Configures the color of the 5th group of marked tiles", hidden = true, unhide = "amount", - unhideValue = "5 || 6 || 7 || 8" + unhideValue = "5 || 6 || 7 || 8 || 9 || 10 || 11 || 12" ) default Color markerColor5() { @@ -157,7 +161,7 @@ public interface GroundMarkerConfig extends Config description = "Configures the color of the 6th group of marked tiles", hidden = true, unhide = "amount", - unhideValue = "6 || 7 || 8" + unhideValue = "6 || 7 || 8 || 9 || 10 || 11 || 12" ) default Color markerColor6() { @@ -172,7 +176,7 @@ public interface GroundMarkerConfig extends Config description = "Configures the color of the 7th group of marked tiles", hidden = true, unhide = "amount", - unhideValue = "7 || 8" + unhideValue = "7 || 8 || 9 || 10 || 11 || 12" ) default Color markerColor7() { @@ -187,15 +191,75 @@ public interface GroundMarkerConfig extends Config description = "Configures the color of the 8th group of marked tiles", hidden = true, unhide = "amount", - unhideValue = "8" + unhideValue = "8 || 9 || 10 || 11 || 12" ) default Color markerColor8() { return Color.MAGENTA; } + @Alpha @ConfigItem( position = 10, + keyName = "markerColor9", + name = "Group 9 tile color", + description = "Configures the color of the 9th group of marked tiles", + hidden = true, + unhide = "amount", + unhideValue = "9 || 10 || 11 || 12" + ) + default Color markerColor9() + { + return Color.CYAN; + } + + @Alpha + @ConfigItem( + position = 11, + keyName = "markerColor10", + name = "Group 10 tile color", + description = "Configures the color of the 10th group of marked tiles", + hidden = true, + unhide = "amount", + unhideValue = "10 || 11 || 12" + ) + default Color markerColor10() + { + return Color.ORANGE; + } + + @Alpha + @ConfigItem( + position = 12, + keyName = "markerColor11", + name = "Group 11 tile color", + description = "Configures the color of the 11th group of marked tiles", + hidden = true, + unhide = "amount", + unhideValue = "11 || 12" + ) + default Color markerColor11() + { + return Color.PINK; + } + + @Alpha + @ConfigItem( + position = 13, + keyName = "markerColor12", + name = "Group 12 tile color", + description = "Configures the color of the 12th group of marked tiles", + hidden = true, + unhide = "amount", + unhideValue = "12" + ) + default Color markerColor12() + { + return Color.LIGHT_GRAY; + } + + @ConfigItem( + position = 14, keyName = "showMinimap", name = "Show on minimap", description = "Shows marked tiles on the minimap" @@ -210,7 +274,7 @@ public interface GroundMarkerConfig extends Config max = 100 ) @ConfigItem( - position = 11, + position = 15, keyName = "minimapOpacity", name = "Minimap opacity", description = "The opacity of the minimap markers" diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerMinimapOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerMinimapOverlay.java index eda6be221d..794bed0859 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerMinimapOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerMinimapOverlay.java @@ -101,6 +101,18 @@ class GroundMarkerMinimapOverlay extends Overlay break; case 8: color = plugin.getMarkerColor8(); + break; + case 9: + color = plugin.getMarkerColor9(); + break; + case 10: + color = plugin.getMarkerColor10(); + break; + case 11: + color = plugin.getMarkerColor11(); + break; + case 12: + color = plugin.getMarkerColor12(); } int opacity = (int) floor(plugin.getMinimapOverlayOpacity() * 2.55); @@ -129,4 +141,4 @@ class GroundMarkerMinimapOverlay extends Overlay OverlayUtil.renderMinimapRect(client, graphics, posOnMinimap, TILE_WIDTH, TILE_HEIGHT, color); } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java index 66972a157d..e17bd1c336 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerOverlay.java @@ -113,7 +113,19 @@ public class GroundMarkerOverlay extends Overlay break; case 8: color = plugin.getMarkerColor8(); + break; + case 9: + color = plugin.getMarkerColor9(); + break; + case 10: + color = plugin.getMarkerColor10(); + break; + case 11: + color = plugin.getMarkerColor11(); + break; + case 12: + color = plugin.getMarkerColor12(); } OverlayUtil.renderPolygon(graphics, poly, color); } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 292e70d014..ab37bac5e8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -162,6 +162,14 @@ public class GroundMarkerPlugin extends Plugin @Getter(AccessLevel.PACKAGE) private Color markerColor8; @Getter(AccessLevel.PACKAGE) + private Color markerColor9; + @Getter(AccessLevel.PACKAGE) + private Color markerColor10; + @Getter(AccessLevel.PACKAGE) + private Color markerColor11; + @Getter(AccessLevel.PACKAGE) + private Color markerColor12; + @Getter(AccessLevel.PACKAGE) private boolean showMinimap; @Getter(AccessLevel.PACKAGE) private int minimapOverlayOpacity; @@ -459,6 +467,18 @@ public class GroundMarkerPlugin extends Plugin break; case 8: color = this.markerColor8; + break; + case 9: + color = this.markerColor9; + break; + case 10: + color = this.markerColor10; + break; + case 11: + color = this.markerColor11; + break; + case 12: + color = this.markerColor12; } return color; @@ -483,7 +503,11 @@ public class GroundMarkerPlugin extends Plugin this.markerColor6 = config.markerColor6(); this.markerColor7 = config.markerColor7(); this.markerColor8 = config.markerColor8(); + this.markerColor9 = config.markerColor9(); + this.markerColor10 = config.markerColor10(); + this.markerColor11 = config.markerColor11(); + this.markerColor12 = config.markerColor12(); this.showMinimap = config.showMinimap(); this.minimapOverlayOpacity = config.minimapOverlayOpacity(); } -} +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java index 619bddfe9c..96899bbb76 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java @@ -160,7 +160,10 @@ public class PlayerIndicatorsOverlay extends Overlay if (plugin.getAgilityFormat() == PlayerIndicatorsPlugin.AgilityFormats.ICONS) { - final int width = graphics.getFontMetrics().stringWidth(name); + + final int width = plugin.isShowCombatLevel() ? graphics.getFontMetrics().stringWidth(name) + + ACTOR_HORIZONTAL_TEXT_MARGIN : graphics.getFontMetrics().stringWidth(name); + final int height = graphics.getFontMetrics().getHeight(); if (level >= plugin.getAgilityFirstThreshold()) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsService.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsService.java index 6e03514bec..e4f52fa121 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsService.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsService.java @@ -60,25 +60,26 @@ public class PlayerIndicatorsService self = (player) -> Objects.equals(client.getLocalPlayer(), player); friend = (player) -> (!player.equals(client.getLocalPlayer()) && client.isFriended(player.getName(), false)); - clan = Player::isClanMember; + clan = (player) -> (player.isClanMember() && !client.isFriended(player.getName(), false)); team = (player) -> (Objects.requireNonNull(client.getLocalPlayer()).getTeam() != 0 && client.getLocalPlayer().getTeam() == player.getTeam()); - target = (player) -> PvPUtil.isAttackable(client, player); + target = (player -> + { + if (nonFriendly(player)) + { + return false; + } + return plugin.isHighlightTargets() && PvPUtil.isAttackable(client, player); + }); caller = plugin::isCaller; callerTarget = piles::contains; other = (player -> { - if (player == null - || (plugin.isHighlightClan() && player.isClanMember()) - || (plugin.isHighlightFriends() && client.isFriended(player.getName(), false)) - || (plugin.isHighlightCallers() && plugin.isCaller(player)) - || (plugin.isHighlightCallerTargets() && piles.contains(player)) - || (plugin.isHighlightTeam() && Objects.requireNonNull(client.getLocalPlayer()).getTeam() != 0 - && client.getLocalPlayer().getTeam() == player.getTeam())) + if (nonFriendly(player)) { return false; } - return !plugin.isHighlightTargets() || PvPUtil.isAttackable(client, player); + return true; }); } @@ -141,4 +142,15 @@ public class PlayerIndicatorsService || plugin.isHighlightFriends() || plugin.isHighlightOther() || plugin.isHighlightTargets() || plugin.isHighlightCallers() || plugin.isHighlightTeam() || plugin.isHighlightCallerTargets(); } + + private boolean nonFriendly(Player player) + { + return player == null + || (plugin.isHighlightClan() && player.isClanMember()) + || (plugin.isHighlightFriends() && client.isFriended(player.getName(), false)) + || (plugin.isHighlightCallers() && plugin.isCaller(player)) + || (plugin.isHighlightCallerTargets() && piles.contains(player)) + || (plugin.isHighlightTeam() && Objects.requireNonNull(client.getLocalPlayer()).getTeam() != 0 + && client.getLocalPlayer().getTeam() == player.getTeam()); + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPanel.java index c4048d516c..1822a9044e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/profiles/ProfilesPanel.java @@ -120,6 +120,9 @@ class ProfilesPanel extends PluginPanel txtDecryptPassword.setEchoChar((char) 0); txtDecryptPassword.setForeground(ColorScheme.LIGHT_GRAY_COLOR); txtDecryptPassword.setToolTipText(UNLOCK_PASSWORD); + + txtDecryptPassword.addActionListener(e -> decryptAccounts()); + txtDecryptPassword.addFocusListener(new FocusListener() { @Override @@ -156,27 +159,7 @@ class ProfilesPanel extends PluginPanel @Override public void mousePressed(MouseEvent e) { - boolean error = false; - try - { - redrawProfiles(); - } - catch (InvalidKeySpecException | NoSuchAlgorithmException | IllegalBlockSizeException | InvalidKeyException | BadPaddingException | NoSuchPaddingException ex) - { - error = true; - showErrorMessage("Unable to load data", "Incorrect password!"); - } - - if (error) - { - return; - } - - remove(loginPanel); - add(accountPanel, BorderLayout.CENTER); - - profilesPanel.setLayout(new DynamicGridLayout(0, 1, 0, 3)); - add(profilesPanel, BorderLayout.SOUTH); + decryptAccounts(); } @Override @@ -386,6 +369,38 @@ class ProfilesPanel extends PluginPanel // addAccounts(config.profilesData()); } + private void decryptAccounts() + { + if (txtDecryptPassword.getPassword().length == 0 || String.valueOf(txtDecryptPassword.getPassword()).equals(UNLOCK_PASSWORD)) + { + showErrorMessage("Unable to load data", "Please enter a password!"); + return; + } + + boolean error = false; + try + { + redrawProfiles(); + } + catch (InvalidKeySpecException | NoSuchAlgorithmException | IllegalBlockSizeException | InvalidKeyException | BadPaddingException | NoSuchPaddingException ex) + { + error = true; + showErrorMessage("Unable to load data", "Incorrect password!"); + txtDecryptPassword.setText(""); + } + + if (error) + { + return; + } + + remove(loginPanel); + add(accountPanel, BorderLayout.CENTER); + + profilesPanel.setLayout(new DynamicGridLayout(0, 1, 0, 3)); + add(profilesPanel, BorderLayout.SOUTH); + } + private void redrawProfiles() throws InvalidKeySpecException, NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException { profilesPanel.removeAll(); @@ -462,11 +477,6 @@ class ProfilesPanel extends PluginPanel String tmp = profilesConfig.profilesData(); if (tmp.startsWith("¬")) { - if (txtDecryptPassword.getPassword().length == 0 || String.valueOf(txtDecryptPassword.getPassword()).equals(UNLOCK_PASSWORD)) - { - showErrorMessage("Unable to load data", "Please enter a password!"); - return tmp; - } tmp = tmp.substring(1); return decryptText(base64Decode(tmp), getAesKey()); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/safespot/SafeSpotConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/safespot/SafeSpotConfig.java index d9a42c2207..71a5ecd54a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/safespot/SafeSpotConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/safespot/SafeSpotConfig.java @@ -19,17 +19,6 @@ public interface SafeSpotConfig extends Config { @ConfigItem( position = 1, - keyName = "playerSafeSpots", - name = "Render for Players", - description = "Renders 1 way safe spots vs other players" - ) - default boolean playerSafeSpots() - { - return true; - } - - @ConfigItem( - position = 2, keyName = "npcSafeSpots", name = "Render for NPCs", description = "Renders 1 way safe spots vs NPCs" @@ -40,7 +29,7 @@ public interface SafeSpotConfig extends Config } @ConfigItem( - position = 3, + position = 2, keyName = "tileColor", name = "Tile Color", description = "Color of safe spot tile" diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/safespot/SafeSpotPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/safespot/SafeSpotPlugin.java index 72066225dd..237414a0ac 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/safespot/SafeSpotPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/safespot/SafeSpotPlugin.java @@ -21,7 +21,6 @@ import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.CollisionDataFlag; import net.runelite.api.NPC; -import net.runelite.api.Player; import net.runelite.api.Tile; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldArea; @@ -38,10 +37,10 @@ import net.runelite.client.plugins.PluginType; import net.runelite.client.ui.overlay.OverlayManager; @PluginDescriptor( - name = "1 Way Safe Spots", + name = "NPC Safe Spots", description = "Renders tile overlays for one way safe spots", - tags = {"safe spot", "pvp", "safespots", "pklite"}, - type = PluginType.UTILITY, + tags = {"safe spot", "safespots", "pvm"}, + type = PluginType.PVM, enabledByDefault = false ) @Singleton @@ -71,7 +70,6 @@ public class SafeSpotPlugin extends Plugin private SafeSpotOverlay safeSpotOverlay; private int tickCount = 0; - private boolean playerSafeSpots; private boolean npcSafeSpots; @Getter(AccessLevel.PACKAGE) private Color tileColor; @@ -113,7 +111,7 @@ public class SafeSpotPlugin extends Plugin { return; } - if (event.getTarget() == null && (this.npcSafeSpots || this.playerSafeSpots)) + if (event.getTarget() == null && this.npcSafeSpots) { tickCount = 10; } @@ -123,11 +121,6 @@ public class SafeSpotPlugin extends Plugin { if (client.getLocalPlayer().getInteracting() != null) { - if (client.getLocalPlayer().getInteracting() instanceof Player && this.playerSafeSpots) - { - safeSpotsRenderable = true; - updateSafeSpots(); - } if (client.getLocalPlayer().getInteracting() instanceof NPC && this.npcSafeSpots) { if (npcManager.getStats(((NPC) client.getLocalPlayer().getInteracting()).getId()) != null) @@ -215,7 +208,6 @@ public class SafeSpotPlugin extends Plugin private void updateConfig() { - this.playerSafeSpots = config.playerSafeSpots(); this.npcSafeSpots = config.npcSafeSpots(); this.tileColor = config.tileColor(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java index 6e0a086f05..9212ff3e94 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/wintertodt/WintertodtPlugin.java @@ -37,7 +37,6 @@ import lombok.extern.slf4j.Slf4j; import static net.runelite.api.AnimationID.*; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; -import static net.runelite.api.GameState.LOADING; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemContainer; @@ -50,7 +49,6 @@ import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.GameTick; -import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.ItemContainerChanged; import net.runelite.api.events.VarbitChanged; import net.runelite.client.Notifier; @@ -116,8 +114,6 @@ public class WintertodtPlugin extends Plugin private WintertodtNotifyMode notifyCondition; private Color damageNotificationColor; - private boolean subscribed; - @Provides WintertodtConfig getConfig(ConfigManager configManager) { @@ -134,15 +130,12 @@ public class WintertodtPlugin extends Plugin reset(); overlayManager.add(overlay); - - handleWintertodtRegion(); } @Override protected void shutDown() throws Exception { - eventBus.unregister(this); - eventBus.unregister("inside-wintertodt"); + super.shutDown(); overlayManager.remove(overlay); reset(); @@ -151,23 +144,11 @@ public class WintertodtPlugin extends Plugin private void addSubscriptions() { eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); - eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); + eventBus.subscribe(GameTick.class, this, this::onGameTick); eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged); - } - - private void wintertodtSubscriptions(boolean subscribe) - { - if (subscribe) - { - eventBus.subscribe(GameTick.class, "inside-wintertodt", this::onGameTick); - eventBus.subscribe(ChatMessage.class, "inside-wintertodt", this::onChatMessage); - eventBus.subscribe(AnimationChanged.class, "inside-wintertodt", this::onAnimationChanged); - eventBus.subscribe(ItemContainerChanged.class, "inside-wintertodt", this::onItemContainerChanged); - } - else - { - eventBus.unregister("inside-wintertodt"); - } + eventBus.subscribe(ChatMessage.class, this, this::onChatMessage); + eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged); + eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged); } private void onConfigChanged(ConfigChanged event) @@ -199,24 +180,9 @@ public class WintertodtPlugin extends Plugin return false; } - private void handleWintertodtRegion() + private void onGameTick(GameTick gameTick) { - if (isInWintertodtRegion()) - { - if (!isInWintertodt) - { - reset(); - log.debug("Entered Wintertodt!"); - } - isInWintertodt = true; - - if (!subscribed) - { - wintertodtSubscriptions(true); - subscribed = true; - } - } - else + if (!isInWintertodtRegion()) { if (isInWintertodt) { @@ -225,25 +191,16 @@ public class WintertodtPlugin extends Plugin } isInWintertodt = false; - - if (subscribed) - { - wintertodtSubscriptions(false); - subscribed = false; - } + return; } - } - private void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == LOADING) + if (!isInWintertodt) { - handleWintertodtRegion(); + reset(); + log.debug("Entered Wintertodt!"); } - } + isInWintertodt = true; - private void onGameTick(GameTick gameTick) - { checkActionTimeout(); } @@ -295,6 +252,11 @@ public class WintertodtPlugin extends Plugin private void onChatMessage(ChatMessage chatMessage) { + if (!isInWintertodt) + { + return; + } + ChatMessageType chatMessageType = chatMessage.getType(); if (chatMessageType != ChatMessageType.GAMEMESSAGE && chatMessageType != ChatMessageType.SPAM) @@ -433,6 +395,11 @@ public class WintertodtPlugin extends Plugin private void onAnimationChanged(final AnimationChanged event) { + if (!isInWintertodt) + { + return; + } + final Player local = client.getLocalPlayer(); if (event.getActor() != local) @@ -479,7 +446,7 @@ public class WintertodtPlugin extends Plugin { final ItemContainer container = event.getItemContainer(); - if (container != client.getItemContainer(InventoryID.INVENTORY)) + if (!isInWintertodt || container != client.getItemContainer(InventoryID.INVENTORY)) { return; }