fix: Fix greeting & farewell captions not being used (#3272)

* fix: Fix greeting & farewell captions not being used

Fixes #3250

* feat: Allow alias in greeting & farewell flag
This commit is contained in:
NotMyFault 2021-10-07 10:10:00 +02:00 committed by GitHub
parent 7ee46be2ac
commit 6528c60f4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 4 deletions

View File

@ -173,9 +173,21 @@ public class PlotListener {
String greeting = plot.getFlag(GreetingFlag.class); String greeting = plot.getFlag(GreetingFlag.class);
if (!greeting.isEmpty()) { if (!greeting.isEmpty()) {
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
plot.format(StaticCaption.of(greeting), player, false).thenAcceptAsync(player::sendMessage); 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)
);
} else { } else {
plot.format(StaticCaption.of(greeting), player, false).thenAcceptAsync(player::sendActionBar); 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)
);
} }
} }
@ -405,9 +417,21 @@ public class PlotListener {
String farewell = plot.getFlag(FarewellFlag.class); String farewell = plot.getFlag(FarewellFlag.class);
if (!farewell.isEmpty()) { if (!farewell.isEmpty()) {
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
plot.format(StaticCaption.of(farewell), player, false).thenAcceptAsync(player::sendMessage); 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)
);
} else { } else {
plot.format(StaticCaption.of(farewell), player, false).thenAcceptAsync(player::sendActionBar); 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)
);
} }
} }

View File

@ -615,6 +615,8 @@
"flags.flag_error_title": "Flag value must be in the format </red><grey>\"A title\" \"The subtitle\"</grey><red>.", "flags.flag_error_title": "Flag value must be in the format </red><grey>\"A title\" \"The subtitle\"</grey><red>.",
"flags.area_flags": "<prefix><gray>Area flags: </gray><dark_aqua><flags></dark_aqua>", "flags.area_flags": "<prefix><gray>Area flags: </gray><dark_aqua><flags></dark_aqua>",
"flags.road_flags": "<prefix><gray>Road flags: </gray><dark_aqua><flags></dark_aqua>", "flags.road_flags": "<prefix><gray>Road flags: </gray><dark_aqua><flags></dark_aqua>",
"flags.greeting_flag_format": "<prefix><gold>[<world>;<plot_id>]:</gold> <greeting>",
"flags.farewell_flag_format": "<prefix><gold>[<world>;<plot_id>]:</gold> <farewell>",
"commands.description.add": "<gray>Allow a user to build in a plot while the plot owner is online.</gray>", "commands.description.add": "<gray>Allow a user to build in a plot while the plot owner is online.</gray>",
"commands.description.alias": "<gray>Set the plot alias.</gray>", "commands.description.alias": "<gray>Set the plot alias.</gray>",
"commands.description.area": "<gray>Create a new plot area.</gray>", "commands.description.area": "<gray>Create a new plot area.</gray>",