This commit is contained in:
TomTom 2024-06-29 10:46:51 +02:00
parent d28f4b9880
commit 723a3eeb04
2 changed files with 5 additions and 2 deletions

View File

@ -136,7 +136,7 @@ class AxMinionsCommand {
@Subcommand("recalc")
@CommandPermission("axminions.command.recalc")
fun recalc(player: Player) {
val islandId = AxMinionsAPI.INSTANCE.getIntegrations().getIslandIntegration()!!.getIslandAt(player.location)
val islandId = AxMinionsAPI.INSTANCE.getIntegrations().getIslandIntegration()?.getIslandAt(player.location) ?: return
AxMinionsPlugin.dataQueue.submit {
var original = 0
if (islandId.isNotBlank()) {
@ -149,6 +149,7 @@ class AxMinionsCommand {
if (integration is SuperiorSkyBlock2Integration) {
val island = SuperiorSkyblockAPI.getIslandAt(player.location) ?: return@submit
var counter = 0
val minions = Minions.getMinions()
Environment.entries.forEach { entry ->
try {
@ -160,12 +161,13 @@ class AxMinionsCommand {
val ch = minion.getLocation().chunk
if (ch.x == chunk.x && ch.z == chunk.z && ch.world == chunk.world) {
AxMinionsPlugin.dataHandler.islandPlace(islandId)
counter++
}
}
}
}
CompletableFuture.allOf(*futures.toTypedArray()).thenRun {
player.sendMessage(StringUtils.formatToString(Messages.PREFIX() + Messages.RECALC(), Placeholder.unparsed("from", original.toString()), Placeholder.unparsed("to", futures.size.toString())))
player.sendMessage(StringUtils.formatToString(Messages.PREFIX() + Messages.RECALC(), Placeholder.unparsed("from", original.toString()), Placeholder.unparsed("to", counter.toString())))
}
} catch (_: NullPointerException) {
// SuperiorSkyBlock api does it this way aswell

View File

@ -113,6 +113,7 @@ class MinionPlaceListener : Listener {
if (Config.DEBUG()) {
event.player.sendMessage("Not return ${islandPlaced >= islandLimit} ${!event.player.hasPermission("axminions.limit.*")}")
}
islandPlaced++
}
}
}