|
5 | 5 | import lombok.Setter; |
6 | 6 | import net.kyori.adventure.bossbar.BossBar; |
7 | 7 | import net.kyori.adventure.text.Component; |
| 8 | +import net.kyori.adventure.text.event.ClickEvent; |
8 | 9 | import net.minestom.server.MinecraftServer; |
9 | 10 | import net.minestom.server.entity.LivingEntity; |
10 | 11 | import net.minestom.server.entity.Player; |
|
13 | 14 | import net.minestom.server.timer.ExecutionType; |
14 | 15 | import net.minestom.server.timer.Scheduler; |
15 | 16 | import net.minestom.server.timer.TaskSchedule; |
| 17 | +import net.swofty.commons.StringUtility; |
16 | 18 | import net.swofty.commons.item.ItemType; |
17 | 19 | import net.swofty.commons.item.PotatoType; |
18 | 20 | import net.swofty.commons.item.attribute.attributes.ItemAttributeHotPotatoBookData; |
19 | 21 | import net.swofty.commons.item.attribute.attributes.ItemAttributeRuneInfusedWith; |
20 | 22 | import net.swofty.commons.statistics.ItemStatistic; |
21 | 23 | import net.swofty.commons.statistics.ItemStatistics; |
| 24 | +import net.swofty.type.generic.data.datapoints.DatapointStringList; |
22 | 25 | import net.swofty.type.skyblockgeneric.SkyBlockGenericLoader; |
23 | 26 | import net.swofty.type.skyblockgeneric.bestiary.BestiaryData; |
| 27 | +import net.swofty.type.skyblockgeneric.data.SkyBlockDataHandler; |
24 | 28 | import net.swofty.type.skyblockgeneric.data.datapoints.DatapointSkills; |
25 | 29 | import net.swofty.type.skyblockgeneric.data.datapoints.DatapointSkyBlockExperience; |
26 | 30 | import net.swofty.type.skyblockgeneric.enchantment.EnchantmentType; |
@@ -426,9 +430,51 @@ public static void run() { |
426 | 430 | manaLoop(); |
427 | 431 | missionLoop(); |
428 | 432 | statisticsLoop(); |
| 433 | + experiencedStatisticsLoop(); |
429 | 434 | speedLoop(); |
430 | 435 | } |
431 | 436 |
|
| 437 | + public static void experiencedStatisticsLoop() { |
| 438 | + Scheduler scheduler = MinecraftServer.getSchedulerManager(); |
| 439 | + scheduler.submitTask(() -> { |
| 440 | + SkyBlockGenericLoader.getLoadedPlayers().forEach(player -> { |
| 441 | + Thread.startVirtualThread(() -> { |
| 442 | + List<String> experiencedStatistics = player.getSkyblockDataHandler().get( |
| 443 | + SkyBlockDataHandler.Data.EXPERIENCED_STATISTICS, DatapointStringList.class |
| 444 | + ).getValue(); |
| 445 | + |
| 446 | + ItemStatistics statistics = player.getStatistics().allStatistics(); |
| 447 | + for (ItemStatistic statistic : ItemStatistic.values()) { |
| 448 | + if (experiencedStatistics.contains(statistic.name())) continue; |
| 449 | + |
| 450 | + @Nullable StatisticDescription description = StatisticDescription.fromStatistic(statistic); |
| 451 | + if (description == null) continue; |
| 452 | + |
| 453 | + double experiencedValue = statistics.getOverall(statistic); |
| 454 | + if (experiencedValue <= 0) continue; |
| 455 | + |
| 456 | + experiencedStatistics.add(statistic.name()); |
| 457 | + player.getSkyblockDataHandler().get( |
| 458 | + SkyBlockDataHandler.Data.EXPERIENCED_STATISTICS, DatapointStringList.class |
| 459 | + ).setValue(experiencedStatistics); |
| 460 | + |
| 461 | + player.sendMessage("§a§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"); |
| 462 | + player.sendMessage("§6§lNEW STAT DISCOVERED! §r" + statistic.getFullDisplayName()); |
| 463 | + player.sendMessage(" "); |
| 464 | + player.sendMessage(description.getDescription()); |
| 465 | + player.sendMessage(" "); |
| 466 | + player.sendMessage(Component.text("§e§lCLICK HERE §r§eto learn more on the Official SkyBlock Wiki!") |
| 467 | + .hoverEvent(Component.text("§eClick to view the " + statistic.getDisplayName() + " §eWiki page!")) |
| 468 | + .clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, "https://wiki.hypixel.net/" + description.getWikiName())) |
| 469 | + ); |
| 470 | + player.sendMessage("§a§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"); |
| 471 | + } |
| 472 | + }); |
| 473 | + }); |
| 474 | + return TaskSchedule.seconds(10); |
| 475 | + }); |
| 476 | + } |
| 477 | + |
432 | 478 | public static void barLoop() { |
433 | 479 | Scheduler scheduler = MinecraftServer.getSchedulerManager(); |
434 | 480 | scheduler.submitTask(() -> { |
|
0 commit comments