Skip to content
This repository was archived by the owner on Dec 5, 2021. It is now read-only.

Commit 2eebbea

Browse files
committed
3.1.4.6
Former-commit-id: 5ab82e8
1 parent f9271c5 commit 2eebbea

File tree

2 files changed

+40
-32
lines changed

2 files changed

+40
-32
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>org.maxgamer</groupId>
66
<artifactId>QuickShop</artifactId>
7-
<version>3.1.4.5</version>
7+
<version>3.1.4.6</version>
88

99
<licenses>
1010
<license>

src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -201,33 +201,35 @@ public static String getItemi18n(@NotNull String itemBukkitName) {
201201
*/
202202
public static String getMessage(
203203
@NotNull String loc, @Nullable CommandSender player, @NotNull String... args) {
204-
Optional<String> raw = messagei18n.getString(loc);
205-
if (!raw.isPresent()) {
206-
Util.debugLog(
207-
"ERR: MsgUtil cannot find the the phrase at "
208-
+ loc
209-
+ ", printing the all readed datas: "
210-
+ messagei18n);
204+
try {
205+
Optional<String> raw = messagei18n.getString(loc);
206+
if (!raw.isPresent()) {
207+
Util.debugLog("ERR: MsgUtil cannot find the the phrase at " + loc + ", printing the all readed datas: " + messagei18n);
211208

212-
return invaildMsg + ": " + loc;
213-
}
214-
String filled = fillArgs(raw.get(), args);
215-
if (player instanceof OfflinePlayer) {
216-
if (plugin.getPlaceHolderAPI() != null && plugin.getPlaceHolderAPI().isEnabled()) {
217-
try {
218-
filled = PlaceholderAPI.setPlaceholders((OfflinePlayer) player, filled);
219-
Util.debugLog("Processed message " + filled + " by PlaceHolderAPI.");
220-
} catch (Exception ignored) {
221-
if (((OfflinePlayer) player).getPlayer() != null) {
222-
try {
223-
filled = PlaceholderAPI.setPlaceholders(((OfflinePlayer) player).getPlayer(), filled);
224-
} catch (Exception ignore) {
209+
return invaildMsg + ": " + loc;
210+
}
211+
String filled = fillArgs(raw.get(), args);
212+
if (player instanceof OfflinePlayer) {
213+
if (plugin.getPlaceHolderAPI() != null && plugin.getPlaceHolderAPI().isEnabled()) {
214+
try {
215+
filled = PlaceholderAPI.setPlaceholders((OfflinePlayer) player, filled);
216+
Util.debugLog("Processed message " + filled + " by PlaceHolderAPI.");
217+
} catch (Exception ignored) {
218+
if (((OfflinePlayer) player).getPlayer() != null) {
219+
try {
220+
filled = PlaceholderAPI.setPlaceholders(((OfflinePlayer) player).getPlayer(), filled);
221+
} catch (Exception ignore) {
222+
}
225223
}
226224
}
227225
}
228226
}
227+
return filled;
228+
} catch (Throwable th) {
229+
plugin.getSentryErrorReporter().ignoreThrow();
230+
th.printStackTrace();
231+
return "Cannot load language key: " + loc + " because something not right, check the console for details.";
229232
}
230-
return filled;
231233
}
232234

233235
/**
@@ -240,18 +242,24 @@ public static String getMessage(
240242
*/
241243
public static String getMessageOfflinePlayer(
242244
@NotNull String loc, @Nullable OfflinePlayer player, @NotNull String... args) {
243-
Optional<String> raw = messagei18n.getString(loc);
244-
if (!raw.isPresent()) {
245-
return invaildMsg + ": " + loc;
246-
}
247-
String filled = fillArgs(raw.get(), args);
248-
if (player != null) {
249-
if (plugin.getPlaceHolderAPI() != null && plugin.getPlaceHolderAPI().isEnabled()) {
250-
filled = PlaceholderAPI.setPlaceholders(player, filled);
251-
Util.debugLog("Processed message " + filled + " by PlaceHolderAPI.");
245+
try {
246+
Optional<String> raw = messagei18n.getString(loc);
247+
if (!raw.isPresent()) {
248+
return invaildMsg + ": " + loc;
249+
}
250+
String filled = fillArgs(raw.get(), args);
251+
if (player != null) {
252+
if (plugin.getPlaceHolderAPI() != null && plugin.getPlaceHolderAPI().isEnabled()) {
253+
filled = PlaceholderAPI.setPlaceholders(player, filled);
254+
Util.debugLog("Processed message " + filled + " by PlaceHolderAPI.");
255+
}
252256
}
257+
return filled;
258+
} catch (Throwable th) {
259+
plugin.getSentryErrorReporter().ignoreThrow();
260+
th.printStackTrace();
261+
return "Cannot load language key: " + loc + " because something not right, check the console for details.";
253262
}
254-
return filled;
255263
}
256264

257265
/**

0 commit comments

Comments
 (0)