-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPMSpyCommand.java
More file actions
40 lines (32 loc) · 1.23 KB
/
Copy pathPMSpyCommand.java
File metadata and controls
40 lines (32 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.mrsans.pmlogger;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Set;
import java.util.UUID;
public class PMSpyCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can use this command.");
return true;
}
Player player = (Player) sender;
if (!player.hasPermission("pmlogger.spy")) {
player.sendMessage(ChatColor.RED + "You don't have permission to do that.");
return true;
}
Set<UUID> spies = PMLoggerPlugin.getInstance().getSpyPlayers();
UUID id = player.getUniqueId();
if (spies.contains(id)) {
spies.remove(id);
player.sendMessage(ChatColor.YELLOW + "PM spy mode disabled.");
} else {
spies.add(id);
player.sendMessage(ChatColor.GREEN + "PM spy mode enabled - you will now see all private messages.");
}
return true;
}
}