mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-10-31 17:43:44 +01:00 
			
		
		
		
	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:
		| @@ -198,13 +198,7 @@ public class PlotListener { | |||||||
|                         final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); |                         final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); | ||||||
|                         if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { |                         if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { | ||||||
|                             Caption caption = TranslatableCaption.of("notification.notify_enter"); |                             Caption caption = TranslatableCaption.of("notification.notify_enter"); | ||||||
|                             Template playerTemplate = Template.of("player", player.getName()); |                             notifyPlotOwner(player, plot, owner, caption); | ||||||
|                             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); |  | ||||||
|                             } |  | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| @@ -443,13 +437,7 @@ public class PlotListener { | |||||||
|                             final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); |                             final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); | ||||||
|                             if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { |                             if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { | ||||||
|                                 Caption caption = TranslatableCaption.of("notification.notify_leave"); |                                 Caption caption = TranslatableCaption.of("notification.notify_leave"); | ||||||
|                                 Template playerTemplate = Template.of("player", player.getName()); |                                 notifyPlotOwner(player, plot, owner, caption); | ||||||
|                                 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); |  | ||||||
|                                 } |  | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
| @@ -497,6 +485,17 @@ public class PlotListener { | |||||||
|         return true; |         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) { |     public void logout(UUID uuid) { | ||||||
|         feedRunnable.remove(uuid); |         feedRunnable.remove(uuid); | ||||||
|         healRunnable.remove(uuid); |         healRunnable.remove(uuid); | ||||||
|   | |||||||
| @@ -60,8 +60,8 @@ | |||||||
|   "worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>", |   "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>", |   "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>", |   "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_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><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_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_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>", |   "swap.swap_merged": "<prefix><red>Merged plots may not be swapped. Please unmerge the plots before performing the swap.</red>", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Bernhard
					Bernhard