diff --git a/src/main/java/org/maxgamer/quickshop/BootError.java b/src/main/java/org/maxgamer/quickshop/BootError.java index 97d071d5d..cb99a77c3 100644 --- a/src/main/java/org/maxgamer/quickshop/BootError.java +++ b/src/main/java/org/maxgamer/quickshop/BootError.java @@ -32,7 +32,7 @@ public class BootError { private String[] errors; - BootError(@NotNull String... errors) { + public BootError(@NotNull String... errors) { this.errors = errors; for (String err : errors) { QuickShop.instance.getLogger().severe(err); diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java index 83a008f4f..dcef168b3 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ShopManager.java @@ -37,6 +37,7 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.plugin.RegisteredListener; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.maxgamer.quickshop.BootError; import org.maxgamer.quickshop.Economy.Economy; import org.maxgamer.quickshop.Event.ShopCreateEvent; import org.maxgamer.quickshop.Event.ShopPreCreateEvent; @@ -67,8 +68,15 @@ public class ShopManager { this.plugin = plugin; this.useFastShopSearchAlgorithm = plugin.getConfig().getBoolean("shop.use-fast-shop-search-algorithm", false); String taxAccount = plugin.getConfig().getString("tax-account"); - //noinspection ConstantConditions - this.cacheTaxAccount = Bukkit.getOfflinePlayer(taxAccount).getUniqueId(); + for(OfflinePlayer player:Bukkit.getOfflinePlayers()){ + if(player.getName()!=null&&player.getName().equalsIgnoreCase(taxAccount)){ + cacheTaxAccount=player.getUniqueId(); + } + } + if(cacheTaxAccount==null){ + new BootError("Tax account never join the server","you should set a player which have joined the server in config.yml"); + throw new RuntimeException("Tax account never join the server!"); + } } private void actionBuy(@NotNull Player p, @NotNull Economy eco, @NotNull HashMap actions2, @NotNull Info info, @NotNull String message, @NotNull Shop shop, int amount) {