From b756d06c0e42fbc639febf689899fef0a50c9efe Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 14 Apr 2024 14:37:44 -0700 Subject: [PATCH] Fix bug with MythicMobs changes #2340 --- .../bentobox/blueprints/dataobjects/BlueprintEntity.java | 3 +++ .../java/world/bentobox/bentobox/hooks/MythicMobsHook.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/world/bentobox/bentobox/blueprints/dataobjects/BlueprintEntity.java b/src/main/java/world/bentobox/bentobox/blueprints/dataobjects/BlueprintEntity.java index bf6257d59..4c4eb1de1 100644 --- a/src/main/java/world/bentobox/bentobox/blueprints/dataobjects/BlueprintEntity.java +++ b/src/main/java/world/bentobox/bentobox/blueprints/dataobjects/BlueprintEntity.java @@ -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); } diff --git a/src/main/java/world/bentobox/bentobox/hooks/MythicMobsHook.java b/src/main/java/world/bentobox/bentobox/hooks/MythicMobsHook.java index 5db726a27..616ea0622 100644 --- a/src/main/java/world/bentobox/bentobox/hooks/MythicMobsHook.java +++ b/src/main/java/world/bentobox/bentobox/hooks/MythicMobsHook.java @@ -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(), () -> {