mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
parent
f3d950f6e1
commit
5642fd3899
@ -622,13 +622,12 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
String sender = event.getPlayer().getDisplayName();
|
||||
PlotId id = plot.getId();
|
||||
Set<Player> recipients = event.getRecipients();
|
||||
Set<Player> spies = new HashSet<>();
|
||||
recipients.clear();
|
||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||
PlotPlayer pp = entry.getValue();
|
||||
if (pp.getAttribute("chatspy")) {
|
||||
String spy = event.getFormat();
|
||||
spy = String.format(spy, sender, message);
|
||||
pp.sendMessage(spy);
|
||||
spies.add(((BukkitPlayer) pp).player);
|
||||
} else {
|
||||
Plot current = pp.getCurrentPlot();
|
||||
if (current != null && current.getBasePlot(false).equals(plot)) {
|
||||
@ -637,10 +636,19 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
String partial = ChatColor.translateAlternateColorCodes('&',format.replace("%plot_id%", id.x + ";" + id.y).replace("%sender%", sender));
|
||||
if (plotPlayer.hasPermission("plots.chat.color")) {
|
||||
message = C.color(message);
|
||||
}
|
||||
String full = partial.replace("%msg%", message);
|
||||
for (Player receiver : recipients) {
|
||||
receiver.sendMessage(full);
|
||||
}
|
||||
if (!spies.isEmpty()) {
|
||||
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) {
|
||||
player.sendMessage(spyMessage);
|
||||
}
|
||||
}
|
||||
PS.debug(full);
|
||||
}
|
||||
|
||||
|
@ -624,6 +624,7 @@ public enum C {
|
||||
/*
|
||||
* Chat
|
||||
*/
|
||||
PLOT_CHAT_SPY_FORMAT("$2[$1Plot Spy$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", "Chat"),
|
||||
PLOT_CHAT_FORMAT("$2[$1Plot Chat$2][$1%plot_id%$2] $1%sender%$2: $1%msg%", "Chat"),
|
||||
PLOT_CHAT_FORCED("$2This world forces everyone to use plot chat.", "Chat"),
|
||||
PLOT_CHAT_ON("$4Plot chat enabled.", "Chat"),
|
||||
|
Loading…
Reference in New Issue
Block a user