Skip to content

Commit 344c4f2

Browse files
authored
Merge pull request Ghost-chu#1560 from Ghost-chu/master
5.0.0.7
2 parents d332a6f + f297297 commit 344c4f2

File tree

13 files changed

+170
-80
lines changed

13 files changed

+170
-80
lines changed

.deepsource.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ name = "java"
1717
enabled = true
1818

1919
[analyzers.meta]
20-
runtime_version = "16"
20+
runtime_version = "15"

crowdin/lang/cs-CZ/messages.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"file-test": "Toto je zkušební textový soubor. Používáme jej k testování, pokud jde o zprávy .json je rozbitý. Můžete jej vyplnit jakýmkoliv východním vejci, které se vám zde líbí :)",
44
"translation-author": "Translator: Ghost_chu, Andre_601, LixCisCZ",
55
"translation-version": "Verze: Reremake",
6-
"translation-contributors": "Contributors: Timtower, Netherfoam, KaiNoMood, Mgazul, JackTheChicken and Andre_601",
6+
"translation-contributors": "Přispěli: Timtower, Netherfoam, KaiNoMood, Mgazul, JackTheChicken and Andre_601",
77
"translation-country": "Jazyková Zóna: Czech (cs_CZ)",
88
"language-version": "61",
99
"not-looking-at-shop": "&cNelze najít QuickShop. Musíš se na něj podívat.",
@@ -52,7 +52,7 @@
5252
"shop-not-exist": "&cNení žádný obchod.",
5353
"nearby-shop-this-way": "&aShop je od vás {0} bloků.",
5454
"nearby-shop-header": "&aNejbližší obchod odpovídající &b{0}&a:",
55-
"nearby-shop-entry": "&a- Info:{0} &aPrice:&b{1} &ax:&b{2} &ay:&b{3} &az:&b{4} &adistance: &b{5} &ablock(s)",
55+
"nearby-shop-entry": "&a - Info: {0}&aCena:&b{1} &ax:&b{3} &az:&b{4} &avzdálenost: &b{5} &ablok(y)",
5656
"no-nearby-shop": "&cŽádný blízký obchod odpovídající {0}.",
5757
"buying-more-than-selling": "&cVAROVÁNÍ: Kupujete předměty za více, než je prodáváte!",
5858
"not-enough-space": "&cObchod má pouze místo pro {0} více!",
@@ -93,8 +93,8 @@
9393
"stored-enchants": "&5Uložené enchanty",
9494
"shop-information": "&aInformace o obchodě:",
9595
"owner": "&aVlastník: {0}",
96-
"item": "&aItem: &e{0}",
97-
"item-holochat-error": "&c[Error]",
96+
"item": "&aItem: &e{0}\n",
97+
"item-holochat-error": "&c[Error]\n",
9898
"preview": "&b[Náhled itemu]",
9999
"space": "&aMezera: &e{0}",
100100
"stock": "&aSkladem &e{0}",
@@ -155,7 +155,7 @@
155155
"reload": "&eZnovu načte config.yml QuickShopu",
156156
"refill": "&ePřidá zadaný počet položek do obchodu",
157157
"empty": "&eOdstraní všechny položky z obchodu",
158-
"debug": "&eEnables Developer mode",
158+
"debug": "&eZapnut Vývojářský mód",
159159
"create": "&eVytvoří nový obchod z cílené truhly",
160160
"fetchmessage": "&eZobrazit zprávy o nepřečtených obchodech",
161161
"info": "&eZobrazit statistiky v QuickShopu",

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<artifactId>QuickShop</artifactId>
2626

2727
<properties>
28-
<pluginver>5.0.0.6</pluginver>
28+
<pluginver>5.0.0.7</pluginver>
2929
<package>org.maxgamer.quickshop</package>
3030
<developer>Ghost-chu</developer>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/org/maxgamer/quickshop/BuiltInSolution.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,15 @@ public static BootError econError() {
6666
"compatible economy plugin installed to get Vault working.");
6767
}
6868

69+
/**
70+
* Call îf economy system failed to load. This checks the failure reason.
71+
*
72+
* @return The error reason.
73+
*/
74+
public static BootError econHandlerMissingError() {
75+
// Check if Vault is installed
76+
return new BootError(QuickShop.getInstance().getLogger(),
77+
"The selected economy handler not installed", "Please check the configuration.");
78+
}
79+
6980
}

src/main/java/org/maxgamer/quickshop/QuickShop.java

Lines changed: 76 additions & 60 deletions
Large diffs are not rendered by default.

src/main/java/org/maxgamer/quickshop/api/economy/EconomyTransaction.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class EconomyTransaction {
4848
private final EconomyCore core;
4949
private final double actualAmount;
5050
private final double tax;
51+
@Nullable
5152
private final Trader taxer;
5253
private final boolean allowLoan;
5354
private final boolean tryingFixBalanceInsufficient;
@@ -266,7 +267,7 @@ default boolean onCommit(@NotNull EconomyTransaction economyTransaction) {
266267
*/
267268
default void onSuccess(@NotNull EconomyTransaction economyTransaction) {
268269
Util.debugLog("Transaction succeed.");
269-
QuickShop.getInstance().logEvent(new EconomyTransactionLog(true, economyTransaction.getFrom(), economyTransaction.getTo(), economyTransaction.getCurrency(), economyTransaction.getTax(), economyTransaction.getTaxer().getUniqueId(), economyTransaction.getAmount(), economyTransaction.getLastError()));
270+
QuickShop.getInstance().logEvent(new EconomyTransactionLog(true, economyTransaction.getFrom(), economyTransaction.getTo(), economyTransaction.getCurrency(), economyTransaction.getTax(), economyTransaction.getTaxer() == null ? Util.getNilUniqueId() : economyTransaction.getTaxer().getUniqueId(), economyTransaction.getAmount(), economyTransaction.getLastError()));
270271
}
271272

272273
/**
@@ -278,7 +279,7 @@ default void onSuccess(@NotNull EconomyTransaction economyTransaction) {
278279
*/
279280
default void onFailed(@NotNull EconomyTransaction economyTransaction) {
280281
Util.debugLog("Transaction failed: " + economyTransaction.getLastError() + ".");
281-
QuickShop.getInstance().logEvent(new EconomyTransactionLog(false, economyTransaction.getFrom(), economyTransaction.getTo(), economyTransaction.getCurrency(), economyTransaction.getTax(), economyTransaction.getTaxer().getUniqueId(), economyTransaction.getAmount(), economyTransaction.getLastError()));
282+
QuickShop.getInstance().logEvent(new EconomyTransactionLog(false, economyTransaction.getFrom(), economyTransaction.getTo(), economyTransaction.getCurrency(), economyTransaction.getTax(), economyTransaction.getTaxer() == null ? Util.getNilUniqueId() : economyTransaction.getTaxer().getUniqueId(), economyTransaction.getAmount(), economyTransaction.getLastError()));
282283
}
283284

284285
/**
@@ -290,7 +291,7 @@ default void onFailed(@NotNull EconomyTransaction economyTransaction) {
290291
*/
291292
default void onTaxFailed(@NotNull EconomyTransaction economyTransaction) {
292293
Util.debugLog("Tax Transaction failed: " + economyTransaction.getLastError() + ".");
293-
QuickShop.getInstance().logEvent(new EconomyTransactionLog(false, economyTransaction.getFrom(), economyTransaction.getTo(), economyTransaction.getCurrency(), economyTransaction.getTax(), economyTransaction.getTaxer().getUniqueId(), economyTransaction.getAmount(), economyTransaction.getLastError()));
294+
QuickShop.getInstance().logEvent(new EconomyTransactionLog(false, economyTransaction.getFrom(), economyTransaction.getTo(), economyTransaction.getCurrency(), economyTransaction.getTax(), economyTransaction.getTaxer() == null ? Util.getNilUniqueId() : economyTransaction.getTaxer().getUniqueId(), economyTransaction.getAmount(), economyTransaction.getLastError()));
294295
}
295296

296297
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* This file is a part of project QuickShop, the name is EconomyProviderNotFoundException.java
3+
* Copyright (C) PotatoCraft Studio and contributors
4+
*
5+
* This program is free software: you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License as published by the
7+
* Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
* for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*
18+
*/
19+
20+
package org.maxgamer.quickshop.economy;
21+
22+
public class EconomyProviderNotFoundException extends IllegalStateException {
23+
public EconomyProviderNotFoundException() {
24+
super();
25+
}
26+
27+
public EconomyProviderNotFoundException(String s) {
28+
super(s);
29+
}
30+
31+
public EconomyProviderNotFoundException(String message, Throwable cause) {
32+
super(message, cause);
33+
}
34+
35+
public EconomyProviderNotFoundException(Throwable cause) {
36+
super(cause);
37+
}
38+
39+
}

src/main/java/org/maxgamer/quickshop/economy/Economy_GemsEconomy.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import lombok.ToString;
2525
import me.xanium.gemseconomy.api.GemsEconomyAPI;
2626
import me.xanium.gemseconomy.currency.Currency;
27+
import org.bukkit.Bukkit;
2728
import org.bukkit.OfflinePlayer;
2829
import org.bukkit.World;
2930
import org.bukkit.plugin.Plugin;
@@ -47,7 +48,7 @@ public class Economy_GemsEconomy extends AbstractEconomy {
4748
@Setter
4849
private GemsEconomyAPI api;
4950

50-
public Economy_GemsEconomy(@NotNull QuickShop plugin) {
51+
public Economy_GemsEconomy(@NotNull QuickShop plugin) throws EconomyProviderNotFoundException {
5152
super();
5253
this.plugin = plugin;
5354
this.formatter = new BuiltInEconomyFormatter(plugin);
@@ -61,7 +62,10 @@ private void init() {
6162
this.allowLoan = plugin.getConfiguration().getBoolean("shop.allow-economy-loan");
6263
}
6364

64-
private void setupEconomy() {
65+
private void setupEconomy() throws EconomyProviderNotFoundException {
66+
if (Bukkit.getPluginManager().getPlugin("GemsEconomy") == null) {
67+
throw new EconomyProviderNotFoundException("Configuration set economy to GemsEconomy but GemsEconomy not installed");
68+
}
6569
this.api = new GemsEconomyAPI();
6670
}
6771

src/main/java/org/maxgamer/quickshop/economy/Economy_Reserve.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class Economy_Reserve extends AbstractEconomy {
6262
* @deprecated Reserve no-longer active after Minecraft 1.14.
6363
*/
6464
@Deprecated
65-
public Economy_Reserve(@NotNull QuickShop plugin) {
65+
public Economy_Reserve(@NotNull QuickShop plugin) throws EconomyProviderNotFoundException {
6666
this.plugin = plugin;
6767
this.formatter = new BuiltInEconomyFormatter(plugin);
6868
plugin.getReloadManager().register(this);
@@ -71,14 +71,19 @@ public Economy_Reserve(@NotNull QuickShop plugin) {
7171
}
7272

7373
@SuppressWarnings("ConstantConditions")
74-
private void setup() {
74+
private void setup() throws EconomyProviderNotFoundException {
7575
try {
76+
Plugin pl = plugin.getServer().getPluginManager().getPlugin("Reserve");
77+
if (pl == null) {
78+
throw new EconomyProviderNotFoundException("Configuration set economy to Reserve but Reserve not installed");
79+
}
7680
Reserve re = ((Reserve) plugin.getServer().getPluginManager().getPlugin("Reserve"));
7781
if (re.economyProvided()) {
7882
reserve = re.economy();
7983
}
8084
} catch (Exception throwable) {
8185
reserve = null;
86+
plugin.getLogger().log(Level.SEVERE, "Failed to load up Reserve", throwable);
8287
}
8388
}
8489

src/main/java/org/maxgamer/quickshop/economy/Economy_TNE.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class Economy_TNE extends AbstractEconomy {
4949
@Setter
5050
private TNEAPI api;
5151

52-
public Economy_TNE(@NotNull QuickShop plugin) {
52+
public Economy_TNE(@NotNull QuickShop plugin) throws EconomyProviderNotFoundException {
5353
super();
5454
this.plugin = plugin;
5555
plugin.getReloadManager().register(this);
@@ -61,7 +61,12 @@ private void init() {
6161
this.allowLoan = plugin.getConfiguration().getBoolean("shop.allow-economy-loan");
6262
}
6363

64-
private void setupEconomy() {
64+
private void setupEconomy() throws EconomyProviderNotFoundException {
65+
if (Bukkit.getPluginManager().getPlugin("TNE") == null
66+
&& Bukkit.getPluginManager().getPlugin("TNE-Bukkit") == null
67+
&& Bukkit.getPluginManager().getPlugin("TheNewEconomy") == null) {
68+
throw new EconomyProviderNotFoundException("Configuration set economy to TheNewEconomy but TheNewEconomy not installed");
69+
}
6570
this.api = TNE.instance().api();
6671
}
6772

0 commit comments

Comments
 (0)