Tweak nukkit plot chat

This commit is contained in:
Jesse Boyd 2018-06-09 15:37:49 +10:00
parent 9ed5847c0a
commit ce3e3be59e
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 8 additions and 7 deletions

View File

@ -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") .text("\n - ").color("$3").text("Remind later (/plot set keep 1d)").color("$2").suggest("/plot set keep 1d")
.tooltip("/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") .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); msg.send(pp);
} }
}); });

View File

@ -564,8 +564,10 @@ public class PlayerEvents extends PlotListener implements Listener {
if (plot == null) { if (plot == null) {
return; return;
} }
event.setCancelled(true);
String message = event.getMessage(); String message = event.getMessage();
if (plotPlayer.hasPermission("plots.chat.color")) {
event.setMessage(C.color(message));
}
String format = C.PLOT_CHAT_FORMAT.s(); String format = C.PLOT_CHAT_FORMAT.s();
String sender = event.getPlayer().getDisplayName(); String sender = event.getPlayer().getDisplayName();
PlotId id = plot.getId(); 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 newFormat = C.color(format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", "{%0}").replace("%msg%", "{%1}"));
String full = partial.replace("%msg%", message); event.setFormat(newFormat);
for (CommandSender receiver : recipients) {
receiver.sendMessage(full);
}
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)