Skip to content

Commit

Permalink
Small addition for unknown commands
Browse files Browse the repository at this point in the history
  • Loading branch information
zS0bye committed Jan 4, 2023
1 parent b7e1553 commit f3fb146
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>it.zS0bye</groupId>
<artifactId>BetterSecurity</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<packaging>jar</packaging>

<name>BetterSecurity</name>
Expand All @@ -18,7 +18,7 @@
</properties>

<build>
<finalName>BetterSecurity-v1.4</finalName>
<finalName>BetterSecurity-v1.4.1</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public enum Config implements IFiles {
WARNINGS_FORMATS_PBP_CONSOLE("Warnings.formats.port_bypass_prevention.console"),
WARNINGS_LOG_CONSOLE("Warnings.log_console"),
UNKNOWN_COMMAND_ENABLED("Unknown_Command.enabled"),
UNKNOWN_COMMAND_EXEMPT_COMMANDS("Unknown_Command.exempt_commands"),
UNKNOWN_COMMAND_USE_SPIGOT_MESSAGE("Unknown_Command.use_spigot_message"),
UNKNOWN_COMMAND_EXECUTORS("Unknown_Command.executors"),
BLOCK_SYNTAX_ENABLED("Block_Syntax.enabled"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import it.zs0bye.bettersecurity.bukkit.executors.SendExecutors;
import it.zs0bye.bettersecurity.bukkit.files.enums.Config;
import it.zs0bye.bettersecurity.bukkit.utils.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand Down Expand Up @@ -32,7 +31,10 @@ public void onCommandPreProcess(final PlayerCommandPreprocessEvent event) {
.split(" ")[0]
.toLowerCase();

if (Bukkit.getHelpMap().getHelpTopic(command) != null) return;
if(Config.UNKNOWN_COMMAND_EXEMPT_COMMANDS.getStringList().contains(command
.replaceFirst("/", ""))) return;

if (this.plugin.getServer().getHelpMap().getHelpTopic(command) != null) return;
event.setCancelled(true);

this.placeholders.put("%player%", player.getName());
Expand Down
10 changes: 9 additions & 1 deletion src/main/resources/configs/bukkit/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░
# ░ ░ ░ ░
#
# Version: 1.4 | Bukkit Version
# Version: 1.4.1 | Bukkit Version
# Configuration
#
# Wiki: https://zs0bye.gitbook.io/bettersecurity/plugins/bettersecurity
Expand Down Expand Up @@ -222,6 +222,14 @@ Unknown_Command:
# If you use PlugMan, it can cause problems if the plugin it loads registers commands for the first time.
enabled: false

# To ignore this section put "exempt_commands: []"
# This function allows you, in case of problems, to be able to insert a
# list of commands that the plugin will ignore.
# The command set by default was put as an example for those who use ChatControl-Red,
# who when running /tell also execute a command that is not registered on Bukkit.
exempt_commands:
- '#flp'

# If set to "true", it will fetch the unknown message directly from spigot.yml.
# If it's false, then it will use the executor below.
use_spigot_message: true
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/configs/bukkit/languages/en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░
# ░ ░ ░ ░
#
# Version: 1.4 | Bukkit Version
# Version: 1.4.1 | Bukkit Version
# Messages - en_US [English]
#
# Wiki: https://zs0bye.gitbook.io/bettersecurity/plugins/bettersecurity
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/configs/bukkit/languages/it_IT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░
# ░ ░ ░ ░
#
# Version: 1.4 | Bukkit Version
# Version: 1.4.1 | Bukkit Version
# Messages - it_IT [Italiano]
#
# Wiki: https://zs0bye.gitbook.io/bettersecurity/plugins/bettersecurity
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/configs/bungee/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░
# ░ ░ ░ ░
#
# Version: 1.4 | BungeeCord Version
# Version: 1.4.1 | BungeeCord Version
# Configuration
#
# Wiki: https://zs0bye.gitbook.io/bettersecurity/plugins/bettersecurity
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/configs/bungee/languages/en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░
# ░ ░ ░ ░
#
# Version: 1.4 | BungeeCord Version
# Version: 1.4.1 | BungeeCord Version
# Messages - en_US [English]
#
# Wiki: https://zs0bye.gitbook.io/bettersecurity/plugins/bettersecurity
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/configs/bungee/languages/it_IT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ░ ░ ░ ░ ░
# ░ ░ ░ ░
#
# Version: 1.4 | BungeeCord Version
# Version: 1.4.1 | BungeeCord Version
# Messages - it_IT [Italiano]
#
# Wiki: https://zs0bye.gitbook.io/bettersecurity/plugins/bettersecurity
Expand Down

0 comments on commit f3fb146

Please sign in to comment.