Former-commit-id: 5ab82e871cea20baaad65e7e0270cc2b7ebeffb2
This commit is contained in:
Ghost_chu committed 2020-02-25 18:13:16 +08:00
1 parent f9271c5c46
commit 2eebbeacc1
2 files changed
+40 -32

No files matched your search

@@ -201,33 +201,35 @@ public class MsgUtil {
*/
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;
}
/**
@@ -240,18 +242,24 @@ public class MsgUtil {
*/
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;
}
/**