Include world in plot chat & spy template

This commit is contained in:
NotMyFault 2021-09-07 16:36:08 +02:00
parent 87d134215f
commit b224a8d1b8
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 9 additions and 5 deletions

View File

@ -701,8 +701,10 @@ public class PlayerEventListener extends PlotListener implements Listener {
String message = event.getMessage(); String message = event.getMessage();
String sender = event.getPlayer().getDisplayName(); String sender = event.getPlayer().getDisplayName();
PlotId id = plot.getId(); PlotId id = plot.getId();
String worldName = plot.getWorldName();
Caption msg = TranslatableCaption.of("chat.plot_chat_format"); Caption msg = TranslatableCaption.of("chat.plot_chat_format");
Template msgTemplate; Template msgTemplate;
Template worldNameTemplate = Template.of("world", worldName);
Template plotTemplate = Template.of("plot_id", id.toString()); Template plotTemplate = Template.of("plot_id", id.toString());
Template senderTemplate = Template.of("sender", sender); Template senderTemplate = Template.of("sender", sender);
// If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either <gold></gold> or &6 etc. // If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either <gold></gold> or &6 etc.
@ -723,7 +725,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message))))); ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message)))));
} }
for (PlotPlayer<?> receiver : plotRecipients) { for (PlotPlayer<?> receiver : plotRecipients) {
receiver.sendMessage(msg, msgTemplate, plotTemplate, senderTemplate); receiver.sendMessage(msg, worldNameTemplate, msgTemplate, plotTemplate, senderTemplate);
} }
if (!spies.isEmpty()) { if (!spies.isEmpty()) {
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format"); Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
@ -731,7 +733,7 @@ public class PlayerEventListener extends PlotListener implements Listener {
Template spysenderTemplate = Template.of("sender", sender); Template spysenderTemplate = Template.of("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message)); Template spymessageTemplate = Template.of("msg", Component.text(message));
for (PlotPlayer<?> player : spies) { for (PlotPlayer<?> player : spies) {
player.sendMessage(spymsg, plotidTemplate, spysenderTemplate, spymessageTemplate); player.sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate, spymessageTemplate);
} }
} }
if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) { if (Settings.Chat.LOG_PLOTCHAT_TO_CONSOLE) {
@ -739,7 +741,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY()); Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
Template spysenderTemplate = Template.of("sender", sender); Template spysenderTemplate = Template.of("sender", sender);
Template spymessageTemplate = Template.of("msg", Component.text(message)); Template spymessageTemplate = Template.of("msg", Component.text(message));
ConsolePlayer.getConsole().sendMessage(spymsg, plotidTemplate, spysenderTemplate, spymessageTemplate); ConsolePlayer.getConsole().sendMessage(spymsg, worldNameTemplate, plotidTemplate, spysenderTemplate,
spymessageTemplate
);
} }
} }

View File

@ -397,8 +397,8 @@
"list.plot_list_header_paged": "<gray>(Page </gray><gold><cur></gold><gray>/</gray><gold><max></gold><gray>) </gray><gold>List of <amount> plots</gold>", "list.plot_list_header_paged": "<gray>(Page </gray><gold><cur></gold><gray>/</gray><gold><max></gold><gray>) </gray><gold>List of <amount> plots</gold>",
"list.plot_list_header": "<prefix><gold>List of <word> plots.</gold>", "list.plot_list_header": "<prefix><gold>List of <word> plots.</gold>",
"list.page_turn": "<gold><click:run_command:<command1>>Back</gold><dark_gray> | </dark_gray><gold><click:run_command:<command2>>Next</click></gold><gray><clickable></gray>", "list.page_turn": "<gold><click:run_command:<command1>>Back</gold><dark_gray> | </dark_gray><gold><click:run_command:<command2>>Next</click></gold><gray><clickable></gray>",
"chat.plot_chat_spy_format": "<gray>[<gold>Plot Spy</gold>] [<gold><plot_id></gold>] <gold><sender></gold>: <gold><msg></gold></gray>", "chat.plot_chat_spy_format": "<gray>[<gold>Plot Spy</gold>] [<gold><world>;<plot_id></gold>] <gold><sender></gold>: <gold><msg></gold></gray>",
"chat.plot_chat_format": "<gray>[<gold>Plot Chat</gold>] [<gold><plot_id></gold>] <gold><sender></gold>: <gold><msg></gold></gray>", "chat.plot_chat_format": "<gray>[<gold>Plot Chat</gold>] [<gold><world>;<plot_id></gold>] <gold><sender></gold>: <gold><msg></gold></gray>",
"chat.plot_chat_forced": "<prefix><gray>This world forces everyone to use plot chat.</gray>", "chat.plot_chat_forced": "<prefix><gray>This world forces everyone to use plot chat.</gray>",
"deny.denied_added": "<prefix><dark_aqua>You successfully denied the player from this plot.</dark_aqua>", "deny.denied_added": "<prefix><dark_aqua>You successfully denied the player from this plot.</dark_aqua>",
"deny.no_enter": "<prefix><red>You are denied from the plot <red><gold><plot></gold><red> and therefore not allowed to enter.</red>", "deny.no_enter": "<prefix><red>You are denied from the plot <red><gold><plot></gold><red> and therefore not allowed to enter.</red>",