com.onarandombox.MultiverseCore.MultiverseCore Java Examples

The following examples show how to use com.onarandombox.MultiverseCore.MultiverseCore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PluginHookServiceTest.java    From AuthMeReloaded with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void shouldUnhookEssentialsAndMultiverse() {
    // given
    PluginManager pluginManager = mock(PluginManager.class);
    setPluginAvailable(pluginManager, ESSENTIALS, Essentials.class);
    setPluginAvailable(pluginManager, MULTIVERSE, MultiverseCore.class);
    PluginHookService pluginHookService = new PluginHookService(pluginManager);

    // when
    pluginHookService.unhookEssentials();
    pluginHookService.unhookMultiverse();

    // then
    assertThat(pluginHookService.isEssentialsAvailable(), equalTo(false));
    assertThat(pluginHookService.isMultiverseAvailable(), equalTo(false));
}
 
Example #2
Source File: PluginHookServiceTest.java    From AuthMeReloaded with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void shouldReturnNullForNonMvWorld() {
    // given
    World world = mock(World.class);
    MVWorldManager mvWorldManager = mock(MVWorldManager.class);
    given(mvWorldManager.isMVWorld(world)).willReturn(false);

    PluginManager pluginManager = mock(PluginManager.class);
    MultiverseCore multiverse = mock(MultiverseCore.class);
    setPluginAvailable(pluginManager, MULTIVERSE, multiverse);
    given(multiverse.getMVWorldManager()).willReturn(mvWorldManager);
    PluginHookService pluginHookService = new PluginHookService(pluginManager);

    // when
    Location spawn = pluginHookService.getMultiverseSpawn(world);

    // then
    assertThat(spawn, nullValue());
    verify(mvWorldManager).isMVWorld(world);
    verify(mvWorldManager, never()).getMVWorld(world);
}
 
Example #3
Source File: PluginHookService.java    From AuthMeReloaded with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Attempts to create a hook into Multiverse.
 */
public void tryHookToMultiverse() {
    try {
        multiverse = getPlugin(pluginManager, "Multiverse-Core", MultiverseCore.class);
    } catch (Exception | NoClassDefFoundError ignored) {
        multiverse = null;
    }
}
 
Example #4
Source File: PluginHookServiceTest.java    From AuthMeReloaded with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void shouldHookIntoMultiverseAtInitialization() {
    // given
    PluginManager pluginManager = mock(PluginManager.class);
    setPluginAvailable(pluginManager, MULTIVERSE, MultiverseCore.class);

    // when
    PluginHookService pluginHookService = new PluginHookService(pluginManager);

    // then
    assertThat(pluginHookService.isMultiverseAvailable(), equalTo(true));
}
 
Example #5
Source File: PluginHookServiceTest.java    From AuthMeReloaded with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void shouldGetMultiverseSpawn() {
    // given
    Location location = mock(Location.class);
    MultiverseWorld multiverseWorld = mock(MultiverseWorld.class);
    given(multiverseWorld.getSpawnLocation()).willReturn(location);

    World world = mock(World.class);
    MVWorldManager mvWorldManager = mock(MVWorldManager.class);
    given(mvWorldManager.isMVWorld(world)).willReturn(true);
    given(mvWorldManager.getMVWorld(world)).willReturn(multiverseWorld);
    MultiverseCore multiverse = mock(MultiverseCore.class);
    given(multiverse.getMVWorldManager()).willReturn(mvWorldManager);

    PluginManager pluginManager = mock(PluginManager.class);
    setPluginAvailable(pluginManager, MULTIVERSE, multiverse);
    PluginHookService pluginHookService = new PluginHookService(pluginManager);

    // when
    Location spawn = pluginHookService.getMultiverseSpawn(world);

    // then
    assertThat(spawn, equalTo(location));
    verify(mvWorldManager).isMVWorld(world);
    verify(mvWorldManager).getMVWorld(world);
    verify(multiverseWorld).getSpawnLocation();
}
 
Example #6
Source File: MultiverseCoreBridge.java    From LunaChat with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * MultiverseCore-apiをロードする
 * @param plugin MultiverseCoreのプラグインインスタンス
 * @param ロードしたかどうか
 */
public static MultiverseCoreBridge load(Plugin plugin) {

    if ( plugin instanceof MultiverseCore ) {
        MultiverseCoreBridge bridge = new MultiverseCoreBridge();
        bridge.mvc = (Core)plugin;
        return bridge;
    } else {
        return null;
    }
}