mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-17 22:29:41 -05:00
Allow disabling tax account by set it to empty
Former-commit-id: e710760ba239233f4f021e8fec247085ed589f96
This commit is contained in:
1 parent
fe931ac444
commit
799182ffd5
3 files changed
+25
-18
No files matched your search
@@ -402,21 +402,23 @@ public class QuickShop extends JavaPlugin {
|
||||
//getLogger().info("Checking the tax account infos...");
|
||||
try {
|
||||
String taxAccount = getConfig().getString("tax-account", "tax");
|
||||
OfflinePlayer tax = Bukkit.getOfflinePlayer(Objects.requireNonNull(taxAccount)); //FIXME: Should we use player UUID?
|
||||
if (!tax.hasPlayedBefore()) {
|
||||
Economy_Vault vault = (Economy_Vault) core;
|
||||
if (vault.isValid()) {
|
||||
if (!Objects.requireNonNull(vault.getVault()).hasAccount(tax)) {
|
||||
try {
|
||||
Util.debugLog("Tax account not exists! Creating...");
|
||||
vault.getVault().createPlayerAccount(tax);
|
||||
} catch (Exception ignored) {
|
||||
if (!(taxAccount == null || taxAccount.isEmpty())) {
|
||||
OfflinePlayer tax = Bukkit.getOfflinePlayer(Objects.requireNonNull(taxAccount)); //FIXME: Should we use player UUID?
|
||||
if (!tax.hasPlayedBefore()) {
|
||||
Economy_Vault vault = (Economy_Vault) core;
|
||||
if (vault.isValid()) {
|
||||
if (!Objects.requireNonNull(vault.getVault()).hasAccount(tax)) {
|
||||
try {
|
||||
Util.debugLog("Tax account not exists! Creating...");
|
||||
vault.getVault().createPlayerAccount(tax);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
if (!vault.getVault().hasAccount(tax)) {
|
||||
getLogger().warning("Tax account's player never played this server before, that may cause server lagg or economy system error, you should change that name. But if this warning not cause any issues, you can safety ignore this.");
|
||||
}
|
||||
}
|
||||
if (!vault.getVault().hasAccount(tax)) {
|
||||
getLogger().warning("Tax account's player never played this server before, that may cause server lagg or economy system error, you should change that name. But if this warning not cause any issues, you can safety ignore this.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
@@ -52,8 +52,9 @@ public class Economy_Vault implements EconomyCore, Listener {
|
||||
this.plugin = plugin;
|
||||
this.allowLoan = plugin.getConfig().getBoolean("shop.allow-economy-loan");
|
||||
Util.debugLog("Loading caching tax account...");
|
||||
String taxAccount = plugin.getConfig().getString("tax-account");
|
||||
//noinspection deprecation
|
||||
this.taxAccountUUID = Bukkit.getOfflinePlayer(Objects.requireNonNull(plugin.getConfig().getString("tax-account", "tax"))).getUniqueId();
|
||||
this.taxAccountUUID = taxAccount == null || taxAccount.isEmpty() ? null : Bukkit.getOfflinePlayer(taxAccount).getUniqueId();
|
||||
setupEconomy();
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,14 @@ public class ShopManager {
|
||||
this.plugin = plugin;
|
||||
this.useFastShopSearchAlgorithm = plugin.getConfig().getBoolean("shop.use-fast-shop-search-algorithm", false);
|
||||
Util.debugLog("Loading caching tax account...");
|
||||
// noinspection ConstantConditions
|
||||
OfflinePlayer taxPlayer = Bukkit.getOfflinePlayer(plugin.getConfig().getString("tax-account", "tax"));
|
||||
|
||||
this.cacheTaxAccount = taxPlayer.getUniqueId();
|
||||
String taxAccount = plugin.getConfig().getString("tax-account", "tax");
|
||||
if (!(taxAccount == null || taxAccount.isEmpty())) {
|
||||
OfflinePlayer taxPlayer = Bukkit.getOfflinePlayer(taxAccount);
|
||||
this.cacheTaxAccount = taxPlayer.getUniqueId();
|
||||
} else {
|
||||
//disable tax account
|
||||
cacheTaxAccount = null;
|
||||
}
|
||||
this.priceLimiter = new PriceLimiter(plugin.getConfig().getDouble("shop.minimum-price"), plugin.getConfig().getInt("shop.maximum-price"), plugin.getConfig().getBoolean("shop.allow-free-shop"));
|
||||
this.useOldCanBuildAlgorithm = plugin.getConfig().getBoolean("limits.old-algorithm");
|
||||
this.autoSign = plugin.getConfig().getBoolean("shop.auto-sign");
|
||||
|
||||
Reference in new issue
Block a user