From b5fbc6629fc60665bc1e743f9a0f5d6787c5f133 Mon Sep 17 00:00:00 2001 From: confuser Date: Sun, 23 Aug 2015 11:36:41 +0100 Subject: [PATCH 1/2] Fixed compiliation issue --- .../java/com/plotsquared/sponge/object/SpongePlayer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java b/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java index 74318f339..d980fcc58 100644 --- a/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java +++ b/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java @@ -4,9 +4,14 @@ import java.util.Date; import java.util.HashSet; import java.util.UUID; +import org.spongepowered.api.data.key.Keys; +import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData; +import org.spongepowered.api.data.value.mutable.Value; import org.spongepowered.api.entity.player.Player; import org.spongepowered.api.entity.player.gamemode.GameMode; import org.spongepowered.api.entity.player.gamemode.GameModes; +import org.spongepowered.api.text.Texts; +import org.spongepowered.api.text.chat.ChatType; import org.spongepowered.api.text.chat.ChatTypes; import com.flowpowered.math.vector.Vector3d; @@ -100,7 +105,7 @@ public class SpongePlayer extends PlotPlayer { @Override public void sendMessage(String message) { - player.sendMessage(ChatTypes.CHAT, message); + player.sendMessage(ChatTypes.CHAT, Texts.of(message)); } @Override From 316a4e0484558043054a69f4d27b033d3c2660d3 Mon Sep 17 00:00:00 2001 From: confuser Date: Sun, 23 Aug 2015 12:00:52 +0100 Subject: [PATCH 2/2] 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)