From ce3e3be59effc7c9b279d919a7f325b1a2898640 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sat, 9 Jun 2018 15:37:49 +1000 Subject: [PATCH] Tweak nukkit plot chat --- .../plot/util/expiry/ExpireManager.java | 4 +++- .../plotsquared/nukkit/listeners/PlayerEvents.java | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpireManager.java b/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpireManager.java index 25acd389e..d41f3dd7b 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpireManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/expiry/ExpireManager.java @@ -111,7 +111,9 @@ public class ExpireManager { .text("\n - ").color("$3").text("Remind later (/plot set keep 1d)").color("$2").suggest("/plot set keep 1d") .tooltip("/plot set keep 1d") .text("\n - ").color("$3").text("Keep this (/plot set keep true)").color("$2").suggest("/plot set keep true") - .tooltip("/plot set keep true"); + .tooltip("/plot set keep true") + .text("\n - ").color("$3").text("Don't show me this").color("$2").suggest("/plot toggle clear-confirmation") + .tooltip("/plot toggle clear-confirmation"); msg.send(pp); } }); diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/listeners/PlayerEvents.java b/Nukkit/src/main/java/com/plotsquared/nukkit/listeners/PlayerEvents.java index 7f30f84f8..5df6618f0 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/listeners/PlayerEvents.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/listeners/PlayerEvents.java @@ -564,8 +564,10 @@ public class PlayerEvents extends PlotListener implements Listener { if (plot == null) { return; } - event.setCancelled(true); String message = event.getMessage(); + if (plotPlayer.hasPermission("plots.chat.color")) { + event.setMessage(C.color(message)); + } String format = C.PLOT_CHAT_FORMAT.s(); String sender = event.getPlayer().getDisplayName(); PlotId id = plot.getId(); @@ -584,11 +586,8 @@ public class PlayerEvents extends PlotListener implements Listener { } } } - String partial = C.color(format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender)); - String full = partial.replace("%msg%", message); - for (CommandSender receiver : recipients) { - receiver.sendMessage(full); - } + String newFormat = C.color(format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", "{%0}").replace("%msg%", "{%1}")); + event.setFormat(newFormat); } @EventHandler(priority = EventPriority.LOWEST)