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

Commit

Permalink
3.1.4.6
Browse files Browse the repository at this point in the history
Former-commit-id: 5ab82e8
  • Loading branch information
Ghost-chu committed Feb 25, 2020
1 parent f9271c5 commit 2eebbea
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.maxgamer</groupId>
<artifactId>QuickShop</artifactId>
<version>3.1.4.5</version>
<version>3.1.4.6</version>

<licenses>
<license>
Expand Down
70 changes: 39 additions & 31 deletions src/main/java/org/maxgamer/quickshop/Util/MsgUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,33 +201,35 @@ public static String getItemi18n(@NotNull String itemBukkitName) {
*/
public static String getMessage(
@NotNull String loc, @Nullable CommandSender player, @NotNull String... args) {
Optional<String> raw = messagei18n.getString(loc);
if (!raw.isPresent()) {
Util.debugLog(
"ERR: MsgUtil cannot find the the phrase at "
+ loc
+ ", printing the all readed datas: "
+ messagei18n);
try {
Optional<String> raw = messagei18n.getString(loc);
if (!raw.isPresent()) {
Util.debugLog("ERR: MsgUtil cannot find the the phrase at " + loc + ", printing the all readed datas: " + messagei18n);

return invaildMsg + ": " + loc;
}
String filled = fillArgs(raw.get(), args);
if (player instanceof OfflinePlayer) {
if (plugin.getPlaceHolderAPI() != null && plugin.getPlaceHolderAPI().isEnabled()) {
try {
filled = PlaceholderAPI.setPlaceholders((OfflinePlayer) player, filled);
Util.debugLog("Processed message " + filled + " by PlaceHolderAPI.");
} catch (Exception ignored) {
if (((OfflinePlayer) player).getPlayer() != null) {
try {
filled = PlaceholderAPI.setPlaceholders(((OfflinePlayer) player).getPlayer(), filled);
} catch (Exception ignore) {
return invaildMsg + ": " + loc;
}
String filled = fillArgs(raw.get(), args);
if (player instanceof OfflinePlayer) {
if (plugin.getPlaceHolderAPI() != null && plugin.getPlaceHolderAPI().isEnabled()) {
try {
filled = PlaceholderAPI.setPlaceholders((OfflinePlayer) player, filled);
Util.debugLog("Processed message " + filled + " by PlaceHolderAPI.");
} catch (Exception ignored) {
if (((OfflinePlayer) player).getPlayer() != null) {
try {
filled = PlaceholderAPI.setPlaceholders(((OfflinePlayer) player).getPlayer(), filled);
} catch (Exception ignore) {
}
}
}
}
}
return filled;
} catch (Throwable th) {
plugin.getSentryErrorReporter().ignoreThrow();
th.printStackTrace();
return "Cannot load language key: " + loc + " because something not right, check the console for details.";
}
return filled;
}

/**
Expand All @@ -240,18 +242,24 @@ public static String getMessage(
*/
public static String getMessageOfflinePlayer(
@NotNull String loc, @Nullable OfflinePlayer player, @NotNull String... args) {
Optional<String> raw = messagei18n.getString(loc);
if (!raw.isPresent()) {
return invaildMsg + ": " + loc;
}
String filled = fillArgs(raw.get(), args);
if (player != null) {
if (plugin.getPlaceHolderAPI() != null && plugin.getPlaceHolderAPI().isEnabled()) {
filled = PlaceholderAPI.setPlaceholders(player, filled);
Util.debugLog("Processed message " + filled + " by PlaceHolderAPI.");
try {
Optional<String> raw = messagei18n.getString(loc);
if (!raw.isPresent()) {
return invaildMsg + ": " + loc;
}
String filled = fillArgs(raw.get(), args);
if (player != null) {
if (plugin.getPlaceHolderAPI() != null && plugin.getPlaceHolderAPI().isEnabled()) {
filled = PlaceholderAPI.setPlaceholders(player, filled);
Util.debugLog("Processed message " + filled + " by PlaceHolderAPI.");
}
}
return filled;
} catch (Throwable th) {
plugin.getSentryErrorReporter().ignoreThrow();
th.printStackTrace();
return "Cannot load language key: " + loc + " because something not right, check the console for details.";
}
return filled;
}

/**
Expand Down

0 comments on commit 2eebbea

Please sign in to comment.