mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
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
This commit is contained in:
parent
b5fbc6629f
commit
316a4e0484
@ -610,10 +610,17 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final PlotWorld plotworld = PS.get().getPlotWorld(world);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final PlotPlayer plr = BukkitUtil.getPlayer(player);
|
||||||
|
|
||||||
|
if (!plr.getAttribute("chat")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final Location loc = BukkitUtil.getLocation(player);
|
final Location loc = BukkitUtil.getLocation(player);
|
||||||
final Plot plot = MainUtil.getPlot(loc);
|
final Plot plot = MainUtil.getPlot(loc);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
@ -631,9 +638,10 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
recipients.add(p);
|
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);
|
format = ChatColor.translateAlternateColorCodes('&', format);
|
||||||
event.setFormat(format);
|
event.setFormat(format);
|
||||||
|
event.setMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
Loading…
Reference in New Issue
Block a user