9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-28 11:19:24 +00:00

Fix discovery GUI not showing regions when not loading user from cache

This commit is contained in:
SamB440
2023-04-25 18:59:53 +01:00
parent 7c088713ed
commit 8118e03bdb

View File

@@ -21,6 +21,7 @@ import net.islandearth.rpgregions.utils.ItemStackBuilder;
import net.islandearth.rpgregions.utils.StringUtils;
import net.kyori.adventure.text.Component;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@@ -182,7 +183,7 @@ public class DiscoveryGUI extends RPGRegionsGUI {
gui.addPane(back);
gui.addPane(forward);
plugin.getManagers().getStorageManager().getAccount(player.getUniqueId()).thenAccept(account -> {
plugin.getManagers().getStorageManager().getAccount(player.getUniqueId()).thenAcceptAsync(account -> {
List<GuiItem> items = new ArrayList<>();
for (ConfiguredRegion configuredRegion : plugin.getManagers().getRegionsCache().getConfiguredRegions().values()) {
boolean hasDiscovered = account.getDiscoveredRegions().containsKey(configuredRegion.getId());
@@ -317,7 +318,8 @@ public class DiscoveryGUI extends RPGRegionsGUI {
}
pane.populateWithGuiItems(items);
gui.addPane(pane);
}).exceptionally(error -> {
gui.update();
}, (t) -> Bukkit.getScheduler().runTask(plugin, t)).exceptionally(error -> {
plugin.getLogger().warning("There was an error whilst listing regions");
error.printStackTrace();
return null;