Merge remote-tracking branch 'Owain/modernizer'

This commit is contained in:
Owain van Brakel
2020-04-08 18:34:23 +02:00
14 changed files with 36 additions and 34 deletions

View File

@@ -27,7 +27,6 @@ package net.runelite.client.chat;
import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import java.awt.Color;
import java.util.Arrays;
@@ -59,7 +58,7 @@ import net.runelite.client.util.ColorUtil;
@Singleton
public class ChatMessageManager
{
private static final Set<Integer> TUTORIAL_ISLAND_REGIONS = ImmutableSet.of(12336, 12335, 12592, 12080, 12079, 12436);
private static final Set<Integer> TUTORIAL_ISLAND_REGIONS = Set.of(12336, 12335, 12592, 12080, 12079, 12436);
private final Multimap<ChatMessageType, ChatColor> colorCache = HashMultimap.create();
private final Client client;
@@ -593,7 +592,7 @@ public class ChatMessageManager
// Update the message with RuneLite additions
line.setRuneLiteFormatMessage(message.getRuneLiteFormattedMessage());
if (message.getTimestamp() != 0)
{
line.setTimestamp(message.getTimestamp());

View File

@@ -26,7 +26,6 @@ package net.runelite.client.config;
import com.google.common.base.Strings;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableMap;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
@@ -384,7 +383,7 @@ public class ConfigManager
return;
}
@SuppressWarnings("unchecked") final Map<String, String> copy = (Map) ImmutableMap.copyOf(this.properties);
@SuppressWarnings("unchecked") final Map<String, String> copy = (Map) Map.copyOf(this.properties);
copy.forEach((groupAndKey, value) ->
{
if (!properties.containsKey(groupAndKey))
@@ -443,7 +442,7 @@ public class ConfigManager
try
{
@SuppressWarnings("unchecked") Map<String, String> copy = (Map) ImmutableMap.copyOf(properties);
@SuppressWarnings("unchecked") Map<String, String> copy = (Map) Map.copyOf(properties);
copy.forEach((groupAndKey, value) ->
{
final String[] split = groupAndKey.split("\\.", 2);

View File

@@ -137,7 +137,7 @@ public class ItemManager
private final LoadingCache<Integer, ItemDefinition> itemDefinitions;
private final LoadingCache<OutlineKey, BufferedImage> itemOutlines;
private Map<Integer, ItemPrice> itemPrices = Collections.emptyMap();
private ImmutableMap<Integer, ItemStats> itemStats = ImmutableMap.of();
private Map<Integer, ItemStats> itemStats = Map.of();
@Inject
public ItemManager(

View File

@@ -88,7 +88,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
@Getter
private int lines;
private StringBuffer value = new StringBuffer();
private StringBuilder value = new StringBuilder();
@Getter
private int cursorStart = 0;
@@ -157,7 +157,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
public ChatboxTextInput value(String value)
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
for (char c : value.toCharArray())
{
if (charValidator.test(c))

View File

@@ -25,7 +25,6 @@
*/
package net.runelite.client.menus;
import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
@@ -39,6 +38,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
@@ -327,7 +327,7 @@ public class MenuManager
public void addPlayerMenuItem(String menuText)
{
Preconditions.checkNotNull(menuText);
Objects.requireNonNull(menuText);
int playerMenuIndex = findEmptyPlayerMenuIndex();
if (playerMenuIndex == IDX_UPPER)
@@ -340,7 +340,8 @@ public class MenuManager
public void removePlayerMenuItem(String menuText)
{
Preconditions.checkNotNull(menuText);
Objects.requireNonNull(menuText);
for (Map.Entry<Integer, String> entry : playerMenuIndexMap.entrySet())
{
if (entry.getValue().equalsIgnoreCase(menuText))

View File

@@ -24,7 +24,6 @@
*/
package net.runelite.client.plugins;
import com.google.common.collect.ImmutableList;
import com.google.inject.Binder;
import com.google.inject.CreationException;
import com.google.inject.Injector;
@@ -913,7 +912,7 @@ public class ExternalPluginManager
private Path stopPlugin(String pluginId)
{
List<PluginWrapper> startedPlugins = ImmutableList.copyOf(getStartedPlugins());
List<PluginWrapper> startedPlugins = List.copyOf(getStartedPlugins());
for (PluginWrapper pluginWrapper : startedPlugins)
{
@@ -1138,7 +1137,7 @@ public class ExternalPluginManager
externalPluginManager.loadPlugins();
externalPluginManager.startPlugin(pluginId);
List<PluginWrapper> startedPlugins = ImmutableList.copyOf(getStartedPlugins());
List<PluginWrapper> startedPlugins = List.copyOf(getStartedPlugins());
List<Plugin> scannedPlugins = new ArrayList<>();
for (PluginWrapper pluginWrapper : startedPlugins)
@@ -1181,7 +1180,7 @@ public class ExternalPluginManager
externalPluginManager.loadPlugins();
externalPluginManager.startPlugin(pluginId);
List<PluginWrapper> startedPlugins = ImmutableList.copyOf(getStartedPlugins());
List<PluginWrapper> startedPlugins = List.copyOf(getStartedPlugins());
List<Plugin> scannedPlugins = new ArrayList<>();
for (PluginWrapper pluginWrapper : startedPlugins)

View File

@@ -24,7 +24,6 @@
*/
package net.runelite.client.plugins.config;
import com.google.common.collect.ImmutableList;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@@ -105,7 +104,7 @@ public class PluginListPanel extends PluginPanel
private static final String PINNED_PLUGINS_CONFIG_KEY = "pinnedPlugins";
private static final List<String> colorOptions = Arrays.asList("enabledColors", "pvmColor", "pvpColor", "skillingColor", "utilityColor", "minigameColor", "miscellaneousColor", "gamemodeColor");
private static final ImmutableList<PluginType> definedOrder = ImmutableList.of(PluginType.IMPORTANT, PluginType.PVM, PluginType.SKILLING, PluginType.PVP, PluginType.UTILITY, PluginType.MINIGAME, PluginType.MISCELLANEOUS, PluginType.GAMEMODE, PluginType.EXTERNAL, PluginType.UNCATEGORIZED);
private static final List<PluginType> definedOrder = List.of(PluginType.IMPORTANT, PluginType.PVM, PluginType.SKILLING, PluginType.PVP, PluginType.UTILITY, PluginType.MINIGAME, PluginType.MISCELLANEOUS, PluginType.GAMEMODE, PluginType.EXTERNAL, PluginType.UNCATEGORIZED);
private static final Comparator<PluginListItem> categoryComparator = Comparator.comparing(plugin -> definedOrder.indexOf(plugin.getPluginType()));
private final ConfigManager configManager;

View File

@@ -24,7 +24,6 @@
*/
package net.runelite.client.ui.overlay.infobox;
import com.google.common.base.Preconditions;
import com.google.common.collect.ComparisonChain;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
@@ -32,6 +31,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -67,7 +67,7 @@ public class InfoBoxManager
public void addInfoBox(InfoBox infoBox)
{
Preconditions.checkNotNull(infoBox);
Objects.requireNonNull(infoBox);
log.debug("Adding InfoBox {}", infoBox);
updateInfoBoxImage(infoBox);

View File

@@ -34,23 +34,23 @@ public class WildcardMatcher
public static boolean matches(String pattern, String text)
{
final Matcher matcher = WILDCARD_PATTERN.matcher(pattern);
final StringBuffer buffer = new StringBuffer();
final StringBuilder sb = new StringBuilder();
buffer.append("(?i)");
sb.append("(?i)");
while (matcher.find())
{
if (matcher.group(1) != null)
{
matcher.appendReplacement(buffer, ".*");
matcher.appendReplacement(sb, ".*");
}
else
{
matcher.appendReplacement(buffer, "\\\\Q" + matcher.group(0) + "\\\\E");
matcher.appendReplacement(sb, "\\\\Q" + matcher.group(0) + "\\\\E");
}
}
matcher.appendTail(buffer);
final String replaced = buffer.toString();
matcher.appendTail(sb);
final String replaced = sb.toString();
return text.matches(replaced);
}