Commands can now be cancelled to prevent "Invalid command" message sent to player

This commit is contained in:
boosik 2020-07-27 16:36:05 +02:00
parent 857291778e
commit 9cf41f4f01
5 changed files with 13 additions and 2 deletions

View File

@ -181,6 +181,9 @@ public class BoosCoolDownListener implements Listener {
BoosCoolDown.commandLogger(player.getName(), originalCommand);
}
}
if (BoosConfigManager.getCancelCommand(regexCommad, player)) {
event.setCancelled(true);
}
for (final String key : commandQueue.keySet()) {
if (key.startsWith(String.valueOf(player.getUniqueId()))) {
commandQueue.remove(key);

View File

@ -307,6 +307,11 @@ public class BoosConfigManager {
return message;
}
public static Boolean getCancelCommand(final String regexCommand, final Player player) {
final String group = getCommandGroup(player);
return conf.getBoolean("commands.groups." + group + "." + regexCommand + ".cancel_command", false);
}
static String getPaidErrorMessage() {
return conf.getString("options.messages.paid_error", "An error has occured: %s");
}

View File

@ -229,6 +229,9 @@ commands:
/testxpreq:
#this command needs player to have 30 experience levels to be used, but does not take experience levels from player
xprequirement: 30
/cancelledComandWithMessage:
message: "This command will be cancelled and will not return 'Invalid command' message to player"
cancel_command: true
#this group will only work for players that have booscooldowns.vip permission (player can only have one group at a time and no inheritance is possible atm
vip:
/command *:

View File

@ -1,6 +1,6 @@
name: boosCooldowns
main: cz.boosik.boosCooldown.BoosCoolDown
version: 3.16.2
version: 3.17.0
api-version: 1.13
authors: [LordBoos (boosik)]
softdepend: [Vault, PlayerPoints]

View File

@ -11,7 +11,7 @@
<packaging>pom</packaging>
<url>http://maven.apache.org</url>
<properties>
<boosCooldowns.version>3.16.2</boosCooldowns.version>
<boosCooldowns.version>3.17.0</boosCooldowns.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<minecraft.version>1.16.1</minecraft.version>