Fix pluginmanagertest for async subbing (and some enhancements which don't really belong in this pr but shhh about that)

This commit is contained in:
Lucwousin
2019-12-15 21:25:25 +01:00
parent 8724311d20
commit 0c1c461139
3 changed files with 24 additions and 2 deletions

View File

@@ -59,7 +59,7 @@ tasks {
"rs.client" to deobjars.find { it.name.startsWith("runescape-client") }.toString().replace("\\", "/")
)
processResources {
processResources {
finalizedBy("filterResources")
}
@@ -112,3 +112,14 @@ tasks {
main = "net.runelite.deob.updater.UpdateMappings"
}
}
publishing {
repositories {
mavenLocal()
}
publications {
register("asd", MavenPublication::class) {
from(components["java"])
}
}
}

View File

@@ -449,6 +449,10 @@ public class ConfigManager
{
return Integer.parseInt(str);
}
if (type == long.class)
{
return Long.parseLong(str);
}
if (type == Color.class)
{
return ColorUtil.fromString(str);
@@ -615,6 +619,10 @@ public class ConfigManager
{
return ((EnumSet) object).toArray()[0].getClass().getCanonicalName() + "{" + object.toString() + "}";
}
if (object instanceof Number)
{
return String.valueOf(object);
}
return object.toString();
}

View File

@@ -38,6 +38,7 @@ import java.applet.Applet;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
@@ -51,6 +52,7 @@ import net.runelite.client.RuneLite;
import net.runelite.client.RuneLiteModule;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.eventbus.AccessorGenerator;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import static org.junit.Assert.assertEquals;
@@ -218,7 +220,8 @@ public class PluginManagerTest
}
TestPlugin plugin = new TestPlugin();
pluginManager.startPlugin(plugin);
AccessorGenerator.scanSubscribes(MethodHandles.lookup(), plugin)
.forEach(s -> s.subscribe(eventbus, plugin));
eventbus.post(TestEvent.class, new TestEvent());
assert plugin.thisShouldBeTrue;
}