Don't depend directly on Vault in MoneyThingParser.
It turns out that the method reference on MobArena#getEconomy() in ThingManager is a tight enough dependency on Vault's Economy interface that it results in a NoClassDefFoundError if Vault isn't present. By resorting to a more "naive" approach of resolving the Economy instance from the main plugin class on every parse call in MoneyThingParser, the NoClassDefFoundError is avoided along with the load/enable ordering issue that was fixed with the lazy-fetching in commit2fcb20b2ae. This reverts2fcb20b2aeand partly4c34a183c7. Fixes #463
This commit is contained in:
@@ -5,7 +5,9 @@ import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
@@ -21,8 +23,11 @@ public class MoneyThingParserTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MobArena plugin = mock(MobArena.class);
|
||||
Economy economy = mock(Economy.class);
|
||||
subject = new MoneyThingParser(() -> economy);
|
||||
when(plugin.getEconomy()).thenReturn(economy);
|
||||
|
||||
subject = new MoneyThingParser(plugin);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user