Compare commits
2 Commits
3de0ff236e
...
69a22e917e
Author | SHA1 | Date |
---|---|---|
tastybento | 69a22e917e | |
tastybento | ffb955b22b |
|
@ -286,6 +286,9 @@ public class BlueprintEntity {
|
|||
* @return the mythicMobsRecord
|
||||
*/
|
||||
public MythicMobRecord getMythicMobsRecord() {
|
||||
if (this.MMtype == null || this.MMLevel == null || this.MMpower == null || this.MMStance == null) {
|
||||
return null;
|
||||
}
|
||||
return new MythicMobRecord(this.MMtype, this.getCustomName(), this.MMLevel, this.MMpower, this.MMStance);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ public class MythicMobsHook extends Hook {
|
|||
* @return true if spawn is successful
|
||||
*/
|
||||
public boolean spawnMythicMob(MythicMobRecord mmr, Location spawnLocation) {
|
||||
if (!this.isPluginAvailable()) {
|
||||
return false;
|
||||
}
|
||||
return MythicBukkit.inst().getMobManager().getMythicMob(mmr.type()).map(mob -> {
|
||||
// A delay is required before spawning, I assume because the blocks are pasted using NMS
|
||||
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
|
||||
|
|
|
@ -156,7 +156,17 @@ public class MythicMobsHookTest {
|
|||
* Test method for {@link world.bentobox.bentobox.hooks.MythicMobsHook#spawnMythicMob(world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity.MythicMobRecord, org.bukkit.Location)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSpawnMythicMob() {
|
||||
public void testSpawnMythicMobNoPLugin() {
|
||||
MythicMobRecord mmr = hook.getMythicMob(entity);
|
||||
assertFalse(hook.spawnMythicMob(mmr, location));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.hooks.MythicMobsHook#spawnMythicMob(world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity.MythicMobRecord, org.bukkit.Location)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSpawnMythicMobHasPlugin() {
|
||||
when(mythicMobs.isEnabled()).thenReturn(true);
|
||||
MythicMobRecord mmr = hook.getMythicMob(entity);
|
||||
assertTrue(hook.spawnMythicMob(mmr, location));
|
||||
verify(mm).getMythicMob("GIANT");
|
||||
|
|
Loading…
Reference in New Issue