mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
Compare commits
3 Commits
v2.0.0-ALPHA-2
...
v1.7.4
| Author | SHA1 | Date | |
|---|---|---|---|
| 66e6bff28e | |||
| 332e98f4a0 | |||
| 2085002c59 |
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>eu.endermite</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.7.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>CommandWhitelist</name>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
Command Whitelist is a plugin that allows you to control
|
||||
precisely what commands players can see and use.
|
||||
|
||||
<img src="https://img.shields.io/bstats/servers/8705?label=Spigot%20servers%20using%20CommandWhitelist&style=for-the-badge">
|
||||
<img src="https://img.shields.io/bstats/servers/8704?label=Proxy%20servers%20using%20CommandWhitelist&style=for-the-badge">
|
||||
|
||||
<h3>Plugin Features</h3>
|
||||
|
||||
<ul>
|
||||
|
||||
@@ -28,9 +28,10 @@ public class CommandWhitelist extends JavaPlugin {
|
||||
|
||||
Plugin protocollib = getServer().getPluginManager().getPlugin("ProtocolLib");
|
||||
|
||||
getServer().getPluginManager().registerEvents(new PlayerCommandPreProcessListener(), this);
|
||||
if (!isLegacy) {
|
||||
if (!getConfigCache().isUseProtocolLib() || protocollib == null || !protocollib.isEnabled()) {
|
||||
getServer().getPluginManager().registerEvents(new PlayerCommandPreProcessListener(), this);
|
||||
|
||||
getServer().getPluginManager().registerEvents(new PlayerCommandSendListener(), this);
|
||||
} else {
|
||||
PacketCommandSendListener.protocol(this);
|
||||
|
||||
+4
-2
@@ -19,16 +19,18 @@ public class PlayerCommandPreProcessListener implements Listener {
|
||||
if (player.hasPermission("commandwhitelist.bypass"))
|
||||
return;
|
||||
String command = event.getMessage().toLowerCase();
|
||||
if (command.startsWith("/"))
|
||||
command = command.substring(1);
|
||||
for (Map.Entry<String, List<String>> s : CommandWhitelist.getConfigCache().getPermList().entrySet()) {
|
||||
if (!player.hasPermission("commandwhitelist.commands." + s.getKey()))
|
||||
continue;
|
||||
for (String comm : s.getValue()) {
|
||||
comm = comm.toLowerCase();
|
||||
if (command.equalsIgnoreCase("/" + comm) || command.startsWith("/" + comm + " ")) {
|
||||
if (command.equalsIgnoreCase(comm) || command.startsWith(comm + " ")) {
|
||||
String rawCmd = event.getMessage();
|
||||
List<String> bannedSubCommands = CommandsList.getSuggestions(player);
|
||||
for (String bannedSubCommand : bannedSubCommands) {
|
||||
if (rawCmd.startsWith("/"+bannedSubCommand)) {
|
||||
if (rawCmd.startsWith(bannedSubCommand)) {
|
||||
event.setCancelled(true);
|
||||
ConfigCache config = CommandWhitelist.getConfigCache();
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getPrefix() + RandomStuff.getMessage(config.getCommandDeniedList(), config.getSubCommandDenied())));
|
||||
|
||||
Reference in New Issue
Block a user