diff --git a/src/main/java/me/despical/tntrun/arena/Arena.java b/src/main/java/me/despical/tntrun/arena/Arena.java index 1baae01..e5d9d6d 100644 --- a/src/main/java/me/despical/tntrun/arena/Arena.java +++ b/src/main/java/me/despical/tntrun/arena/Arena.java @@ -45,7 +45,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.text.MessageFormat; import java.util.*; import java.util.function.Predicate; import java.util.logging.Level; @@ -407,7 +406,7 @@ public void broadcastFormattedMessage(final String path, final User user) { } public void broadcastMessage(final String path, Object... params) { - this.getPlayers().forEach(user -> user.sendRawMessage(MessageFormat.format(chatManager.message(path, this, user), params))); + this.getPlayers().forEach(user -> user.sendRawMessage(chatManager.message(path, this, user), params)); } @Nullable diff --git a/src/main/java/me/despical/tntrun/arena/managers/ScoreboardManager.java b/src/main/java/me/despical/tntrun/arena/managers/ScoreboardManager.java index 021f5c2..8dc1846 100644 --- a/src/main/java/me/despical/tntrun/arena/managers/ScoreboardManager.java +++ b/src/main/java/me/despical/tntrun/arena/managers/ScoreboardManager.java @@ -62,7 +62,7 @@ public ScoreboardManager(Arena arena, Main plugin) { this.scoreboards = new HashSet<>(); } - public void createScoreboard(final User user) { + public void createScoreboard(User user) { if (!plugin.getOption(ConfigPreferences.Option.SCOREBOARD_ENABLED)) { return; } @@ -123,7 +123,7 @@ private String formatScoreboardLine(String line, User user) { line = line.replace("%double_jumps%", getDoubleJumpColor(jumps, max) + jumps); line = line.replace("%date%", date); line = line.replace("%coins_earned%", Integer.toString(user.getStat(LOCAL_COINS))); - return chatManager.message(line, arena); + return chatManager.formatMessage(arena, line); } public String getDoubleJumpColor(int amount, int max) { diff --git a/src/main/java/me/despical/tntrun/handlers/ChatManager.java b/src/main/java/me/despical/tntrun/handlers/ChatManager.java index dcd4291..9c5265c 100644 --- a/src/main/java/me/despical/tntrun/handlers/ChatManager.java +++ b/src/main/java/me/despical/tntrun/handlers/ChatManager.java @@ -75,6 +75,10 @@ public String message(String path, Arena arena, User user) { public String message(String path, Arena arena) { String message = this.message(path); + return formatMessage(arena, message); + } + + public String formatMessage(Arena arena, String message) { message = message.replace("%map%", arena.getMapName()); message = message.replace("%time%", Integer.toString(arena.getTimer())); message = message.replace("%formatted_time%", StringFormatUtils.formatIntoMMSS(arena.getTimer()));