From dc7e6010cb6cb7cccef78bd1075a82c865aa747d Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Thu, 27 May 2021 17:06:04 +0200 Subject: [PATCH] Fixes #3073 - Also add new caption if attempting to clear an empty alias --- .../java/com/plotsquared/core/command/Alias.java | 15 +++++++++++---- Core/src/main/resources/lang/messages_en.json | 5 +++-- 2 files changed, 14 insertions(+), 6 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 8d0aee292..a58b20aca 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Alias.java +++ b/Core/src/main/java/com/plotsquared/core/command/Alias.java @@ -179,11 +179,18 @@ public class Alias extends SubCommand { } private boolean removeAlias(PlotPlayer player, Plot plot) { + String alias = plot.getAlias(); + if (!plot.getAlias().isEmpty()) { + player.sendMessage( + TranslatableCaption.of("alias.alias_removed"), + Template.of("alias", alias) + ); + } else { + player.sendMessage( + TranslatableCaption.of("alias.no_alias_set") + ); + } plot.setAlias(null); - player.sendMessage( - TranslatableCaption.of("permission.no_permission"), - Template.of("node", String.valueOf(Permission.PERMISSION_ALIAS_REMOVE)) - ); return true; } diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index f30edea8a..1519eb526 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -182,10 +182,11 @@ "reload.reload_failed": "Failed to reload file configurations.", "desc.desc_set": "Plot description set.", "desc.desc_unset": "Plot description unset.", - "alias.alias_set_to": "Plot alias set to .", - "alias.alias_removed": "Plot alias removed.", + "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.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.", "permission.no_schematic_permission": "You don't have the permission required to use schematic .",