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

@@ -24,7 +24,6 @@
*/
package net.runelite.client;
import com.google.common.base.Strings;
import com.google.common.escape.Escaper;
import com.google.common.escape.Escapers;
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.worldmap.WorldMapOverlay;
import net.runelite.client.ws.PartyService;
import net.runelite.http.api.RuneLiteAPI;
import org.slf4j.LoggerFactory;
@Singleton

View File

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

View File

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

View File

@@ -25,13 +25,9 @@
package net.runelite.client.plugins.itemstats.stats;
import net.runelite.api.Client;
import net.runelite.api.Skill;
/**
* 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
{

View File

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

View File

@@ -34,7 +34,6 @@ import java.io.Reader;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.runelite.api.Client;
class Skybox
{
@@ -43,8 +42,6 @@ class Skybox
{
/**
* Gets the instance template chunk data for the specified point
*
* @see Client#getInstanceTemplateChunks
*/
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.menus.MenuManager;
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.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import static net.runelite.client.util.MiscUtils.clamp;
import net.runelite.client.util.Text;
@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_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 enum WordFilterMode
{
CONTAINS,
EQUALS,
STARTSWITH,
ENDSWITH
}
private final Map<Integer, Spell> spells = new HashMap<>();
@Inject
private Client client;
@@ -131,19 +123,79 @@ public class SpellbookPlugin extends Plugin
@Getter
private Point draggingLocation;
private final Map<Integer, Spell> spells = new HashMap<>();
private Map<Integer, Spell> tmp = null;
private ImmutableSet<String> notFilteredSpells;
private Spellbook spellbook;
private SpellbookMouseListener mouseListener;
private boolean enableMobile;
private boolean dragSpells;
private boolean scroll;
private int size;
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
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)
{
if (event.getWidget() != WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB
@@ -466,7 +478,9 @@ public class SpellbookPlugin extends Plugin
}
// 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
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)
{
Widget boundsWidget = client.getWidget(WidgetInfo.SPELLBOOK_FILTERED_BOUNDS);
@@ -712,11 +708,6 @@ public class SpellbookPlugin extends Plugin
runRebuild();
}
private static String removeFlyingComma(String s)
{
return s.replaceAll("\"", "");
}
private int trueSize(Spell s)
{
return s.getSize() * 2 + this.size;
@@ -730,4 +721,12 @@ public class SpellbookPlugin extends Plugin
this.size = config.size();
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.GsonBuilder;
import java.io.File;
import java.io.FileWriter;
@@ -15,7 +14,7 @@ public class Bootstrapper
public static void main(String[] args)
{
if (args.length>0)
if (args.length > 0)
{
remoteLocation = "/staging/";
localLocation = "./staging/";
@@ -30,7 +29,8 @@ public class Bootstrapper
{
e.printStackTrace();
}
} else
}
else
{
remoteLocation = "/live/";
localLocation = "./live/";