Towny Classic

Towny Classic

3.2k Downloads

Command blocking function in Towny plugin does not work properly for sub-commands with a main command

Lemar98 opened this issue ยท 1 comments

commented

What steps will reproduce the problem?

  1. Disable the cmi sethome command in the "town_command_blacklisting.town blacklisted commands" section of the config
  2. Try using /cmi sethome in the town
  3. The commad will not be blocked

I am having an issue with the Towny plugin's command blocking feature. Specifically, when I attempt to block the command '/cmi sethome', it is not being blocked by the plugin. After reviewing the Towny code, I have identified the problem: the plugin listens for the PlayerCommandPreprocessEvent, splits the command into an array by spaces, and checks only the first argument for a match with blocked commands. This approach does not work for plugins that have a main command before the sub-command. Therefore, I believe that the plugin should check all arguments of the command for a match with blocked commands to ensure proper blocking of sub-commands with main commands.

What is the expected output?

Commad must be blocked

Towny version

0.99.0.5

Server version

1.16.5

Please use Pastebin.com to link the following files

nothing extra is required

commented

The command blocking feature was written to only check commands instead of subcommands aswell, this should be a feature request instead of a bug report.