Possibly fix SSB2 lag

This commit is contained in:
AverageGithub 2024-04-11 18:17:50 +02:00
parent 286f8f14f1
commit c1dc103219
2 changed files with 8 additions and 5 deletions

View File

@ -156,7 +156,6 @@ shadowJar {
relocate("net.kyori", "com.artillexstudios.axminions.libs.kyori")
relocate("revxrsal.commands", "com.artillexstudios.axminions.libs.lamp")
relocate("org.jetbrains.annotations", "com.artillexstudios.axminions.libs.annotations")
relocate("org.slf4j", "com.artillexstudios.axminions.libs.slf4j")
relocate("org.intellij.lang.annotations", "com.artillexstudios.axminions.libs.intellij.annotations")
}

View File

@ -2,8 +2,10 @@ package com.artillexstudios.axminions.listeners
import com.artillexstudios.axminions.minions.Minions
import com.bgsoftware.superiorskyblock.api.events.IslandDisbandEvent
import org.bukkit.World.Environment
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.World
class SuperiorSkyBlock2Listener : Listener {
@ -11,10 +13,12 @@ class SuperiorSkyBlock2Listener : Listener {
fun onIslandDisbandEvent(event: IslandDisbandEvent) {
val minions = Minions.getMinions()
event.island.allChunks.forEach { chunk ->
minions.forEach { minion ->
if (minion.getLocation().chunk == chunk) {
minion.remove()
Environment.entries.forEach { entry ->
event.island.getAllChunksAsync(entry, true) {}.forEach { chunk ->
minions.forEach { minion ->
if (minion.getLocation().chunk == chunk) {
minion.remove()
}
}
}
}