From d2c52f7c1b2cb609c5976d475feebabf4591efee Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 24 Feb 2018 09:39:16 -0500 Subject: [PATCH] Make send- and receive- chat flags respect group flags. --- .../bukkit/listener/WorldGuardPlayerListener.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java index 5b4fa67d..f69c6fc4 100644 --- a/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java +++ b/worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java @@ -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 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(); } }