runeliteplus: various checkstyle fixes

This commit is contained in:
Zeruth
2019-07-24 00:41:08 -04:00
parent a51f30da09
commit 13146e5dbd
18 changed files with 95 additions and 118 deletions

View File

@@ -29,6 +29,6 @@ subprojects {
sourceSets = [sourceSets.main] sourceSets = [sourceSets.main]
configFile = rootProject.file("./checkstyle/checkstyle.xml"); configFile = rootProject.file("./checkstyle/checkstyle.xml");
showViolations = true showViolations = true
ignoreFailures = true ignoreFailures = false
} }
} }

View File

@@ -26,7 +26,6 @@ package net.runelite.http.api;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import jdk.nashorn.internal.runtime.linker.Bootstrap;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.Interceptor; import okhttp3.Interceptor;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;

View File

@@ -102,7 +102,9 @@ public class XteaClient
{ {
InputStream in = response.body().byteStream(); InputStream in = response.body().byteStream();
// CHECKSTYLE:OFF // CHECKSTYLE:OFF
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), new TypeToken<List<XteaKey>>() {}.getType()); return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), new TypeToken<List<XteaKey>>()
{
}.getType());
// CHECKSTYLE:ON // CHECKSTYLE:ON
} }
catch (JsonParseException ex) catch (JsonParseException ex)

View File

@@ -25,20 +25,19 @@
package net.runelite.api.events; package net.runelite.api.events;
import net.runelite.api.GrandExchangeOffer; import net.runelite.api.GrandExchangeOffer;
import net.runelite.api.GrandExchangeOfferState;
import lombok.Data; import lombok.Data;
/** /**
* An event where a {@link GrandExchangeOffer} has been updated with * An event where a {GrandExchangeOffer} has been updated with
* new information. * new information.
* <p> * <p>
* When the client initially logs in, this event is called for all grand * When the client initially logs in, this event is called for all grand
* exchange slots with the {@link GrandExchangeOfferState#EMPTY} state, * exchange slots with the {GrandExchangeOfferState#EMPTY} state,
* regardless of whether any slots have offers. Once the exchange is * regardless of whether any slots have offers. Once the exchange is
* initialized, the client then updates any offers with items as it * initialized, the client then updates any offers with items as it
* receives information from the server. * receives information from the server.
* <p> * <p>
* See {@link GrandExchangeOfferState} for potential states an offer * See {GrandExchangeOfferState} for potential states an offer
* can change into. * can change into.
*/ */
@Data @Data

View File

@@ -24,15 +24,13 @@
*/ */
package net.runelite.api.kit; package net.runelite.api.kit;
import net.runelite.api.PlayerAppearance;
/** /**
* Represents an equipment slot in a players composition. * Represents an equipment slot in a players composition.
* <p> * <p>
* These values are intended for use with {@link PlayerAppearance} equipment * These values are intended for use with {PlayerAppearance} equipment
* slots. For obtaining information about equipment in the local players * slots. For obtaining information about equipment in the local players
* equipment {@link net.runelite.api.ItemContainer}, use * equipment {net.runelite.api.ItemContainer}, use
* {@link net.runelite.api.EquipmentInventorySlot}. * {net.runelite.api.EquipmentInventorySlot}.
*/ */
public enum KitType public enum KitType
{ {
@@ -61,7 +59,7 @@ public enum KitType
} }
/** /**
* Gets the raw equipment index for use in {@link PlayerAppearance#getEquipmentIds()}. * Gets the raw equipment index for use in {PlayerAppearance#getEquipmentIds()}.
* *
* @return raw equipment index * @return raw equipment index
*/ */

View File

@@ -24,12 +24,11 @@
*/ */
package net.runelite.api.vars; package net.runelite.api.vars;
import net.runelite.api.VarClientInt;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
/** /**
* An enumeration of input types for {@link VarClientInt#INPUT_TYPE}. * An enumeration of input types for {VarClientInt#INPUT_TYPE}.
*/ */
@Getter @Getter
@RequiredArgsConstructor @RequiredArgsConstructor

View File

@@ -29,7 +29,6 @@ import java.util.Collection;
import net.runelite.api.FontTypeFace; import net.runelite.api.FontTypeFace;
import net.runelite.api.Point; import net.runelite.api.Point;
import net.runelite.api.SpriteID;
/** /**
* Represents an on-screen UI element that is drawn on the canvas. * Represents an on-screen UI element that is drawn on the canvas.
@@ -254,7 +253,7 @@ public interface Widget
* Gets the sprite ID displayed in the widget. * Gets the sprite ID displayed in the widget.
* *
* @return the sprite ID * @return the sprite ID
* @see SpriteID * SpriteID
*/ */
int getSpriteId(); int getSpriteId();
@@ -262,7 +261,7 @@ public interface Widget
* Sets the sprite ID displayed in the widget. * Sets the sprite ID displayed in the widget.
* *
* @param spriteId the sprite ID * @param spriteId the sprite ID
* @see SpriteID * SpriteID
*/ */
void setSpriteId(int spriteId); void setSpriteId(int spriteId);

View File

@@ -24,7 +24,6 @@
*/ */
package net.runelite.client; package net.runelite.client;
import com.google.common.base.Strings;
import com.google.common.escape.Escaper; import com.google.common.escape.Escaper;
import com.google.common.escape.Escapers; import com.google.common.escape.Escapers;
import com.google.inject.Inject; import com.google.inject.Inject;

View File

@@ -76,7 +76,6 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxOverlay;
import net.runelite.client.ui.overlay.tooltip.TooltipOverlay; import net.runelite.client.ui.overlay.tooltip.TooltipOverlay;
import net.runelite.client.ui.overlay.worldmap.WorldMapOverlay; import net.runelite.client.ui.overlay.worldmap.WorldMapOverlay;
import net.runelite.client.ws.PartyService; import net.runelite.client.ws.PartyService;
import net.runelite.http.api.RuneLiteAPI;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@Singleton @Singleton

View File

@@ -24,10 +24,7 @@
*/ */
package net.runelite.client; package net.runelite.client;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@@ -24,14 +24,10 @@
*/ */
package net.runelite.client.game; package net.runelite.client.game;
import net.runelite.api.SpriteID;
public interface SpriteOverride public interface SpriteOverride
{ {
/** /**
* An ID for a sprite. Negative numbers are used by RuneLite specific sprites * An ID for a sprite. Negative numbers are used by RuneLite specific sprites
*
* @see SpriteID
*/ */
int getSpriteId(); int getSpriteId();

View File

@@ -25,13 +25,9 @@
package net.runelite.client.plugins.itemstats.stats; package net.runelite.client.plugins.itemstats.stats;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Skill;
/** /**
* Abstract stat of a player. * Abstract stat of a player.
* This includes {@link Skill}s and other player variables, such as <code>RUN_ENERGY</code>.
*
* @see Stats
*/ */
public abstract class Stat public abstract class Stat
{ {

View File

@@ -9,7 +9,6 @@
package net.runelite.client.plugins.pvptools; package net.runelite.client.plugins.pvptools;
import com.google.common.base.MoreObjects;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Font; import java.awt.Font;
@@ -21,7 +20,6 @@ import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLiteProperties;
import net.runelite.client.plugins.info.JRichTextPane; import net.runelite.client.plugins.info.JRichTextPane;
import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.FontManager; import net.runelite.client.ui.FontManager;

View File

@@ -34,7 +34,6 @@ import java.io.Reader;
import java.util.Arrays; import java.util.Arrays;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.runelite.api.Client;
class Skybox class Skybox
{ {
@@ -43,8 +42,6 @@ class Skybox
{ {
/** /**
* Gets the instance template chunk data for the specified point * Gets the instance template chunk data for the specified point
*
* @see Client#getInstanceTemplateChunks
*/ */
int getTemplateChunk(int cx, int cy, int plane); int getTemplateChunk(int cx, int cy, int plane);
} }

View File

@@ -57,11 +57,11 @@ import net.runelite.client.eventbus.EventBus;
import net.runelite.client.input.MouseManager; import net.runelite.client.input.MouseManager;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption; import net.runelite.client.menus.WidgetMenuOption;
import static net.runelite.client.util.MiscUtils.clamp;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType; import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import static net.runelite.client.util.MiscUtils.clamp;
import net.runelite.client.util.Text; import net.runelite.client.util.Text;
@PluginDescriptor( @PluginDescriptor(
@@ -87,15 +87,7 @@ public class SpellbookPlugin extends Plugin
private static final WidgetMenuOption RESIZABLE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB); private static final WidgetMenuOption RESIZABLE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB);
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_LOCK = new WidgetMenuOption(LOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB); private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_LOCK = new WidgetMenuOption(LOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB);
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB); private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB);
private final Map<Integer, Spell> spells = new HashMap<>();
private enum WordFilterMode
{
CONTAINS,
EQUALS,
STARTSWITH,
ENDSWITH
}
@Inject @Inject
private Client client; private Client client;
@@ -131,19 +123,79 @@ public class SpellbookPlugin extends Plugin
@Getter @Getter
private Point draggingLocation; private Point draggingLocation;
private final Map<Integer, Spell> spells = new HashMap<>();
private Map<Integer, Spell> tmp = null; private Map<Integer, Spell> tmp = null;
private ImmutableSet<String> notFilteredSpells; private ImmutableSet<String> notFilteredSpells;
private Spellbook spellbook; private Spellbook spellbook;
private SpellbookMouseListener mouseListener; private SpellbookMouseListener mouseListener;
private boolean enableMobile; private boolean enableMobile;
private boolean dragSpells; private boolean dragSpells;
private boolean scroll; private boolean scroll;
private int size; private int size;
private String filter; private String filter;
private static boolean isUnfiltered(String spell, Set<String> unfiltereds)
{
for (String str : unfiltereds)
{
WordFilterMode mode = getFilterMode(str);
str = removeFlyingComma(str).toLowerCase();
spell = spell.toLowerCase();
switch (mode)
{
case CONTAINS:
if (spell.contains(str))
{
return true;
}
break;
case STARTSWITH:
if (spell.startsWith(str))
{
return true;
}
break;
case ENDSWITH:
if (spell.endsWith(str))
{
return true;
}
break;
case EQUALS:
if (spell.equals(str))
{
return true;
}
break;
}
}
return false;
}
private static WordFilterMode getFilterMode(String s)
{
if (!s.contains("\""))
{
return WordFilterMode.CONTAINS;
}
if (s.startsWith("\""))
{
return s.endsWith("\"") ? WordFilterMode.EQUALS : WordFilterMode.STARTSWITH;
}
else if (s.endsWith("\""))
{
return WordFilterMode.ENDSWITH;
}
return WordFilterMode.CONTAINS; // but probably null soz
}
private static String removeFlyingComma(String s)
{
return s.replaceAll("\"", "");
}
@Provides @Provides
SpellbookConfig getConfig(ConfigManager configManager) SpellbookConfig getConfig(ConfigManager configManager)
{ {
@@ -223,46 +275,6 @@ public class SpellbookPlugin extends Plugin
} }
} }
private static boolean isUnfiltered(String spell, Set<String> unfiltereds)
{
for (String str : unfiltereds)
{
WordFilterMode mode = getFilterMode(str);
str = removeFlyingComma(str).toLowerCase();
spell = spell.toLowerCase();
switch (mode)
{
case CONTAINS:
if (spell.contains(str))
{
return true;
}
break;
case STARTSWITH:
if (spell.startsWith(str))
{
return true;
}
break;
case ENDSWITH:
if (spell.endsWith(str))
{
return true;
}
break;
case EQUALS:
if (spell.equals(str))
{
return true;
}
break;
}
}
return false;
}
private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{ {
if (event.getWidget() != WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB if (event.getWidget() != WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB
@@ -466,7 +478,9 @@ public class SpellbookPlugin extends Plugin
} }
// CHECKSTYLE:OFF // CHECKSTYLE:OFF
Collection<Spell> gson = GSON.fromJson(cfg, new TypeToken<List<Spell>>() {}.getType()); Collection<Spell> gson = GSON.fromJson(cfg, new TypeToken<List<Spell>>()
{
}.getType());
// CHECKSTYLE:ON // CHECKSTYLE:ON
gson.stream().filter(Objects::nonNull).forEach(s -> spells.put(s.getWidget(), s)); gson.stream().filter(Objects::nonNull).forEach(s -> spells.put(s.getWidget(), s));
@@ -509,24 +523,6 @@ public class SpellbookPlugin extends Plugin
); );
} }
private static WordFilterMode getFilterMode(String s)
{
if (!s.contains("\""))
{
return WordFilterMode.CONTAINS;
}
if (s.startsWith("\""))
{
return s.endsWith("\"") ? WordFilterMode.EQUALS : WordFilterMode.STARTSWITH;
}
else if (s.endsWith("\""))
{
return WordFilterMode.ENDSWITH;
}
return WordFilterMode.CONTAINS; // but probably null soz
}
boolean isNotOnSpellWidget(java.awt.Point point) boolean isNotOnSpellWidget(java.awt.Point point)
{ {
Widget boundsWidget = client.getWidget(WidgetInfo.SPELLBOOK_FILTERED_BOUNDS); Widget boundsWidget = client.getWidget(WidgetInfo.SPELLBOOK_FILTERED_BOUNDS);
@@ -712,11 +708,6 @@ public class SpellbookPlugin extends Plugin
runRebuild(); runRebuild();
} }
private static String removeFlyingComma(String s)
{
return s.replaceAll("\"", "");
}
private int trueSize(Spell s) private int trueSize(Spell s)
{ {
return s.getSize() * 2 + this.size; return s.getSize() * 2 + this.size;
@@ -730,4 +721,12 @@ public class SpellbookPlugin extends Plugin
this.size = config.size(); this.size = config.size();
this.filter = config.filter(); this.filter = config.filter();
} }
private enum WordFilterMode
{
CONTAINS,
EQUALS,
STARTSWITH,
ENDSWITH
}
} }

View File

@@ -2,7 +2,6 @@ package net.runelite.client.util.bootstrap;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
@@ -15,7 +14,7 @@ public class Bootstrapper
public static void main(String[] args) public static void main(String[] args)
{ {
if (args.length>0) if (args.length > 0)
{ {
remoteLocation = "/staging/"; remoteLocation = "/staging/";
localLocation = "./staging/"; localLocation = "./staging/";
@@ -30,7 +29,8 @@ public class Bootstrapper
{ {
e.printStackTrace(); e.printStackTrace();
} }
} else }
else
{ {
remoteLocation = "/live/"; remoteLocation = "/live/";
localLocation = "./live/"; localLocation = "./live/";

View File

@@ -39,7 +39,6 @@ import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.slf4j.Logger;
@Mojo( @Mojo(
name = "assemble", name = "assemble",

View File

@@ -29,5 +29,6 @@
<suppressions> <suppressions>
<suppress files="RuntimeTypeAdapterFactory\.java" checks="[a-zA-Z0-9]*"/> <suppress files="RuntimeTypeAdapterFactory\.java" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]runescape-client[\\/]" checks="[a-zA-Z0-9]*"/> <suppress files="[\\/]runescape-client[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]cache[\\/]" checks="[a-zA-Z0-9]*"/> <suppress files="[\\/]ScriptVarType[\./]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]LayoutSolver[\./]" checks="[a-zA-Z0-9]*"/>
</suppressions> </suppressions>