mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e5b5b5fc7 | |||
| 67ca2c2458 |
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Bukkit</artifactId>
|
||||
|
||||
+5
-2
@@ -1,6 +1,7 @@
|
||||
package eu.endermite.commandwhitelist.bukkit.listeners;
|
||||
|
||||
import eu.endermite.commandwhitelist.bukkit.CommandWhitelistBukkit;
|
||||
import eu.endermite.commandwhitelist.common.CWPermission;
|
||||
import eu.endermite.commandwhitelist.common.CommandUtil;
|
||||
import eu.endermite.commandwhitelist.common.ConfigCache;
|
||||
import eu.endermite.commandwhitelist.common.commands.CWCommand;
|
||||
@@ -16,8 +17,10 @@ public class PlayerCommandPreProcessListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void PlayerCommandSendEvent(org.bukkit.event.player.PlayerCommandPreprocessEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player.hasPermission("commandwhitelist.bypass")) return;
|
||||
String label = CommandUtil.getCommandLabel(event.getMessage().toLowerCase());
|
||||
if (player.hasPermission(CWPermission.BYPASS.permission())) return;
|
||||
String caseSensitiveLabel = CommandUtil.getCommandLabel(event.getMessage());
|
||||
String label = caseSensitiveLabel.toLowerCase();
|
||||
event.setMessage(event.getMessage().replaceFirst(caseSensitiveLabel, label));
|
||||
BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences();
|
||||
ConfigCache config = CommandWhitelistBukkit.getConfigCache();
|
||||
|
||||
|
||||
+4
-2
@@ -34,9 +34,11 @@ public class PacketCommandPreProcessListener {
|
||||
if (!string.startsWith("/")) return;
|
||||
Player player = event.getPlayer();
|
||||
if (player.hasPermission(CWPermission.BYPASS.permission())) return;
|
||||
|
||||
ConfigCache config = CommandWhitelistBukkit.getConfigCache();
|
||||
String label = CommandUtil.getCommandLabel(string.toLowerCase());
|
||||
String caseSensitiveLabel = CommandUtil.getCommandLabel(string);
|
||||
String label = caseSensitiveLabel.toLowerCase();
|
||||
packet.getStrings().write(0, string.replaceFirst(caseSensitiveLabel, label));
|
||||
|
||||
HashSet<String> commands = CommandWhitelistBukkit.getCommands(player);
|
||||
BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences();
|
||||
if (!commands.contains(label)) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Common</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Velocity</artifactId>
|
||||
|
||||
+6
-3
@@ -11,6 +11,7 @@ import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import eu.endermite.commandwhitelist.common.CWGroup;
|
||||
import eu.endermite.commandwhitelist.common.CWPermission;
|
||||
import eu.endermite.commandwhitelist.common.CommandUtil;
|
||||
import eu.endermite.commandwhitelist.common.ConfigCache;
|
||||
import eu.endermite.commandwhitelist.common.commands.CWCommand;
|
||||
import eu.endermite.commandwhitelist.velocity.command.VelocityMainCommand;
|
||||
@@ -87,10 +88,12 @@ public class CommandWhitelistVelocity {
|
||||
|
||||
if (player.hasPermission(CWPermission.BYPASS.permission())) return;
|
||||
|
||||
// Workaround for velocity executing "/ command" as valid command
|
||||
String command = event.getCommand().trim();
|
||||
|
||||
HashSet<String> allowedCommands = CommandWhitelistVelocity.getCommands(player);
|
||||
String command = event.getCommand().split(" ")[0];
|
||||
if (server.getCommandManager().hasCommand(command)
|
||||
&& !allowedCommands.contains(command))
|
||||
String label = CommandUtil.getCommandLabel(command);
|
||||
if (server.getCommandManager().hasCommand(label) && !allowedCommands.contains(label))
|
||||
event.setResult(CommandExecuteEvent.CommandResult.forwardToServer());
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>2.5.2</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Waterfall</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>eu.endermite.commandwhitelist</groupId>
|
||||
<artifactId>CommandWhitelist</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>2.5.2</version>
|
||||
<modules>
|
||||
<module>CommandWhitelistCommon</module>
|
||||
<module>CommandWhitelistBukkit</module>
|
||||
@@ -46,7 +46,7 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<finalName>${project.name}-${project.parent.version}</finalName>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
Reference in New Issue
Block a user