mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
mcmmo.admin.chatspy to spy on party chat
This commit is contained in:
parent
ebec5d6f70
commit
6136e82ec6
@ -13,6 +13,8 @@ Version 2.1.0
|
||||
+ (Config) Added rank settings for the new Woodcutting skill
|
||||
+ (Config) Added configurable parameters for the new Tree Feller
|
||||
+ (Config) Added classic toggle for Tree Feller
|
||||
+ (Chat) Added ability for admins to spy on party chat
|
||||
+ (Permissions) Added permission node mcmmo.admin.chatspy
|
||||
+ (Permissions) Added permission nodes for Harvest Lumber, Splinter, Nature's Bounty, and Bark Surgeon
|
||||
! Woodcutting's Double Drop subskill is now named Harvest Lumber
|
||||
! Replaced the old Double Drop permission node for woodcutting with a new Harvest Lumber permission node
|
||||
|
@ -1,6 +1,12 @@
|
||||
package com.gmail.nossr50.chat;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.gmail.nossr50.events.chat.McMMOChatEvent;
|
||||
@ -32,7 +38,27 @@ public abstract class ChatManager {
|
||||
displayName = useDisplayNames ? event.getDisplayName() : senderName;
|
||||
message = LocaleLoader.formatString(chatPrefix, displayName) + " " + event.getMessage();
|
||||
|
||||
|
||||
sendMessage();
|
||||
|
||||
if(event instanceof McMMOPartyChatEvent)
|
||||
{
|
||||
McMMOPartyChatEvent partyChatEvent = (McMMOPartyChatEvent) event;
|
||||
|
||||
for(Player player : event.getPlugin().getServer().getOnlinePlayers())
|
||||
{
|
||||
//TODO: Online check necessary?
|
||||
if(player.isOnline() && Permissions.adminChatSpy(player))
|
||||
{
|
||||
Party adminParty = UserManager.getPlayer(player).getParty();
|
||||
if(adminParty != null && !adminParty.getName().equalsIgnoreCase(partyChatEvent.getParty()))
|
||||
{
|
||||
//TODO: Incorporate JSON
|
||||
player.sendMessage(ChatColor.GOLD+"[SPY: "+ChatColor.GREEN+partyChatEvent.getParty()+ChatColor.GOLD+"] "+message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleChat(String senderName, String message) {
|
||||
|
@ -36,6 +36,7 @@ public final class Permissions {
|
||||
public static boolean trapsBypass(Permissible permissible) { return permissible.hasPermission("mcmmo.bypass.fishingtraps"); }
|
||||
|
||||
/* CHAT */
|
||||
public static boolean adminChatSpy(Permissible permissible) { return permissible.hasPermission("mcmmo.admin.chatspy");}
|
||||
public static boolean partyChat(Permissible permissible) { return permissible.hasPermission("mcmmo.chat.partychat"); }
|
||||
public static boolean adminChat(Permissible permissible) { return permissible.hasPermission("mcmmo.chat.adminchat"); }
|
||||
|
||||
|
@ -690,8 +690,12 @@ permissions:
|
||||
default: false
|
||||
description: Implies access to everything in mcMMO
|
||||
children:
|
||||
mcmmo.admin.chatspy: false
|
||||
mcmmo.commands.mcconvert.all: true
|
||||
mcmmo.commands.xprate.all: true
|
||||
mcmmo.admin.chatspy:
|
||||
default: false
|
||||
description: Allows admins to monitor party chat
|
||||
mcmmo.bypass.*:
|
||||
default: false
|
||||
description: Implies all bypass permissions.
|
||||
|
Loading…
Reference in New Issue
Block a user