mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-22 16:39:25 +00:00
Bosses should now load the chunk they're in on autospawn
This commit is contained in:
@@ -457,6 +457,8 @@ public class EcoBoss extends PluginDependent {
|
|||||||
* @param location The location.
|
* @param location The location.
|
||||||
*/
|
*/
|
||||||
public void spawn(@NotNull final Location location) {
|
public void spawn(@NotNull final Location location) {
|
||||||
|
location.getChunk().load();
|
||||||
|
|
||||||
LivingEntity entity = bossType.spawnBossEntity(location);
|
LivingEntity entity = bossType.spawnBossEntity(location);
|
||||||
this.livingBosses.put(entity.getUniqueId(), new LivingEcoBoss(
|
this.livingBosses.put(entity.getUniqueId(), new LivingEcoBoss(
|
||||||
this.getPlugin(),
|
this.getPlugin(),
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package com.willfp.ecobosses.bosses.listeners;
|
package com.willfp.ecobosses.bosses.listeners;
|
||||||
|
|
||||||
import com.willfp.eco.util.NumberUtils;
|
import com.willfp.eco.util.NumberUtils;
|
||||||
import com.willfp.ecobosses.EcoBossesPlugin;
|
|
||||||
import com.willfp.ecobosses.bosses.EcoBoss;
|
import com.willfp.ecobosses.bosses.EcoBoss;
|
||||||
import com.willfp.ecobosses.bosses.EcoBosses;
|
import com.willfp.ecobosses.bosses.EcoBosses;
|
||||||
import com.willfp.ecobosses.bosses.LivingEcoBoss;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@@ -37,13 +35,10 @@ public class AutoSpawnTimer implements Runnable {
|
|||||||
for (UUID uuid : boss.getLivingBosses().keySet()) {
|
for (UUID uuid : boss.getLivingBosses().keySet()) {
|
||||||
Entity entity = Bukkit.getEntity(uuid);
|
Entity entity = Bukkit.getEntity(uuid);
|
||||||
|
|
||||||
if (entity == null) {
|
if (entity != null) {
|
||||||
boss.removeLivingBoss(uuid);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
worlds.add(entity.getWorld());
|
worlds.add(entity.getWorld());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<Location> locations = new ArrayList<>(boss.getAutoSpawnLocations());
|
List<Location> locations = new ArrayList<>(boss.getAutoSpawnLocations());
|
||||||
locations.removeIf(location -> worlds.contains(location.getWorld()));
|
locations.removeIf(location -> worlds.contains(location.getWorld()));
|
||||||
|
|||||||
Reference in New Issue
Block a user