[Fix] IllegalStateException on test, DiscordSRV version

This commit is contained in:
Rsl1122 2018-10-23 13:17:04 +03:00
parent b9027294ef
commit 6cd77fd7fd
4 changed files with 12 additions and 6 deletions

View File

@ -87,7 +87,7 @@
</repository>
<repository>
<id>discordsrv-repo</id>
<url>https://ci.scarsz.me/plugin/repository/everything/</url>
<url>https://nexus.scarsz.me/content/groups/public/</url>
</repository>
</repositories>
@ -183,8 +183,8 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>github.scarsz.discordsrv</groupId>
<artifactId>DiscordSRV</artifactId>
<groupId>com.discordsrv</groupId>
<artifactId>discordsrv</artifactId>
<version>1.16.4</version>
<scope>provided</scope>
</dependency>

View File

@ -23,7 +23,7 @@ public abstract class Hook {
*
* @param pluginClass Class path string of the plugin's main JavaPlugin class.
*/
protected Hook(String pluginClass) {
public Hook(String pluginClass) {
enabled = Check.isAvailable(pluginClass);
}
@ -32,7 +32,7 @@ public abstract class Hook {
/**
* Constructor to set enabled to false.
*/
protected Hook() {
public Hook() {
enabled = false;
}
}

View File

@ -1,6 +1,8 @@
package com.djrapitops.pluginbridge.plan.sponge;
import com.djrapitops.plan.data.plugin.HookHandler;
import com.djrapitops.plugin.logging.L;
import com.djrapitops.plugin.logging.error.ErrorHandler;
import com.djrapitops.pluginbridge.plan.Hook;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.service.economy.EconomyService;
@ -19,7 +21,9 @@ import java.util.Optional;
public class SpongeEconomyHook extends Hook {
@Inject
public SpongeEconomyHook() {
public SpongeEconomyHook(
ErrorHandler errorHandler
) {
super("org.spongepowered.api.Sponge");
try {
@ -27,6 +31,8 @@ public class SpongeEconomyHook extends Hook {
enabled = serviceOpt.isPresent();
} catch(NoClassDefFoundError e) {
enabled = false;
} catch (IllegalStateException e) {
errorHandler.log(L.WARN, this.getClass(), e);
}
}