PC-190
Ignoring listened on too high of a priority and chat managers didn't respect the recipients list. Those two issues have been fixed in this commit
This commit is contained in:
parent
d856736bf4
commit
8e5483e42b
@ -25,6 +25,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -86,7 +87,7 @@ public class IgnoreManager extends MiniDbClientPlugin<IgnoreData>
|
||||
return new IgnoreData();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (ClientManager.Get(event.getPlayer()).GetRank().has(Rank.HELPER))
|
||||
|
@ -484,12 +484,10 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter
|
||||
Party party = _partyManager.getPartyByPlayer(player);
|
||||
if (party != null)
|
||||
{
|
||||
event.getRecipients().clear();
|
||||
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s");
|
||||
|
||||
event.getRecipients().addAll(party.getMembers());
|
||||
event.getRecipients().removeIf(other -> !party.getMembers().contains(other));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -512,10 +510,12 @@ public class HubManager extends MiniPlugin implements IChatMessageFormatter
|
||||
component.addExtra(playerNameText);
|
||||
component.addExtra(" " + ChatColor.WHITE + event.getMessage());
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
if (!event.isCancelled())
|
||||
{
|
||||
if (!event.isCancelled())
|
||||
for (Player other : event.getRecipients())
|
||||
{
|
||||
other.spigot().sendMessage(component);
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s");
|
||||
|
||||
event.getRecipients().addAll(party.getMembers());
|
||||
event.getRecipients().removeIf(other -> !party.getMembers().contains(other));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -656,11 +656,11 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
|
||||
component.addExtra(playerNameText);
|
||||
component.addExtra(" " + ChatColor.WHITE + event.getMessage());
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
if (!event.isCancelled())
|
||||
{
|
||||
if (!event.isCancelled())
|
||||
for (Player other : event.getRecipients())
|
||||
{
|
||||
other.spigot().sendMessage(component);
|
||||
other.spigot().sendMessage(component);
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
|
@ -121,12 +121,10 @@ public class GameChatManager implements Listener
|
||||
Party party = _manager.getPartyManager().getPartyByPlayer(sender);
|
||||
if (party != null)
|
||||
{
|
||||
event.getRecipients().clear();
|
||||
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + event.getPlayer().getName() + " " + C.cPurple + "%2$s");
|
||||
|
||||
event.getRecipients().addAll(party.getMembers());
|
||||
event.getRecipients().removeIf(other -> !party.getMembers().contains(other));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user