client: add PMD source code analyzer

This catches common bugs, dead code, etc., and also performs some more advanced
code style checks compared to checkstyle.

Co-authored-by: pilino1234 <pilino@posteo.de>
This commit is contained in:
Adam
2020-11-01 11:54:54 -05:00
parent c8400a184a
commit 7ceb3c9e02
106 changed files with 271 additions and 266 deletions

View File

@@ -0,0 +1,96 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2020, Adam <Adam@sigterm.info>
All rights reserved.
Redistribution and use in source and binary forms, with or without
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.
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 SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<ruleset name="RuneLite"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>
RuneLite PMD ruleset
</description>
<!-- best practices -->
<rule ref="category/java/bestpractices.xml/AvoidPrintStackTrace"/>
<rule ref="category/java/bestpractices.xml/DoubleBraceInitialization"/>
<rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach"/>
<rule ref="category/java/bestpractices.xml/MissingOverride"/>
<rule ref="category/java/bestpractices.xml/PreserveStackTrace"/>
<rule ref="category/java/bestpractices.xml/SystemPrintln"/>
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable"/>
<rule ref="category/java/bestpractices.xml/UnusedPrivateField"/>
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod">
<properties>
<property name="ignoredAnnotations"
value="net.runelite.client.eventbus.Subscribe|com.google.inject.Provides"/>
</properties>
</rule>
<rule ref="category/java/bestpractices.xml/UseTryWithResources"/>
<rule ref="category/java/bestpractices.xml/WhileLoopWithLiteralBoolean"/>
<!-- code style -->
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass"/>
<rule ref="category/java/codestyle.xml/AvoidProtectedMethodInFinalClassNotExtending"/>
<rule ref="category/java/codestyle.xml/DontImportJavaLang"/>
<rule ref="category/java/codestyle.xml/ExtendsObject"/>
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop"/>
<rule ref="category/java/codestyle.xml/IdenticalCatchBranches"/>
<rule ref="category/java/codestyle.xml/PackageCase"/>
<rule ref="category/java/codestyle.xml/UnnecessaryCast"/>
<rule ref="category/java/codestyle.xml/UnnecessaryConstructor"/>
<rule ref="category/java/codestyle.xml/UnnecessaryModifier"/>
<rule ref="category/java/codestyle.xml/UseDiamondOperator"/>
<rule ref="category/java/codestyle.xml/UseShortArrayInitializer"/>
<!-- design -->
<rule ref="category/java/design.xml/AvoidThrowingNewInstanceOfSameException"/>
<rule ref="category/java/design.xml/FinalFieldCouldBeStatic"/>
<rule ref="category/java/design.xml/ImmutableField"/>
<rule ref="category/java/design.xml/SimplifyBooleanExpressions"/>
<rule ref="category/java/design.xml/SimplifyConditional"/>
<rule ref="category/java/design.xml/UselessOverridingMethod"/>
<!-- error prone -->
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
<rule ref="category/java/errorprone.xml/DontImportSun"/>
<rule ref="category/java/errorprone.xml/EmptyFinallyBlock"/>
<rule ref="category/java/errorprone.xml/EmptyIfStmt"/>
<rule ref="category/java/errorprone.xml/EmptyInitializer"/>
<rule ref="category/java/errorprone.xml/EmptyStatementBlock"/>
<rule ref="category/java/errorprone.xml/ImportFromSamePackage"/>
<rule ref="category/java/errorprone.xml/InstantiationToGetClass"/>
<rule ref="category/java/errorprone.xml/InvalidLogMessageFormat"/>
<rule ref="category/java/errorprone.xml/JumbledIncrementer"/>
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode"/>
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement"/>
<rule ref="category/java/errorprone.xml/UseEqualsToCompareStrings"/>
<!-- performance -->
<rule ref="category/java/performance.xml/AppendCharacterWithChar"/>
<rule ref="category/java/performance.xml/ConsecutiveLiteralAppends"/>
<rule ref="category/java/performance.xml/InefficientStringBuffering"/>
<rule ref="category/java/performance.xml/UnnecessaryWrapperObjectCreation"/>
</ruleset>

View File

@@ -40,6 +40,7 @@
<jogl.version>2.4.0-rc-20200429</jogl.version>
<jarsigner.skip>true</jarsigner.skip>
<pmd.skip>true</pmd.skip>
</properties>
<dependencies>
@@ -415,6 +416,39 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.13.0</version>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>6.29.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>6.29.0</version>
</dependency>
</dependencies>
<configuration>
<failOnViolation>true</failOnViolation>
<printFailingErrors>true</printFailingErrors>
<rulesets>
<ruleset>${basedir}/pmd-ruleset.xml</ruleset>
</rulesets>
<linkXRef>false</linkXRef>
<analysisCache>true</analysisCache>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -36,7 +36,7 @@ import net.runelite.api.Client;
@Slf4j
public class ClientThread
{
private ConcurrentLinkedQueue<BooleanSupplier> invokes = new ConcurrentLinkedQueue<>();
private final ConcurrentLinkedQueue<BooleanSupplier> invokes = new ConcurrentLinkedQueue<>();
@Inject
private Client client;
@@ -90,7 +90,7 @@ public class ClientThread
{
assert client.isClientThread();
Iterator<BooleanSupplier> ir = invokes.iterator();
for (; ir.hasNext(); )
while (ir.hasNext())
{
BooleanSupplier r = ir.next();
boolean remove = true;

View File

@@ -115,7 +115,7 @@ public class ChatMessageManager
boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1;
Color usernameColor = null;
Color senderColor = null;
Color senderColor;
switch (chatMessageType)
{

View File

@@ -49,6 +49,7 @@ public class ModifierlessKeybind extends Keybind
* KeyReleased event this returns if the event is this hotkey being
* released
*/
@Override
public boolean matches(KeyEvent e)
{
return matches(e, true);

View File

@@ -50,7 +50,6 @@ import net.runelite.api.Constants;
import static net.runelite.api.Constants.CLIENT_DEFAULT_ZOOM;
import net.runelite.api.GameState;
import net.runelite.api.ItemComposition;
import net.runelite.api.ItemID;
import static net.runelite.api.ItemID.*;
import net.runelite.api.SpritePixels;
import net.runelite.api.events.GameStateChanged;
@@ -296,11 +295,11 @@ public class ItemManager
*/
public int getItemPrice(int itemID, boolean ignoreUntradeableMap)
{
if (itemID == ItemID.COINS_995)
if (itemID == COINS_995)
{
return 1;
}
if (itemID == ItemID.PLATINUM_TOKEN)
if (itemID == PLATINUM_TOKEN)
{
return 1000;
}
@@ -490,7 +489,7 @@ public class ItemManager
*/
private BufferedImage loadItemOutline(final int itemId, final int itemQuantity, final Color outlineColor)
{
final SpritePixels itemSprite = client.createItemSprite(itemId, itemQuantity, 1, 0, 0, false, Constants.CLIENT_DEFAULT_ZOOM);
final SpritePixels itemSprite = client.createItemSprite(itemId, itemQuantity, 1, 0, 0, false, CLIENT_DEFAULT_ZOOM);
return itemSprite.toBufferedOutline(outlineColor);
}

View File

@@ -40,7 +40,6 @@ public class SkillIconManager
public BufferedImage getSkillImage(Skill skill, boolean small)
{
int skillIdx = skill.ordinal() + (small ? Skill.values().length : 0);
BufferedImage skillImage = null;
if (imgCache[skillIdx] != null)
{
@@ -50,7 +49,7 @@ public class SkillIconManager
String skillIconPath = (small ? "/skill_icons_small/" : "/skill_icons/")
+ skill.getName().toLowerCase() + ".png";
log.debug("Loading skill icon from {}", skillIconPath);
skillImage = ImageUtil.getResourceStreamFromClass(getClass(), skillIconPath);
BufferedImage skillImage = ImageUtil.getResourceStreamFromClass(getClass(), skillIconPath);
imgCache[skillIdx] = skillImage;
return skillImage;

View File

@@ -63,7 +63,7 @@ public class ChatboxItemSearch extends ChatboxTextInput
private final ItemManager itemManager;
private final Client client;
private Map<Integer, ItemComposition> results = new LinkedHashMap<>();
private final Map<Integer, ItemComposition> results = new LinkedHashMap<>();
private String tooltipText;
private int index = -1;

View File

@@ -232,24 +232,6 @@ public class MenuManager
actions[unused] = npcOption;
}
private void removeNpcOption(NPCComposition composition, String npcOption)
{
String[] actions = composition.getActions();
if (composition.getActions() == null)
{
return;
}
for (int i = 0; i < actions.length; ++i)
{
if (actions[i] != null && actions[i].equals(npcOption))
{
actions[i] = null;
}
}
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{

View File

@@ -52,7 +52,6 @@ import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
import javax.inject.Inject;
@@ -92,7 +91,6 @@ public class PluginManager
private final EventBus eventBus;
private final Scheduler scheduler;
private final ConfigManager configManager;
private final ScheduledExecutorService executor;
private final Provider<GameEventManager> sceneTileManager;
private final List<Plugin> plugins = new CopyOnWriteArrayList<>();
private final List<Plugin> activePlugins = new CopyOnWriteArrayList<>();
@@ -108,7 +106,6 @@ public class PluginManager
final EventBus eventBus,
final Scheduler scheduler,
final ConfigManager configManager,
final ScheduledExecutorService executor,
final Provider<GameEventManager> sceneTileManager)
{
this.developerMode = developerMode;
@@ -116,7 +113,6 @@ public class PluginManager
this.eventBus = eventBus;
this.scheduler = scheduler;
this.configManager = configManager;
this.executor = executor;
this.sceneTileManager = sceneTileManager;
}

View File

@@ -40,8 +40,9 @@ public class CombatLevelRequirement implements Requirement
return level + " " + "Combat";
}
@Override
public boolean satisfiesRequirement(Client client)
{
return client.getLocalPlayer() == null ? false : client.getLocalPlayer().getCombatLevel() >= level;
return client.getLocalPlayer() != null && client.getLocalPlayer().getCombatLevel() >= level;
}
}

View File

@@ -42,6 +42,7 @@ public class FavourRequirement implements Requirement
return percent + "% " + house.getName() + " favour";
}
@Override
public boolean satisfiesRequirement(Client client)
{
int realFavour = client.getVar(house.getVarbit());

View File

@@ -46,6 +46,7 @@ public class OrRequirement implements Requirement
return Joiner.on(" or ").join(requirements);
}
@Override
public boolean satisfiesRequirement(Client client)
{
for (Requirement r : getRequirements())

View File

@@ -41,6 +41,7 @@ public class QuestPointRequirement implements Requirement
return qp + " " + "Quest points";
}
@Override
public boolean satisfiesRequirement(Client client)
{
return client.getVar(VarPlayer.QUEST_POINTS) >= qp;

View File

@@ -53,6 +53,7 @@ public class QuestRequirement implements Requirement
return quest.getName();
}
@Override
public boolean satisfiesRequirement(Client client)
{
QuestState questState = quest.getState(client);

View File

@@ -42,6 +42,7 @@ public class SkillRequirement implements Requirement
return level + " " + skill.getName();
}
@Override
public boolean satisfiesRequirement(Client client)
{
return client.getRealSkillLevel(skill) >= level;

View File

@@ -44,7 +44,6 @@ import net.runelite.api.MenuAction;
import net.runelite.api.NPC;
import net.runelite.api.NullNpcID;
import net.runelite.api.Player;
import net.runelite.api.Skill;
import static net.runelite.api.Skill.AGILITY;
import net.runelite.api.Tile;
import net.runelite.api.TileItem;
@@ -159,7 +158,7 @@ public class AgilityPlugin extends Plugin
{
overlayManager.add(agilityOverlay);
overlayManager.add(lapCounterOverlay);
agilityLevel = client.getBoostedSkillLevel(Skill.AGILITY);
agilityLevel = client.getBoostedSkillLevel(AGILITY);
}
@Override

View File

@@ -278,7 +278,7 @@ public class AttackStylesPlugin extends Plugin
if (warnedSkills.contains(skill))
{
if (weaponSwitch)
{
{ // NOPMD EmptyIfStmt
// TODO : chat message to warn players that their weapon switch also caused an unwanted attack style change
}
warnedSkillSelected = true;
@@ -319,7 +319,7 @@ public class AttackStylesPlugin extends Plugin
}
// Magic staves defensive casting mode
if (attackStyle == AttackStyle.DEFENSIVE_CASTING || !enabled)
if (attackStyle == DEFENSIVE_CASTING || !enabled)
{
widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_DEFENSIVE_SPELL_BOX, enabled && warnedSkill);
widgetsToHide.put(equippedWeaponType, WidgetInfo.COMBAT_DEFENSIVE_SPELL_ICON, enabled && warnedSkill);

View File

@@ -72,13 +72,11 @@ import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemVariationMapping;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.input.KeyManager;
import net.runelite.client.input.MouseManager;
import net.runelite.client.input.MouseWheelListener;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDependency;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.banktags.tabs.BankSearch;
import net.runelite.client.plugins.banktags.tabs.TabInterface;
import static net.runelite.client.plugins.banktags.tabs.TabInterface.FILTERED_CHARS;
import net.runelite.client.plugins.banktags.tabs.TabSprites;
@@ -138,12 +136,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener
@Inject
private TabInterface tabInterface;
@Inject
private BankSearch bankSearch;
@Inject
private KeyManager keyManager;
@Inject
private SpriteManager spriteManager;

View File

@@ -113,7 +113,6 @@ public class TabInterface
private static final String TAG_GEAR = "Tag-equipment";
private static final String TAG_INVENTORY = "Tag-inventory";
private static final String TAB_MENU_KEY = "tagtabs";
private static final String TAB_MENU = TAG_SEARCH + TAB_MENU_KEY;
private static final String OPEN_TAB_MENU = "View tag tabs";
private static final String SHOW_WORN = "Show worn items";
private static final String SHOW_SETTINGS = "Show menu";
@@ -142,10 +141,10 @@ public class TabInterface
private final BankTagsConfig config;
private final Notifier notifier;
private final BankSearch bankSearch;
private final ChatboxItemSearch searchProvider;
private final Rectangle bounds = new Rectangle();
private final Rectangle canvasBounds = new Rectangle();
private ChatboxItemSearch searchProvider;
@Getter
private TagTab activeTab;
@Getter

View File

@@ -39,8 +39,6 @@ import net.runelite.client.ui.overlay.OverlayPosition;
class BarrowsOverlay extends Overlay
{
private static final int MAX_DISTANCE = 2350;
private final Client client;
private final BarrowsPlugin plugin;
private final BarrowsConfig config;

View File

@@ -79,7 +79,7 @@ enum Boss
bosses = builder.build();
}
private Boss(int id, long period, ChronoUnit unit, int itemSpriteId)
Boss(int id, long period, ChronoUnit unit, int itemSpriteId)
{
this.id = id;
this.spawnTime = Duration.of(period, unit);

View File

@@ -141,6 +141,7 @@ public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScr
return null;
}
@Override
public String[] getNpcs()
{
return new String[] {npc};

View File

@@ -369,6 +369,7 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat
this.location = wp;
}
@Override
public String[] getNpcs()
{
return new String[] {npc};

View File

@@ -208,6 +208,7 @@ public class MapClue extends ClueScroll implements ObjectClueScroll
return null;
}
@Override
public int[] getObjectIds()
{
return new int[] {objectId};

View File

@@ -29,8 +29,8 @@ import net.runelite.api.Item;
public class AnyRequirementCollection implements ItemRequirement
{
private String name;
private ItemRequirement[] requirements;
private final String name;
private final ItemRequirement[] requirements;
public AnyRequirementCollection(String name, ItemRequirement... requirements)
{

View File

@@ -30,8 +30,8 @@ import net.runelite.api.ItemComposition;
public class MultipleOfItemRequirement implements ItemRequirement
{
private int itemId;
private int quantity;
private final int itemId;
private final int quantity;
public MultipleOfItemRequirement(int itemId, int quantity)
{

View File

@@ -29,9 +29,9 @@ import net.runelite.api.Item;
public class RangeItemRequirement implements ItemRequirement
{
private String name;
private int startItemId;
private int endItemId;
private final String name;
private final int startItemId;
private final int endItemId;
public RangeItemRequirement(String name, int startItemId, int endItemId)
{

View File

@@ -30,7 +30,7 @@ import net.runelite.api.ItemComposition;
public class SingleItemRequirement implements ItemRequirement
{
private int itemId;
private final int itemId;
public SingleItemRequirement(int itemId)
{

View File

@@ -30,8 +30,8 @@ import net.runelite.api.Item;
public class SlotLimitationRequirement implements ItemRequirement
{
private String description;
private EquipmentInventorySlot[] slots;
private final String description;
private final EquipmentInventorySlot[] slots;
public SlotLimitationRequirement(String description, EquipmentInventorySlot... slots)
{

View File

@@ -61,7 +61,7 @@ final class UnitFormatter extends JFormattedTextField.AbstractFormatter
}
catch (NumberFormatException e)
{
throw new ParseException(trimmedText + " is not an integer.", 0);
throw new ParseException(trimmedText + " is not an integer.", 0); // NOPMD: PreserveStackTrace
}
}

View File

@@ -54,17 +54,15 @@ class CookingOverlay extends OverlayPanel
private final Client client;
private final CookingPlugin plugin;
private final CookingConfig config;
private final XpTrackerService xpTrackerService;
@Inject
private CookingOverlay(Client client, CookingPlugin plugin, CookingConfig config, XpTrackerService xpTrackerService)
private CookingOverlay(Client client, CookingPlugin plugin, XpTrackerService xpTrackerService)
{
super(plugin);
setPosition(OverlayPosition.TOP_LEFT);
this.client = client;
this.plugin = plugin;
this.config = config;
this.xpTrackerService = xpTrackerService;
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Cooking overlay"));
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, COOKING_RESET, "Cooking overlay"));

View File

@@ -90,9 +90,6 @@ public class CorpPlugin extends Plugin
@Inject
private CoreOverlay coreOverlay;
@Inject
private CorpConfig config;
@Provides
CorpConfig getConfig(ConfigManager configManager)
{

View File

@@ -31,7 +31,7 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup(DefaultWorldConfig.GROUP)
public interface DefaultWorldConfig extends Config
{
final String GROUP = "defaultworld";
String GROUP = "defaultworld";
@ConfigItem(
keyName = "defaultWorld",

View File

@@ -76,6 +76,7 @@ class InventoryDeltaPanel extends JPanel implements Scrollable
// Listen for resize events
addComponentListener(new ComponentAdapter()
{
@Override
public void componentResized(final ComponentEvent componentEvent)
{
// Account for container and slot padding

View File

@@ -206,7 +206,7 @@ class InventoryInspector extends JFrame
node.add(new InventoryLogNode(invLog));
// Cull very old stuff
for (; node.getChildCount() > MAX_LOG_ENTRIES; )
while (node.getChildCount() > MAX_LOG_ENTRIES)
{
node.remove(0);
}
@@ -317,7 +317,7 @@ class InventoryInspector extends JFrame
final int qty = e.getValue();
final ItemComposition c = itemManager.getItemComposition(e.getKey());
InventoryItem[] items = new InventoryItem[]{
InventoryItem[] items = {
new InventoryItem(-1, new Item(id, qty), c.getName(), c.isStackable())
};
if (!c.isStackable() && (qty > 1 || qty < -1))

View File

@@ -90,8 +90,8 @@ public class ScriptInspector extends JFrame
private int lastTick;
private Set<Integer> blacklist;
private Set<Integer> highlights;
private JList jList;
private DefaultListModel listModel;
private final JList jList;
private final DefaultListModel listModel;
private ListState state = ListState.BLACKLIST;
private enum ListState
@@ -401,7 +401,7 @@ public class ScriptInspector extends JFrame
tracker.add(tree);
// Cull very old stuff
for (; tracker.getComponentCount() > MAX_LOG_ENTRIES; )
while (tracker.getComponentCount() > MAX_LOG_ENTRIES)
{
tracker.remove(0);
}

View File

@@ -209,7 +209,7 @@ class VarInspector extends JFrame
tracker.add(new JLabel(String.format("%s %s changed: %s -> %s", type.getName(), name, old, neew)));
// Cull very old stuff
for (; tracker.getComponentCount() > MAX_LOG_ENTRIES; )
while (tracker.getComponentCount() > MAX_LOG_ENTRIES)
{
tracker.remove(0);
}

View File

@@ -345,7 +345,7 @@ class WidgetInspector extends JFrame
DefaultMutableTreeNode node = root;
deeper:
for (; !treePath.empty(); )
while (!treePath.empty())
{
Widget w = treePath.pop();
for (Enumeration<?> it = node.children(); it.hasMoreElements(); )

View File

@@ -291,7 +291,7 @@ public class DiscordPlugin extends Plugin
@Override
public void onResponse(Call call, Response response) throws IOException
{
try
try // NOPMD: UseTryWithResources
{
if (!response.isSuccessful())
{

View File

@@ -68,7 +68,7 @@ public class XpDropPlugin extends Plugin
private boolean hasDropped = false;
private boolean correctPrayer;
private Skill lastSkill = null;
private Map<Skill, Integer> previousSkillExpTable = new EnumMap<>(Skill.class);
private final Map<Skill, Integer> previousSkillExpTable = new EnumMap<>(Skill.class);
@Provides
XpDropConfig provideConfig(ConfigManager configManager)

View File

@@ -68,9 +68,9 @@ import net.runelite.client.util.Text;
)
public class FairyRingPlugin extends Plugin
{
private static final String[] leftDial = new String[]{"A", "D", "C", "B"};
private static final String[] middleDial = new String[]{"I", "L", "K", "J"};
private static final String[] rightDial = new String[]{"P", "S", "R", "Q"};
private static final String[] leftDial = {"A", "D", "C", "B"};
private static final String[] middleDial = {"I", "L", "K", "J"};
private static final String[] rightDial = {"P", "S", "R", "Q"};
private static final int ENTRY_PADDING = 3;

View File

@@ -61,9 +61,6 @@ public class FeedPlugin extends Plugin
@Inject
private ClientToolbar clientToolbar;
@Inject
private FeedConfig config;
@Inject
private ScheduledExecutorService executorService;

View File

@@ -120,13 +120,13 @@ public class FriendsChatPlugin extends Plugin
private ChatboxPanelManager chatboxPanelManager;
private List<String> chats = new ArrayList<>();
private List<Player> members = new ArrayList<>();
private final List<Player> members = new ArrayList<>();
private MembersIndicator membersIndicator;
/**
* queue of temporary messages added to the client
*/
private final Deque<MemberJoinMessage> joinMessages = new ArrayDeque<>();
private Map<String, MemberActivity> activityBuffer = new HashMap<>();
private final Map<String, MemberActivity> activityBuffer = new HashMap<>();
private int joinedTick;
private boolean kickConfirmed = false;

View File

@@ -441,7 +441,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
if (uniformBufferId != -1)
{
GLUtil.glDeleteBuffer(gl, uniformBufferId);
glDeleteBuffer(gl, uniformBufferId);
uniformBufferId = -1;
}
@@ -796,9 +796,9 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
}
else if (paint.getBufferLen() > 0)
{
x = tileX * Perspective.LOCAL_TILE_SIZE;
y = 0;
z = tileY * Perspective.LOCAL_TILE_SIZE;
final int localX = tileX * Perspective.LOCAL_TILE_SIZE;
final int localY = 0;
final int localZ = tileY * Perspective.LOCAL_TILE_SIZE;
GpuIntBuffer b = modelBufferUnordered;
++unorderedModels;
@@ -810,7 +810,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
buffer.put(2);
buffer.put(targetBufferOffset);
buffer.put(FLAG_SCENE_BUFFER);
buffer.put(x).put(y).put(z);
buffer.put(localX).put(localY).put(localZ);
targetBufferOffset += 2 * 3;
}
@@ -830,9 +830,9 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
}
else if (model.getBufferLen() > 0)
{
x = tileX * Perspective.LOCAL_TILE_SIZE;
y = 0;
z = tileY * Perspective.LOCAL_TILE_SIZE;
final int localX = tileX * Perspective.LOCAL_TILE_SIZE;
final int localY = 0;
final int localZ = tileY * Perspective.LOCAL_TILE_SIZE;
GpuIntBuffer b = modelBufferUnordered;
++unorderedModels;
@@ -844,7 +844,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
buffer.put(model.getBufferLen() / 3);
buffer.put(targetBufferOffset);
buffer.put(FLAG_SCENE_BUFFER);
buffer.put(x).put(y).put(z);
buffer.put(localX).put(localY).put(localZ);
targetBufferOffset += model.getBufferLen();
}

View File

@@ -49,10 +49,6 @@ public class Shader
private final String filename;
}
public Shader()
{
}
public Shader add(int type, String name)
{
units.add(new Unit(type, name));

View File

@@ -37,10 +37,6 @@ public class Template
{
private final List<Function<String, String>> resourceLoaders = new ArrayList<>();
public Template()
{
}
public String process(String str)
{
StringBuilder sb = new StringBuilder();

View File

@@ -45,7 +45,8 @@ import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import net.runelite.api.GrandExchangeOffer;
import net.runelite.api.GrandExchangeOfferState;
import static net.runelite.api.GrandExchangeOfferState.BOUGHT;
import static net.runelite.api.GrandExchangeOfferState.BUYING;
import static net.runelite.api.GrandExchangeOfferState.CANCELLED_BUY;
import static net.runelite.api.GrandExchangeOfferState.CANCELLED_SELL;
import static net.runelite.api.GrandExchangeOfferState.EMPTY;
@@ -209,9 +210,9 @@ public class GrandExchangeOfferSlot extends JPanel
itemName.setText(offerItem.getName());
itemIcon.setIcon(new ImageIcon(itemImage));
boolean buying = newOffer.getState() == GrandExchangeOfferState.BOUGHT
|| newOffer.getState() == GrandExchangeOfferState.BUYING
|| newOffer.getState() == GrandExchangeOfferState.CANCELLED_BUY;
boolean buying = newOffer.getState() == BOUGHT
|| newOffer.getState() == BUYING
|| newOffer.getState() == CANCELLED_BUY;
String offerState = (buying ? "Bought " : "Sold ")
+ QuantityFormatter.quantityToRSDecimalStack(newOffer.getQuantitySold()) + " / "

View File

@@ -640,7 +640,7 @@ public class GroundItemsPlugin extends Plugin
final Player local = client.getLocalPlayer();
final StringBuilder notificationStringBuilder = new StringBuilder()
.append("[")
.append('[')
.append(local.getName())
.append("] received a ")
.append(dropType)

View File

@@ -53,7 +53,6 @@ import net.runelite.api.events.MenuOptionClicked;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -96,9 +95,6 @@ public class GroundMarkerPlugin extends Plugin
@Inject
private GroundMarkerMinimapOverlay minimapOverlay;
@Inject
private KeyManager keyManager;
@Inject
private ChatboxPanelManager chatboxPanelManager;

View File

@@ -114,7 +114,7 @@ public class HiscorePanel extends PluginPanel
ZALCANO, ZULRAH
);
private static final HiscoreEndpoint[] ENDPOINTS = new HiscoreEndpoint[] {
private static final HiscoreEndpoint[] ENDPOINTS = {
HiscoreEndpoint.NORMAL, HiscoreEndpoint.IRONMAN, HiscoreEndpoint.HARDCORE_IRONMAN, HiscoreEndpoint.ULTIMATE_IRONMAN, HiscoreEndpoint.DEADMAN, HiscoreEndpoint.LEAGUE
};
@@ -347,7 +347,7 @@ public class HiscorePanel extends PluginPanel
label.setIcon(new ImageIcon(ImageUtil.getResourceStreamFromClass(getClass(), skillIcon)));
boolean totalLabel = skill == HiscoreSkill.OVERALL || skill == null; //overall or combat
boolean totalLabel = skill == OVERALL || skill == null; //overall or combat
label.setIconTextGap(totalLabel ? 10 : 4);
JPanel skillPanel = new JPanel();

View File

@@ -28,7 +28,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ObjectArrays;
import com.google.inject.Provides;
import java.awt.image.BufferedImage;
import java.util.concurrent.ScheduledExecutorService;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
@@ -78,9 +77,6 @@ public class HiscorePlugin extends Plugin
@Inject
private ClientToolbar clientToolbar;
@Inject
private ScheduledExecutorService executor;
@Inject
private HiscoreConfig config;

View File

@@ -32,7 +32,6 @@ import java.util.Arrays;
import java.util.List;
import javax.inject.Inject;
import net.runelite.api.Actor;
import net.runelite.api.AnimationID;
import static net.runelite.api.AnimationID.*;
import net.runelite.api.Client;
import net.runelite.api.Constants;
@@ -86,7 +85,7 @@ public class IdleNotifierPlugin extends Plugin
private IdleNotifierConfig config;
private Instant lastAnimating;
private int lastAnimation = AnimationID.IDLE;
private int lastAnimation = IDLE;
private Instant lastInteracting;
private Actor lastInteract;
private Instant lastMoving;

View File

@@ -28,7 +28,6 @@ import com.google.inject.Binder;
import javax.inject.Inject;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.widgets.WidgetInfo;
import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_OPTION;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.input.KeyManager;
@@ -45,7 +44,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
)
public class InstanceMapPlugin extends Plugin
{
private final WidgetMenuOption openMapOption = new WidgetMenuOption("Show", "Instance Map", WidgetInfo.WORLD_MAP_OPTION);
private final WidgetMenuOption openMapOption = new WidgetMenuOption("Show", "Instance Map", WORLD_MAP_OPTION);
@Inject
private InstanceMapInputListener inputListener;

View File

@@ -40,8 +40,7 @@ import net.runelite.client.plugins.itemstats.StatsChanges;
@RequiredArgsConstructor
public class SaradominBrew implements Effect
{
private static final Stat[] saradominBrewStats = new Stat[]
{
private static final Stat[] saradominBrewStats = {
ATTACK, STRENGTH, RANGED, MAGIC
};

View File

@@ -40,8 +40,7 @@ import net.runelite.client.plugins.itemstats.StatsChanges;
@RequiredArgsConstructor
public class SuperRestore implements Effect
{
private static final Stat[] superRestoreStats = new Stat[]
{
private static final Stat[] superRestoreStats = {
ATTACK, DEFENCE, STRENGTH, RANGED, MAGIC, COOKING,
WOODCUTTING, FLETCHING, FISHING, FIREMAKING, CRAFTING, SMITHING, MINING,
HERBLORE, AGILITY, THIEVING, SLAYER, FARMING, RUNECRAFT, HUNTER,

View File

@@ -34,7 +34,7 @@ import net.runelite.client.ui.FontManager;
class BookPanel extends JPanel
{
private JLabel location = new JLabel();
private final JLabel location = new JLabel();
BookPanel(Book b)
{

View File

@@ -274,7 +274,7 @@ class Library
assert bookSequence >= 0;
bookcaseIndex -= step * bookSequence;
for (; bookcaseIndex < 0; )
while (bookcaseIndex < 0)
{
bookcaseIndex += byIndex.size();
}

View File

@@ -80,8 +80,8 @@ class LootTrackerBox extends JPanel
private final List<LootTrackerItem> items = new ArrayList<>();
private long totalPrice;
private boolean hideIgnoredItems;
private BiConsumer<String, Boolean> onItemToggle;
private final boolean hideIgnoredItems;
private final BiConsumer<String, Boolean> onItemToggle;
LootTrackerBox(
final ItemManager itemManager,

View File

@@ -64,7 +64,6 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemVariationMapping;
import net.runelite.client.input.KeyManager;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption;
import net.runelite.client.plugins.Plugin;
@@ -134,9 +133,6 @@ public class MenuEntrySwapperPlugin extends Plugin
@Inject
private ConfigManager configManager;
@Inject
private KeyManager keyManager;
@Inject
private MenuManager menuManager;
@@ -812,7 +808,7 @@ public class MenuEntrySwapperPlugin extends Plugin
sortedInsert(list2, index1);
}
private static <T extends Comparable<? super T>> void sortedInsert(List<T> list, T value)
private static <T extends Comparable<? super T>> void sortedInsert(List<T> list, T value) // NOPMD: UnusedPrivateMethod: false positive
{
int idx = Collections.binarySearch(list, value);
list.add(idx < 0 ? -idx - 1 : idx, value);

View File

@@ -78,7 +78,6 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry;
@PluginDependency(XpTrackerPlugin.class)
public class MiningPlugin extends Plugin
{
private static final int ROCK_DISTANCE = 14;
private static final Pattern MINING_PATERN = Pattern.compile(
"You " +
"(?:manage to|just)" +

View File

@@ -28,7 +28,6 @@ import com.google.inject.Provides;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.plugins.Plugin;
@@ -46,9 +45,6 @@ import net.runelite.client.ui.overlay.OverlayManager;
)
public class MTAPlugin extends Plugin
{
@Inject
private Client client;
@Inject
private OverlayManager overlayManager;

View File

@@ -63,7 +63,6 @@ import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -107,9 +106,6 @@ public class NpcIndicatorsPlugin extends Plugin
@Inject
private NpcMinimapOverlay npcMinimapOverlay;
@Inject
private KeyManager keyManager;
@Inject
private ClientThread clientThread;

View File

@@ -29,7 +29,6 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.NPC;
import net.runelite.api.NPCComposition;
import net.runelite.api.Point;
@@ -40,14 +39,12 @@ import net.runelite.client.ui.overlay.OverlayUtil;
public class NpcMinimapOverlay extends Overlay
{
private final Client client;
private final NpcIndicatorsConfig config;
private final NpcIndicatorsPlugin plugin;
@Inject
NpcMinimapOverlay(Client client, NpcIndicatorsConfig config, NpcIndicatorsPlugin plugin)
NpcMinimapOverlay(NpcIndicatorsConfig config, NpcIndicatorsPlugin plugin)
{
this.client = client;
this.config = config;
this.plugin = plugin;
setPosition(OverlayPosition.DYNAMIC);

View File

@@ -71,7 +71,6 @@ import net.runelite.api.events.WallObjectDespawned;
import net.runelite.api.events.WallObjectSpawned;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -106,9 +105,6 @@ public class ObjectIndicatorsPlugin extends Plugin
@Inject
private ObjectIndicatorsOverlay overlay;
@Inject
private KeyManager keyManager;
@Inject
private ObjectIndicatorsConfig config;

View File

@@ -33,7 +33,6 @@ import java.awt.Point;
import java.awt.Rectangle;
import javax.inject.Inject;
import net.runelite.api.Actor;
import net.runelite.api.Client;
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
import net.runelite.api.NPC;
import net.runelite.api.Player;
@@ -55,7 +54,6 @@ class OpponentInfoOverlay extends OverlayPanel
private static final Color HP_GREEN = new Color(0, 146, 54, 230);
private static final Color HP_RED = new Color(102, 15, 16, 230);
private final Client client;
private final OpponentInfoPlugin opponentInfoPlugin;
private final OpponentInfoConfig opponentInfoConfig;
private final HiscoreManager hiscoreManager;
@@ -68,14 +66,12 @@ class OpponentInfoOverlay extends OverlayPanel
@Inject
private OpponentInfoOverlay(
Client client,
OpponentInfoPlugin opponentInfoPlugin,
OpponentInfoConfig opponentInfoConfig,
HiscoreManager hiscoreManager,
NPCManager npcManager)
{
super(opponentInfoPlugin);
this.client = client;
this.opponentInfoPlugin = opponentInfoPlugin;
this.opponentInfoConfig = opponentInfoConfig;
this.hiscoreManager = hiscoreManager;

View File

@@ -54,7 +54,7 @@ class PlayerComparisonOverlay extends Overlay
private static final Color NEUTRAL_TEXT_COLOR = Color.WHITE;
private static final Color HIGHLIGHT_COLOR = new Color(255, 200, 0, 255);
private static final Skill[] COMBAT_SKILLS = new Skill[]{
private static final Skill[] COMBAT_SKILLS = {
Skill.ATTACK,
Skill.STRENGTH,
Skill.DEFENCE,
@@ -64,7 +64,7 @@ class PlayerComparisonOverlay extends Overlay
Skill.PRAYER
};
private static final HiscoreSkill[] HISCORE_COMBAT_SKILLS = new HiscoreSkill[]{
private static final HiscoreSkill[] HISCORE_COMBAT_SKILLS = {
HiscoreSkill.ATTACK,
HiscoreSkill.STRENGTH,
HiscoreSkill.DEFENCE,

View File

@@ -60,7 +60,6 @@ import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.events.PartyChanged;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.party.data.PartyData;
@@ -104,9 +103,6 @@ public class PartyPlugin extends Plugin
@Inject
private PartyPingOverlay partyPingOverlay;
@Inject
private KeyManager keyManager;
@Inject
private WSClient wsClient;

View File

@@ -37,7 +37,7 @@ class PartyWorldMapPoint extends WorldMapPoint
private static final BufferedImage ARROW = ImageUtil.getResourceStreamFromClass(PartyWorldMapPoint.class, "/util/clue_arrow.png");
private BufferedImage partyImage;
private PartyMember member;
private final PartyMember member;
PartyWorldMapPoint(WorldPoint worldPoint, PartyMember member)
{

View File

@@ -34,7 +34,6 @@ import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.NPC;
import net.runelite.api.NpcID;
@@ -70,9 +69,6 @@ public class PestControlPlugin extends Plugin
@Inject
private OverlayManager overlayManager;
@Inject
private Client client;
@Inject
private PestControlOverlay overlay;

View File

@@ -40,8 +40,7 @@ import net.runelite.client.ui.overlay.OverlayPosition;
public class PohOverlay extends Overlay
{
private static final PohIcons[] PORTALS = new PohIcons[]
{
private static final PohIcons[] PORTALS = {
PohIcons.LUMBRIDGE, PohIcons.FALADOR, PohIcons.VARROCK, PohIcons.CAMELOT, PohIcons.ARDOUGNE,
PohIcons.YANILLE, PohIcons.LUNARISLE, PohIcons.WATERBIRTH, PohIcons.FISHINGGUILD,
PohIcons.SENNTISTEN, PohIcons.KHARYLL, PohIcons.ANNAKARL, PohIcons.KOUREND, PohIcons.MARIM,

View File

@@ -37,8 +37,8 @@ public class PuzzleSolver implements Runnable
private static final Duration MAX_WAIT_DURATION = Duration.ofMillis(1500);
private Pathfinder pathfinder;
private PuzzleState startState;
private final Pathfinder pathfinder;
private final PuzzleState startState;
private List<PuzzleState> solution;
private int position;

View File

@@ -38,9 +38,9 @@ import net.runelite.client.plugins.puzzlesolver.solver.heuristics.Heuristic;
public class IDAStarMM extends IDAStar
{
private PuzzleState currentState;
private List<PuzzleState> stateList = new ArrayList<>();
private List<List<Integer>> validRowNumbers = new ArrayList<>();
private List<List<Integer>> validColumnNumbers = new ArrayList<>();
private final List<PuzzleState> stateList = new ArrayList<>();
private final List<List<Integer>> validRowNumbers = new ArrayList<>();
private final List<List<Integer>> validColumnNumbers = new ArrayList<>();
public IDAStarMM(Heuristic heuristic)
{

View File

@@ -31,7 +31,7 @@ import net.runelite.client.plugins.puzzlesolver.solver.heuristics.Heuristic;
public abstract class Pathfinder
{
private Heuristic heuristic;
private final Heuristic heuristic;
Pathfinder(Heuristic heuristic)
{

View File

@@ -49,24 +49,22 @@ import net.runelite.http.api.worlds.World;
import net.runelite.http.api.worlds.WorldRegion;
import net.runelite.http.api.worlds.WorldResult;
public class RaidsOverlay extends OverlayPanel
class RaidsOverlay extends OverlayPanel
{
private static final int OLM_PLANE = 0;
static final String BROADCAST_ACTION = "Broadcast layout";
static final String SCREENSHOT_ACTION = "Screenshot";
private Client client;
private RaidsPlugin plugin;
private RaidsConfig config;
private final Client client;
private final RaidsPlugin plugin;
private final RaidsConfig config;
private final WorldService worldService;
@Getter
private boolean scoutOverlayShown = false;
@Inject
private WorldService worldService;
@Inject
private RaidsOverlay(Client client, RaidsPlugin plugin, RaidsConfig config)
private RaidsOverlay(Client client, RaidsPlugin plugin, RaidsConfig config, WorldService worldService)
{
super(plugin);
setPosition(OverlayPosition.TOP_LEFT);
@@ -74,6 +72,7 @@ public class RaidsOverlay extends OverlayPanel
this.client = client;
this.plugin = plugin;
this.config = config;
this.worldService = worldService;
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay"));
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, BROADCAST_ACTION, "Raids overlay"));
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, SCREENSHOT_ACTION, "Raids overlay"));

View File

@@ -177,16 +177,16 @@ public class RaidsPlugin extends Plugin
private EventBus eventBus;
@Getter
private final Set<String> roomWhitelist = new HashSet<String>();
private final Set<String> roomWhitelist = new HashSet<>();
@Getter
private final Set<String> roomBlacklist = new HashSet<String>();
private final Set<String> roomBlacklist = new HashSet<>();
@Getter
private final Set<String> rotationWhitelist = new HashSet<String>();
private final Set<String> rotationWhitelist = new HashSet<>();
@Getter
private final Set<String> layoutWhitelist = new HashSet<String>();
private final Set<String> layoutWhitelist = new HashSet<>();
@Setter(AccessLevel.PACKAGE) // for the test
@Getter

View File

@@ -41,7 +41,7 @@ import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
public class RegenMeterOverlay extends Overlay
class RegenMeterOverlay extends Overlay
{
private static final Color HITPOINTS_COLOR = brighter(0x9B0703);
private static final Color SPECIAL_COLOR = brighter(0x1E95B0);
@@ -50,8 +50,8 @@ public class RegenMeterOverlay extends Overlay
private static final int OFFSET = 27;
private final Client client;
private RegenMeterPlugin plugin;
private RegenMeterConfig config;
private final RegenMeterPlugin plugin;
private final RegenMeterConfig config;
private static Color brighter(int color)
{

View File

@@ -28,7 +28,6 @@ import java.util.HashMap;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.InventoryID;
import net.runelite.api.ItemContainer;
@@ -64,9 +63,6 @@ public class RoguesDenPlugin extends Plugin
@Getter(AccessLevel.PACKAGE)
private boolean hasGem;
@Inject
private Client client;
@Inject
private OverlayManager overlayManager;

View File

@@ -34,9 +34,9 @@ import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
public class ScreenMarkerCreationOverlay extends Overlay
class ScreenMarkerCreationOverlay extends Overlay
{
private ScreenMarkerPlugin plugin;
private final ScreenMarkerPlugin plugin;
@Inject
private ScreenMarkerCreationOverlay(final ScreenMarkerPlugin plugin)

View File

@@ -65,7 +65,6 @@ import static net.runelite.api.widgets.WidgetID.LEVEL_UP_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.QUEST_COMPLETED_GROUP_ID;
import static net.runelite.api.widgets.WidgetID.THEATRE_OF_BLOOD_REWARD_GROUP_ID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier;
import static net.runelite.client.RuneLite.SCREENSHOT_DIR;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@@ -134,9 +133,6 @@ public class ScreenshotPlugin extends Plugin
@Inject
private ScreenshotOverlay screenshotOverlay;
@Inject
private Notifier notifier;
@Inject
private Client client;

View File

@@ -25,6 +25,7 @@
package net.runelite.client.plugins.skillcalculator;
import com.google.gson.Gson;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
@@ -43,10 +44,16 @@ class CacheSkillData
return cache.get(dataFile);
}
InputStream skillDataFile = SkillCalculatorPlugin.class.getResourceAsStream(dataFile);
SkillData skillData = new Gson().fromJson(new InputStreamReader(skillDataFile, StandardCharsets.UTF_8), SkillData.class);
try (InputStream skillDataFile = SkillCalculatorPlugin.class.getResourceAsStream(dataFile))
{
SkillData skillData = new Gson().fromJson(new InputStreamReader(skillDataFile, StandardCharsets.UTF_8), SkillData.class);
cache.put(dataFile, skillData);
return skillData;
cache.put(dataFile, skillData);
return skillData;
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
}

View File

@@ -110,7 +110,7 @@ class Skybox
{
m.reset(line);
int end = 0;
for (; end < line.length(); )
while (end < line.length())
{
m.region(end, line.length());
if (!m.find())
@@ -378,9 +378,6 @@ class Skybox
x /= 8.d;
y /= 8.d;
int cx = (int) x;
int cy = (int) y;
int centerChunkData = chunkData(px / 8, py / 8, plane, chunkMapper);
if (centerChunkData == -1)
{

View File

@@ -213,7 +213,7 @@ public class SlayerPlugin extends Plugin
private int cachedXp = -1;
private Instant infoTimer;
private boolean loginFlag;
private List<String> targetNames = new ArrayList<>();
private final List<String> targetNames = new ArrayList<>();
@Override
protected void startUp() throws Exception

View File

@@ -33,15 +33,13 @@ import net.runelite.client.ui.overlay.infobox.Counter;
class SpecialCounter extends Counter
{
private final SpecialCounterPlugin plugin;
private SpecialWeapon weapon;
private final SpecialWeapon weapon;
@Getter(AccessLevel.PACKAGE)
private final Map<String, Integer> partySpecs = new HashMap<>();
SpecialCounter(BufferedImage image, SpecialCounterPlugin plugin, int hitValue, SpecialWeapon weapon)
{
super(image, plugin, hitValue);
this.plugin = plugin;
this.weapon = weapon;
}

View File

@@ -166,7 +166,6 @@ public class SpecialCounterPlugin extends Plugin
{
Actor target = hitsplatApplied.getActor();
Hitsplat hitsplat = hitsplatApplied.getHitsplat();
Hitsplat.HitsplatType hitsplatType = hitsplat.getHitsplatType();
// Ignore all hitsplats other than mine
if (!hitsplat.isMine() || target == client.getLocalPlayer())
{

View File

@@ -27,7 +27,7 @@ package net.runelite.client.plugins.statusbars;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.plugins.statusbars.Config.BarMode;
import net.runelite.client.plugins.statusbars.config.BarMode;
@ConfigGroup("statusbars")
public interface StatusBarsConfig extends Config

View File

@@ -49,7 +49,7 @@ import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.itemstats.Effect;
import net.runelite.client.plugins.itemstats.ItemStatChangesService;
import net.runelite.client.plugins.itemstats.StatChange;
import net.runelite.client.plugins.statusbars.Config.BarMode;
import net.runelite.client.plugins.statusbars.config.BarMode;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;

View File

@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.statusbars.Config;
package net.runelite.client.plugins.statusbars.config;
public enum BarMode
{

View File

@@ -91,8 +91,8 @@ public class TearsOfGuthixPlugin extends Plugin
{
DecorativeObject object = event.getDecorativeObject();
if (event.getDecorativeObject().getId() == ObjectID.BLUE_TEARS ||
event.getDecorativeObject().getId() == ObjectID.BLUE_TEARS_6665)
if (object.getId() == ObjectID.BLUE_TEARS ||
object.getId() == ObjectID.BLUE_TEARS_6665)
{
if (client.getLocalPlayer().getWorldLocation().getRegionID() == TOG_REGION)
{

View File

@@ -24,7 +24,6 @@
*/
package net.runelite.client.plugins.timetracking;
import java.awt.Dimension;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.TextStyle;
@@ -46,12 +45,6 @@ public abstract class TabContentPanel extends JPanel
public abstract void update();
@Override
public Dimension getPreferredSize()
{
return super.getPreferredSize();
}
public static String getFormattedEstimate(long remainingSeconds, TimeFormatMode mode)
{
DateTimeFormatter formatter = getDateTimeFormatter(mode);

View File

@@ -54,8 +54,6 @@ import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.JagexColors;
@@ -77,9 +75,6 @@ public class WikiPlugin extends Plugin
private static final String MENUOP_WIKI = "Wiki";
@Inject
private SpriteManager spriteManager;
@Inject
private WikiConfig config;
@@ -89,9 +84,6 @@ public class WikiPlugin extends Plugin
@Inject
private Client client;
@Inject
private ChatboxPanelManager chatboxPanelManager;
@Inject
private ItemManager itemManager;

View File

@@ -67,7 +67,6 @@ public class WikiSearchChatboxTextInput extends ChatboxTextInput
private static final int PREDICTION_DEBOUNCE_DELAY_MS = 200;
private final ChatboxPanelManager chatboxPanelManager;
private final OkHttpClient okHttpClient;
private final Gson gson = new Gson();
private Future<?> runningRequest = null;
@@ -83,7 +82,6 @@ public class WikiSearchChatboxTextInput extends ChatboxTextInput
{
super(chatboxPanelManager, clientThread);
this.chatboxPanelManager = chatboxPanelManager;
this.okHttpClient = okHttpClient;
lines(1);
prompt("OSRS Wiki Search");
@@ -138,7 +136,7 @@ public class WikiSearchChatboxTextInput extends ChatboxTextInput
public void onResponse(Call call, Response response) throws IOException
{
String body = response.body().string();
try
try // NOPMD: UseTryWithResources
{
JsonArray jar = new JsonParser().parse(body).getAsJsonArray();
List<String> apredictions = gson.fromJson(jar.get(1), new TypeToken<List<String>>()

View File

@@ -65,7 +65,6 @@ import net.runelite.api.events.PlayerMenuOptionClicked;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.events.WorldListLoad;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.chat.ChatColorType;
import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager;
@@ -112,9 +111,6 @@ public class WorldHopperPlugin extends Plugin
@Inject
private Client client;
@Inject
private ClientThread clientThread;
@Inject
private ConfigManager configManager;

View File

@@ -63,8 +63,8 @@ class WorldSwitcherPanel extends PluginPanel
private WorldOrder orderIndex = WorldOrder.WORLD;
private boolean ascendingOrder = true;
private ArrayList<WorldTableRow> rows = new ArrayList<>();
private WorldHopperPlugin plugin;
private final ArrayList<WorldTableRow> rows = new ArrayList<>();
private final WorldHopperPlugin plugin;
@Setter(AccessLevel.PACKAGE)
private SubscriptionFilterMode filterMode;

View File

@@ -78,7 +78,7 @@ class WorldTableRow extends JPanel
private JLabel playerCountField;
private JLabel activityField;
private JLabel pingField;
private BiConsumer<World, Boolean> onFavorite;
private final BiConsumer<World, Boolean> onFavorite;
@Getter
private final World world;
@@ -89,11 +89,9 @@ class WorldTableRow extends JPanel
private int ping;
private Color lastBackground;
private boolean current;
WorldTableRow(World world, boolean current, boolean favorite, Integer ping, Consumer<World> onSelect, BiConsumer<World, Boolean> onFavorite)
{
this.current = current;
this.world = world;
this.onFavorite = onFavorite;
this.updatedPlayerCount = world.getPlayers();

View File

@@ -424,11 +424,11 @@ public class WorldMapPlugin extends Plugin
// Get first uncompleted quest. Else, return the last quest.
Quest quest = null;
for (int i = 0; i < quests.length; i++)
for (Quest q : quests)
{
if (quests[i].getState(client) != QuestState.FINISHED)
if (q.getState(client) != QuestState.FINISHED)
{
quest = quests[i];
quest = q;
break;
}
}

View File

@@ -33,7 +33,6 @@ import java.util.Comparator;
import java.util.List;
import javax.inject.Inject;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.Experience;
import net.runelite.api.MenuAction;
import net.runelite.api.Skill;
@@ -65,9 +64,6 @@ public class XpGlobesPlugin extends Plugin
@Getter
private final List<XpGlobe> xpGlobes = new ArrayList<>();
@Inject
private Client client;
@Inject
private XpGlobesConfig config;

View File

@@ -48,7 +48,7 @@ class ClientConfigLoader
final RSConfig config = new RSConfig();
try (final Response response = okHttpClient.newCall(request).execute())
try (Response response = okHttpClient.newCall(request).execute())
{
if (!response.isSuccessful())
{

View File

@@ -71,7 +71,7 @@ class TeeInputStream extends FilterInputStream
{
byte[] buf = new byte[(int) Math.min(n, 0x4000)];
long total = 0;
for (; n > 0; )
while (n > 0)
{
int read = (int) Math.min(n, buf.length);

View File

@@ -109,8 +109,6 @@ public class ClientUI
private static final String CONFIG_CLIENT_BOUNDS = "clientBounds";
private static final String CONFIG_CLIENT_MAXIMIZED = "clientMaximized";
private static final String CONFIG_CLIENT_SIDEBAR_CLOSED = "clientSidebarClosed";
private static final int CLIENT_WELL_HIDDEN_MARGIN = 160;
private static final int CLIENT_WELL_HIDDEN_MARGIN_TOP = 10;
public static final BufferedImage ICON = ImageUtil.getResourceStreamFromClass(ClientUI.class, "/runelite.png");
@Getter

Some files were not shown because too many files have changed in this diff Show More