From 504a4a92472d1ee7d696ba3dc3083824b822c541 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 5 Feb 2022 00:07:12 +0100 Subject: [PATCH] fix: Restore ability to use PlaceholderAPI in greeting and farewell Fixes #3465 --- .../core/listener/PlotListener.java | 32 +++---------------- Core/src/main/resources/lang/messages_en.json | 2 -- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index 776ee6694..aa7153370 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -174,21 +174,9 @@ public class PlotListener { String greeting = plot.getFlag(GreetingFlag.class); if (!greeting.isEmpty()) { if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { - player.sendMessage( - TranslatableCaption.of("flags.greeting_flag_format"), - Template.of("world", plot.getWorldName()), - Template.of("plot_id", plot.getId().toString()), - Template.of("alias", plot.getAlias()), - Template.of("greeting", greeting) - ); + plot.format(StaticCaption.of(greeting), player, false).thenAcceptAsync(player::sendMessage); } else { - player.sendActionBar( - TranslatableCaption.of("flags.greeting_flag_format"), - Template.of("world", plot.getWorldName()), - Template.of("plot_id", plot.getId().toString()), - Template.of("alias", plot.getAlias()), - Template.of("greeting", greeting) - ); + plot.format(StaticCaption.of(greeting), player, false).thenAcceptAsync(player::sendActionBar); } } @@ -413,21 +401,9 @@ public class PlotListener { String farewell = plot.getFlag(FarewellFlag.class); if (!farewell.isEmpty()) { if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { - player.sendMessage( - TranslatableCaption.of("flags.farewell_flag_format"), - Template.of("world", plot.getWorldName()), - Template.of("plot_id", plot.getId().toString()), - Template.of("alias", plot.getAlias()), - Template.of("farewell", farewell) - ); + plot.format(StaticCaption.of(farewell), player, false).thenAcceptAsync(player::sendMessage); } else { - player.sendActionBar( - TranslatableCaption.of("flags.farewell_flag_format"), - Template.of("world", plot.getWorldName()), - Template.of("plot_id", plot.getId().toString()), - Template.of("alias", plot.getAlias()), - Template.of("farewell", farewell) - ); + plot.format(StaticCaption.of(farewell), player, false).thenAcceptAsync(player::sendActionBar); } } diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 6ca0e0229..02b075240 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -620,8 +620,6 @@ "flags.flag_error_title": "Flag value must be in the format \"A title\" \"The subtitle\".", "flags.area_flags": "Area flags: ", "flags.road_flags": "Road flags: ", - "flags.greeting_flag_format": "[;]: ", - "flags.farewell_flag_format": "[;]: ", "commands.description.add": "Allow a user to build in a plot while the plot owner is online.", "commands.description.alias": "Set the plot alias.", "commands.description.area": "Create a new plot area.",