client: make error logging opt out (#1953)

client: make error logging opt out
This commit is contained in:
Owain van Brakel
2019-11-08 15:57:46 +01:00
committed by GitHub
33 changed files with 197 additions and 13 deletions

View File

@@ -52,7 +52,7 @@ dependencies {
} }
tasks { tasks {
"processTestResources"(ProcessResources::class) { processTestResources {
val tokens = mapOf( val tokens = mapOf(
"rs.version" to ProjectVersions.rsversion.toString(), "rs.version" to ProjectVersions.rsversion.toString(),
"cache.version" to ProjectVersions.cacheversion.toString() "cache.version" to ProjectVersions.cacheversion.toString()

View File

@@ -59,7 +59,7 @@ tasks {
"rs.client" to deobjars.find { it.name.startsWith("runescape-client") }.toString().replace("\\", "/") "rs.client" to deobjars.find { it.name.startsWith("runescape-client") }.toString().replace("\\", "/")
) )
"processResources"(ProcessResources::class) { processResources {
inputs.properties(tokens) inputs.properties(tokens)
from("src/main/resources") { from("src/main/resources") {
@@ -69,7 +69,7 @@ tasks {
} }
} }
"processTestResources"(ProcessResources::class) { processTestResources {
inputs.properties(tokens) inputs.properties(tokens)
from("src/test/resources") { from("src/test/resources") {

View File

@@ -47,7 +47,7 @@ dependencies {
} }
tasks { tasks {
"processResources"(ProcessResources::class) { processResources {
val tokens = mapOf( val tokens = mapOf(
"projectver" to ProjectVersions.rlVersion, "projectver" to ProjectVersions.rlVersion,
"rsver" to ProjectVersions.rsversion.toString(), "rsver" to ProjectVersions.rsversion.toString(),

View File

@@ -106,18 +106,27 @@ fun formatDate(date: Date?) = with(date ?: Date()) {
SimpleDateFormat("MM-dd-yyyy").format(this) SimpleDateFormat("MM-dd-yyyy").format(this)
} }
fun launcherVersion(): String {
if (project.hasProperty("releaseBuild")) {
return ProjectVersions.launcherVersion
}
return "-1"
}
tasks { tasks {
build { build {
finalizedBy("shadowJar") finalizedBy("shadowJar")
} }
"processResources"(ProcessResources::class) { processResources {
val tokens = mapOf( val tokens = mapOf(
"project.version" to ProjectVersions.rlVersion, "project.version" to ProjectVersions.rlVersion,
"rs.version" to ProjectVersions.rsversion.toString(), "rs.version" to ProjectVersions.rsversion.toString(),
"open.osrs.version" to ProjectVersions.openosrsVersion, "open.osrs.version" to ProjectVersions.openosrsVersion,
"open.osrs.builddate" to formatDate(Date()), "open.osrs.builddate" to formatDate(Date()),
"launcher.version" to ProjectVersions.launcherVersion "launcher.version" to launcherVersion()
) )
inputs.properties(tokens) inputs.properties(tokens)
@@ -130,6 +139,7 @@ tasks {
} }
jar { jar {
manifest { manifest {
attributes(mutableMapOf("Main-Class" to "net.runelite.client.RuneLite")) attributes(mutableMapOf("Main-Class" to "net.runelite.client.RuneLite"))
} }

View File

@@ -27,6 +27,7 @@ package net.runelite.client;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
import javax.annotation.Nullable;
public class RuneLiteProperties public class RuneLiteProperties
{ {
@@ -40,7 +41,7 @@ public class RuneLiteProperties
private static final String GITHUB_LINK = "runelite.github.link"; private static final String GITHUB_LINK = "runelite.github.link";
private static final String WIKI_LINK = "runelite.wiki.link"; private static final String WIKI_LINK = "runelite.wiki.link";
private static final String PATREON_LINK = "runelite.patreon.link"; private static final String PATREON_LINK = "runelite.patreon.link";
private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version"; private static final String LAUNCHER_VERSION_PROPERTY = "launcher.version";
private static final String TROUBLESHOOTING_LINK = "runelite.wiki.troubleshooting.link"; private static final String TROUBLESHOOTING_LINK = "runelite.wiki.troubleshooting.link";
private static final String BUILDING_LINK = "runelite.wiki.building.link"; private static final String BUILDING_LINK = "runelite.wiki.building.link";
private static final String DNS_CHANGE_LINK = "runelite.dnschange.link"; private static final String DNS_CHANGE_LINK = "runelite.dnschange.link";
@@ -129,4 +130,11 @@ public class RuneLiteProperties
{ {
return properties.getProperty(DNS_CHANGE_LINK); return properties.getProperty(DNS_CHANGE_LINK);
} }
@Nullable
public static String getLauncherVersion()
{
String launcherVersion = properties.getProperty(LAUNCHER_VERSION_PROPERTY);
return launcherVersion.equals("-1") ? null : launcherVersion;
}
} }

View File

@@ -50,6 +50,29 @@ public interface OpenOSRSConfig extends Config
} }
} }
@ConfigTitleSection(
keyName = "logTitle",
name = "Error data",
description = "",
position = 1
)
default Title logTitle()
{
return new Title();
}
@ConfigItem(
position = 3,
keyName = "shareLogs",
name = "Anonymous error data",
description = "Share anonymous error data with the OpenOSRS developers",
titleSection = "logTitle"
)
default boolean shareLogs()
{
return true;
}
@ConfigTitleSection( @ConfigTitleSection(
keyName = "pluginsTitle", keyName = "pluginsTitle",
name = "Plugins", name = "Plugins",

View File

@@ -10,9 +10,12 @@ import io.sentry.Sentry;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.api.events.Event; import net.runelite.api.events.Event;
import net.runelite.client.RuneLiteProperties;
import net.runelite.client.config.OpenOSRSConfig;
@Slf4j @Slf4j
@Singleton @Singleton
@@ -22,6 +25,9 @@ public class EventBus implements EventBusInterface
private Map<Class<?>, Relay<Object>> subjectList = new HashMap<>(); private Map<Class<?>, Relay<Object>> subjectList = new HashMap<>();
private Map<Object, CompositeDisposable> subscriptionsMap = new HashMap<>(); private Map<Object, CompositeDisposable> subscriptionsMap = new HashMap<>();
@Inject
private OpenOSRSConfig openOSRSConfig;
@NonNull @NonNull
private <T> Relay<Object> getSubject(Class<T> eventClass) private <T> Relay<Object> getSubject(Class<T> eventClass)
{ {
@@ -53,7 +59,15 @@ public class EventBus implements EventBusInterface
Disposable disposable = getSubject(eventClass) Disposable disposable = getSubject(eventClass)
.filter(Objects::nonNull) // Filter out null objects, better safe than sorry .filter(Objects::nonNull) // Filter out null objects, better safe than sorry
.cast(eventClass) // Cast it for easier usage .cast(eventClass) // Cast it for easier usage
.subscribe(action, Sentry::capture); .subscribe(action, error ->
{
log.error("Exception in eventbus", error);
if (RuneLiteProperties.getLauncherVersion() != null && openOSRSConfig.shareLogs())
{
Sentry.capture(error);
}
});
getCompositeDisposable(lifecycle).add(disposable); getCompositeDisposable(lifecycle).add(disposable);
subscriptionList.put(lifecycle, eventClass); subscriptionList.put(lifecycle, eventClass);
@@ -72,7 +86,15 @@ public class EventBus implements EventBusInterface
.cast(eventClass) // Cast it for easier usage .cast(eventClass) // Cast it for easier usage
.take(takeUntil) .take(takeUntil)
.doFinally(() -> unregister(lifecycle)) .doFinally(() -> unregister(lifecycle))
.subscribe(action, Sentry::capture); .subscribe(action, error ->
{
log.error("Exception in eventbus", error);
if (RuneLiteProperties.getLauncherVersion() != null && openOSRSConfig.shareLogs())
{
Sentry.capture(error);
}
});
getCompositeDisposable(lifecycle).add(disposable); getCompositeDisposable(lifecycle).add(disposable);
subscriptionList.put(lifecycle, eventClass); subscriptionList.put(lifecycle, eventClass);

View File

@@ -359,8 +359,7 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
&& (worldPoint.getY() & (REGION_SIZE - 1)) == objectPoint.getRegionY()) && (worldPoint.getY() & (REGION_SIZE - 1)) == objectPoint.getRegionY())
{ {
// Transform object to get the name which matches against what we've stored // Transform object to get the name which matches against what we've stored
if (getObjectDefinition(object.getId()) != null && if (objectPoint.getName().equals(getObjectDefinition(object.getId()).getName()))
objectPoint.getName().equals(getObjectDefinition(object.getId()).getName()))
{ {
log.debug("Marking object {} due to matching {}", object, objectPoint); log.debug("Marking object {} due to matching {}", object, objectPoint);
objects.add(object); objects.add(object);

View File

@@ -34,6 +34,8 @@ import net.runelite.api.Client;
import net.runelite.api.MessageNode; import net.runelite.api.MessageNode;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.eventbus.EventBus;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -55,6 +57,10 @@ public class ChatMessageManagerTest
@Bind @Bind
private ChatColorConfig chatColorConfig; private ChatColorConfig chatColorConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;

View File

@@ -56,6 +56,10 @@ public class ConfigManagerTest
@Bind @Bind
RuneLiteConfig runeliteConfig; RuneLiteConfig runeliteConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
ConfigManager manager; ConfigManager manager;

View File

@@ -37,6 +37,7 @@ import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@@ -63,6 +64,10 @@ public class AttackStylesPluginTest
@Bind @Bind
AttackStylesConfig attackConfig; AttackStylesConfig attackConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
AttackStylesPlugin attackPlugin; AttackStylesPlugin attackPlugin;

View File

@@ -35,6 +35,7 @@ import net.runelite.api.Item;
import net.runelite.api.ItemContainer; import net.runelite.api.ItemContainer;
import net.runelite.api.ItemDefinition; import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@@ -61,6 +62,10 @@ public class BankPluginTest
@Bind @Bind
private BankConfig bankConfig; private BankConfig bankConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private BankPlugin bankPlugin; private BankPlugin bankPlugin;

View File

@@ -34,6 +34,7 @@ import net.runelite.api.Client;
import net.runelite.api.ItemDefinition; import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager; import net.runelite.client.game.SpriteManager;
@@ -110,6 +111,10 @@ public class ItemValueSearchTest
@Bind @Bind
private ScheduledExecutorService scheduledExecutorService; private ScheduledExecutorService scheduledExecutorService;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -33,6 +33,7 @@ import javax.inject.Inject;
import net.runelite.api.NPC; import net.runelite.api.NPC;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.junit.Before; import org.junit.Before;
@@ -50,6 +51,10 @@ public class CerberusPluginTest
@Bind @Bind
OverlayManager overlayManager; OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
CerberusPlugin cerberusPlugin; CerberusPlugin cerberusPlugin;

View File

@@ -35,6 +35,7 @@ import net.runelite.api.Client;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.OpenOSRSConfig;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -67,6 +68,10 @@ public class ChatCommandsPluginTest
@Bind @Bind
ChatCommandsConfig chatCommandsConfig; ChatCommandsConfig chatCommandsConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
ChatCommandsPlugin chatCommandsPlugin; ChatCommandsPlugin chatCommandsPlugin;

View File

@@ -31,6 +31,7 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.client.config.OpenOSRSConfig;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
@@ -54,6 +55,10 @@ public class ChatFilterPluginTest
@Bind @Bind
private ChatFilterConfig chatFilterConfig; private ChatFilterConfig chatFilterConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Mock @Mock
private Player localPlayer; private Player localPlayer;

View File

@@ -37,6 +37,7 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -66,6 +67,10 @@ public class ChatNotificationsPluginTest
@Bind @Bind
private Notifier notifier; private Notifier notifier;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private ChatNotificationsPlugin chatNotificationsPlugin; private ChatNotificationsPlugin chatNotificationsPlugin;

View File

@@ -34,6 +34,7 @@ import net.runelite.api.GraphicID;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.SpotAnimationChanged; import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -89,6 +90,10 @@ public class CookingPluginTest
@Bind @Bind
OverlayManager overlayManager; OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -36,6 +36,7 @@ import net.runelite.api.MessageNode;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -58,6 +59,10 @@ public class EmojiPluginTest
@Bind @Bind
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private EmojiPlugin emojiPlugin; private EmojiPlugin emojiPlugin;

View File

@@ -38,6 +38,7 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.http.api.examine.ExamineClient; import net.runelite.http.api.examine.ExamineClient;
import org.junit.Before; import org.junit.Before;
@@ -78,6 +79,10 @@ public class ExaminePluginTest
@Bind @Bind
ScheduledExecutorService scheduledExecutorService; ScheduledExecutorService scheduledExecutorService;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -46,6 +46,7 @@ import net.runelite.api.events.GameTick;
import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.InteractingChanged;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.SoundManager; import net.runelite.client.game.SoundManager;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -81,6 +82,10 @@ public class IdleNotifierPluginTest
@Bind @Bind
private Notifier notifier; private Notifier notifier;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private IdleNotifierPlugin plugin; private IdleNotifierPlugin plugin;

View File

@@ -38,6 +38,7 @@ import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import org.junit.Before; import org.junit.Before;
@@ -88,6 +89,10 @@ public class ItemChargePluginTest
@Bind @Bind
private ItemChargeConfig config; private ItemChargeConfig config;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private ItemChargePlugin itemChargePlugin; private ItemChargePlugin itemChargePlugin;

View File

@@ -35,6 +35,7 @@ import net.runelite.api.Client;
import net.runelite.api.Item; import net.runelite.api.Item;
import net.runelite.api.ItemDefinition; import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemReclaimCost; import net.runelite.client.game.ItemReclaimCost;
import static net.runelite.client.plugins.itemskeptondeath.ItemsKeptOnDeathPlugin.DeathItems; import static net.runelite.client.plugins.itemskeptondeath.ItemsKeptOnDeathPlugin.DeathItems;
@@ -60,6 +61,10 @@ public class ItemsKeptOnDeathPluginTest
@Bind @Bind
private ItemManager itemManager; private ItemManager itemManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private ItemsKeptOnDeathPlugin plugin; private ItemsKeptOnDeathPlugin plugin;

View File

@@ -41,6 +41,7 @@ import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -102,6 +103,10 @@ public class MotherlodePluginTest
@Bind @Bind
private Notifier notifier; private Notifier notifier;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -32,6 +32,7 @@ import java.util.List;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.client.config.OpenOSRSConfig;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -54,6 +55,10 @@ public class NpcIndicatorsPluginTest
@Bind @Bind
private NpcIndicatorsConfig npcIndicatorsConfig; private NpcIndicatorsConfig npcIndicatorsConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private NpcIndicatorsPlugin npcIndicatorsPlugin; private NpcIndicatorsPlugin npcIndicatorsPlugin;

View File

@@ -41,6 +41,7 @@ import static net.runelite.api.widgets.WidgetID.LEVEL_UP_GROUP_ID;
import static net.runelite.api.widgets.WidgetInfo.DIALOG_SPRITE_TEXT; import static net.runelite.api.widgets.WidgetInfo.DIALOG_SPRITE_TEXT;
import static net.runelite.api.widgets.WidgetInfo.LEVEL_UP_LEVEL; import static net.runelite.api.widgets.WidgetInfo.LEVEL_UP_LEVEL;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.DrawManager; import net.runelite.client.ui.DrawManager;
@@ -97,6 +98,10 @@ public class ScreenshotPluginTest
@Bind @Bind
ScheduledExecutorService service; ScheduledExecutorService service;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -49,6 +49,7 @@ import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.chat.ChatCommandManager; import net.runelite.client.chat.ChatCommandManager;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -149,6 +150,10 @@ public class SlayerPluginTest
@Bind @Bind
SlayerTaskPanel panel; SlayerTaskPanel panel;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -30,6 +30,7 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.ChatMessageType; import net.runelite.api.ChatMessageType;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
@@ -60,6 +61,10 @@ public class SmeltingPluginTest
@Bind @Bind
OverlayManager overlayManager; OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -33,6 +33,7 @@ import net.runelite.api.ChatMessageType;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.WorldType; import net.runelite.api.WorldType;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager; import net.runelite.client.game.SpriteManager;
import net.runelite.client.ui.overlay.infobox.InfoBox; import net.runelite.client.ui.overlay.infobox.InfoBox;
@@ -77,6 +78,10 @@ public class TimersPluginTest
@Bind @Bind
private InfoBoxManager infoBoxManager; private InfoBoxManager infoBoxManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -31,6 +31,7 @@ import java.util.TimeZone;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ConfigChanged;
import net.runelite.client.config.OpenOSRSConfig;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -50,6 +51,10 @@ public class TimestampPluginTest
@Bind @Bind
TimestampConfig config; TimestampConfig config;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
TimestampPlugin plugin; TimestampPlugin plugin;

View File

@@ -34,6 +34,7 @@ import net.runelite.api.Varbits;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -74,6 +75,10 @@ public class WintertodtPluginTest
@Bind @Bind
Client client; Client client;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -35,6 +35,7 @@ import net.runelite.api.Skill;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.StatChanged; import net.runelite.api.events.StatChanged;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.NPCManager; import net.runelite.client.game.NPCManager;
import net.runelite.client.game.SkillIconManager; import net.runelite.client.game.SkillIconManager;
import net.runelite.client.ui.ClientToolbar; import net.runelite.client.ui.ClientToolbar;
@@ -78,6 +79,10 @@ public class XpTrackerPluginTest
@Bind @Bind
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -33,6 +33,8 @@ dependencies {
implementation(project(":runescape-api")) implementation(project(":runescape-api"))
} }
tasks.withType<JavaCompile> { tasks {
options.compilerArgs.addAll(arrayOf("-source", "7", "-Xlint:-unchecked")) withType<JavaCompile> {
options.compilerArgs.addAll(arrayOf("-source", "7", "-Xlint:-unchecked"))
}
} }