mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-08 03:49:32 +01:00
Make send- and receive- chat flags respect group flags.
This commit is contained in:
parent
3a332fd87d
commit
d2c52f7c1b
@ -153,14 +153,16 @@ public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
WorldConfiguration wcfg = plugin.getGlobalStateManager().get(player.getWorld());
|
||||
if (wcfg.useRegions) {
|
||||
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.SEND_CHAT, player.getLocation())) {
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.SEND_CHAT, player.getLocation(), localPlayer)) {
|
||||
player.sendMessage(ChatColor.RED + "You don't have permission to chat in this region!");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Iterator<Player> i = event.getRecipients().iterator(); i.hasNext();) {
|
||||
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.RECEIVE_CHAT, i.next().getLocation())) {
|
||||
Player rPlayer = i.next();
|
||||
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.RECEIVE_CHAT, rPlayer.getLocation(), plugin.wrapPlayer(rPlayer))) {
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user