From c509882a1874b10d1705dbb93d1600b74d7e6efe Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 28 May 2021 11:37:13 +0200 Subject: [PATCH] Enhance alias message with placeholders --- .../main/java/com/plotsquared/core/command/Alias.java | 10 ++++++++-- .../java/com/plotsquared/core/command/Cluster.java | 5 ++++- Core/src/main/resources/lang/messages_en.json | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Alias.java b/Core/src/main/java/com/plotsquared/core/command/Alias.java index a58b20aca..68efb0cff 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Alias.java +++ b/Core/src/main/java/com/plotsquared/core/command/Alias.java @@ -154,7 +154,10 @@ public class Alias extends SubCommand { if (PlotQuery.newQuery().inArea(plot.getArea()) .withAlias(alias) .anyMatch()) { - player.sendMessage(TranslatableCaption.of("alias.alias_is_taken")); + player.sendMessage( + TranslatableCaption.of("alias.alias_is_taken"), + Template.of("alias", alias) + ); return; } if (Settings.UUID.OFFLINE) { @@ -166,7 +169,10 @@ public class Alias extends SubCommand { if (throwable instanceof TimeoutException) { player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout")); } else if (uuid != null) { - player.sendMessage(TranslatableCaption.of("alias.alias_is_taken")); + player.sendMessage( + TranslatableCaption.of("alias.alias_is_taken"), + Template.of("alias", alias) + ); } else { plot.setAlias(alias); player.sendMessage( diff --git a/Core/src/main/java/com/plotsquared/core/command/Cluster.java b/Core/src/main/java/com/plotsquared/core/command/Cluster.java index dde46ec8b..076140dd0 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Cluster.java +++ b/Core/src/main/java/com/plotsquared/core/command/Cluster.java @@ -170,7 +170,10 @@ public class Cluster extends SubCommand { // check if name is taken String name = args[1]; if (area.getCluster(name) != null) { - player.sendMessage(TranslatableCaption.of("alias.alias_is_taken")); + player.sendMessage( + TranslatableCaption.of("alias.alias_is_taken"), + Template.of("alias", name) + ); return false; } if (pos2.getX() < pos1.getX() || pos2.getY() < pos1.getY()) { diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 1519eb526..298c62ac4 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -185,7 +185,7 @@ "alias.alias_set_to": "Plot alias set to .", "alias.alias_removed": "Plot alias removed.", "alias.alias_too_long": "The alias must have less than 50 characters in length.", - "alias.alias_is_taken": "That alias is already taken.", + "alias.alias_is_taken": "That alias is already taken.", "alias.no_alias_set": "No plot alias set.", "position.position_set": "Home position set to your current location.", "position.position_unset": "Home position reset to the default location.",