feat: add worldname to the notify flags (#3457)

* feat: add worldname to the notify flags

* fix: change default message

* refactor: extract duplicated code

* fix: use area instead of world
This commit is contained in:
Bernhard 2022-01-18 20:42:44 +01:00 committed by GitHub
parent 74a490f9f0
commit 6073b96317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 16 deletions

View File

@ -198,13 +198,7 @@ public class PlotListener {
final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
Caption caption = TranslatableCaption.of("notification.notify_enter");
Template playerTemplate = Template.of("player", player.getName());
Template plotTemplate = Template.of("plot", plot.getId().toString());
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
owner.sendMessage(caption, playerTemplate, plotTemplate);
} else {
owner.sendActionBar(caption, playerTemplate, plotTemplate);
}
notifyPlotOwner(player, plot, owner, caption);
}
}
}
@ -443,13 +437,7 @@ public class PlotListener {
final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
Caption caption = TranslatableCaption.of("notification.notify_leave");
Template playerTemplate = Template.of("player", player.getName());
Template plotTemplate = Template.of("plot", plot.getId().toString());
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
owner.sendMessage(caption, playerTemplate, plotTemplate);
} else {
owner.sendActionBar(caption, playerTemplate, plotTemplate);
}
notifyPlotOwner(player, plot, owner, caption);
}
}
}
@ -497,6 +485,17 @@ public class PlotListener {
return true;
}
private void notifyPlotOwner(final PlotPlayer<?> player, final Plot plot, final PlotPlayer<?> owner, final Caption caption) {
Template playerTemplate = Template.of("player", player.getName());
Template plotTemplate = Template.of("plot", plot.getId().toString());
Template areaTemplate = Template.of("area", plot.getArea().toString());
if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
owner.sendMessage(caption, playerTemplate, plotTemplate, areaTemplate);
} else {
owner.sendActionBar(caption, playerTemplate, plotTemplate, areaTemplate);
}
}
public void logout(UUID uuid) {
feedRunnable.remove(uuid);
healRunnable.remove(uuid);

View File

@ -60,8 +60,8 @@
"worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>",
"gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>",
"height.height_limit": "<prefix><gold>This plot area has building height limits: Min height: </gold><gray><minHeight></gray><gold>, Max height: </gold><gray><maxHeight></gray>",
"notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><plot></gold><gray>).</gray>",
"notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><plot></gold><gray>).</gray>",
"notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><area>;<plot></gold><gray>).</gray>",
"notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><area>;<plot></gold><gray>).</gray>",
"swap.swap_overlap": "<prefix><red>The proposed areas are not allowed to overlap.</red>",
"swap.swap_success": "<prefix><dark_aqua>Successfully swapped plots</dark_aqua> <gold><origin></gold><dark_aqua> -> </dark_aqua><gold><target></gold>",
"swap.swap_merged": "<prefix><red>Merged plots may not be swapped. Please unmerge the plots before performing the swap.</red>",