Fix bug with MythicMobs changes #2340

This commit is contained in:
tastybento 2024-04-14 14:37:44 -07:00
parent 2fe85ec9b0
commit b756d06c0e
2 changed files with 6 additions and 0 deletions

View File

@ -286,6 +286,9 @@ public class BlueprintEntity {
* @return the mythicMobsRecord * @return the mythicMobsRecord
*/ */
public MythicMobRecord getMythicMobsRecord() { 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); return new MythicMobRecord(this.MMtype, this.getCustomName(), this.MMLevel, this.MMpower, this.MMStance);
} }

View File

@ -55,6 +55,9 @@ public class MythicMobsHook extends Hook {
* @return true if spawn is successful * @return true if spawn is successful
*/ */
public boolean spawnMythicMob(MythicMobRecord mmr, Location spawnLocation) { public boolean spawnMythicMob(MythicMobRecord mmr, Location spawnLocation) {
if (!this.isPluginAvailable()) {
return false;
}
return MythicBukkit.inst().getMobManager().getMythicMob(mmr.type()).map(mob -> { return MythicBukkit.inst().getMobManager().getMythicMob(mmr.type()).map(mob -> {
// A delay is required before spawning, I assume because the blocks are pasted using NMS // A delay is required before spawning, I assume because the blocks are pasted using NMS
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {