From 316a4e0484558043054a69f4d27b033d3c2660d3 Mon Sep 17 00:00:00 2001 From: confuser Date: Sun, 23 Aug 2015 12:00:52 +0100 Subject: [PATCH] Fixed plot chat using meta instead of attributes Pass message into setFormat and setMessage correctly this avoids % symbols in player messages causing exceptions Fixed #571 --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 2f5231e1b..fe764e97c 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -610,10 +610,17 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen return; } final PlotWorld plotworld = PS.get().getPlotWorld(world); - final PlotPlayer plr = BukkitUtil.getPlayer(player); - if (!plotworld.PLOT_CHAT && (plr.getMeta("chat") == null || !(Boolean) plr.getMeta("chat"))) { + + if (!plotworld.PLOT_CHAT) { return; } + + final PlotPlayer plr = BukkitUtil.getPlayer(player); + + if (!plr.getAttribute("chat")) { + return; + } + final Location loc = BukkitUtil.getLocation(player); final Plot plot = MainUtil.getPlot(loc); if (plot == null) { @@ -631,9 +638,10 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen recipients.add(p); } } - format = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", sender).replaceAll("%msg%", message); + format = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", "%s").replaceAll("%msg%", "%s"); format = ChatColor.translateAlternateColorCodes('&', format); event.setFormat(format); + event.setMessage(message); } @EventHandler(priority = EventPriority.HIGHEST)