mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Don't cancel chat event
This commit is contained in:
parent
eca67c7d84
commit
dc5fc5af47
@ -769,8 +769,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();
|
||||||
@ -788,21 +790,14 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String partial = ChatColor.translateAlternateColorCodes('&',format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender));
|
String newFormat = ChatColor.translateAlternateColorCodes('&', format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", "%1$s").replace("%msg%", "%2$s"));
|
||||||
if (plotPlayer.hasPermission("plots.chat.color")) {
|
event.setFormat(newFormat);
|
||||||
message = C.color(message);
|
|
||||||
}
|
|
||||||
String full = partial.replace("%msg%", message);
|
|
||||||
for (Player receiver : recipients) {
|
|
||||||
receiver.sendMessage(full);
|
|
||||||
}
|
|
||||||
if (!spies.isEmpty()) {
|
if (!spies.isEmpty()) {
|
||||||
String spyMessage = C.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender).replace("%msg%", message);
|
String spyMessage = C.PLOT_CHAT_SPY_FORMAT.s().replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender).replace("%msg%", message);
|
||||||
for (Player player : spies) {
|
for (Player player : spies) {
|
||||||
player.sendMessage(spyMessage);
|
player.sendMessage(spyMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PS.debug(full);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
Loading…
Reference in New Issue
Block a user