Skip to content

Commit d2c52f7

Browse files
committed
Make send- and receive- chat flags respect group flags.
1 parent 3a332fd commit d2c52f7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

worldguard-legacy/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardPlayerListener.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,16 @@ public void onPlayerChat(AsyncPlayerChatEvent event) {
153153
Player player = event.getPlayer();
154154
WorldConfiguration wcfg = plugin.getGlobalStateManager().get(player.getWorld());
155155
if (wcfg.useRegions) {
156-
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.SEND_CHAT, player.getLocation())) {
156+
LocalPlayer localPlayer = plugin.wrapPlayer(player);
157+
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.SEND_CHAT, player.getLocation(), localPlayer)) {
157158
player.sendMessage(ChatColor.RED + "You don't have permission to chat in this region!");
158159
event.setCancelled(true);
159160
return;
160161
}
161162

162163
for (Iterator<Player> i = event.getRecipients().iterator(); i.hasNext();) {
163-
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.RECEIVE_CHAT, i.next().getLocation())) {
164+
Player rPlayer = i.next();
165+
if (!plugin.getGlobalRegionManager().allows(DefaultFlag.RECEIVE_CHAT, rPlayer.getLocation(), plugin.wrapPlayer(rPlayer))) {
164166
i.remove();
165167
}
166168
}

0 commit comments

Comments
 (0)