EssentialsX

EssentialsX

2M Downloads

command-cooldowns ignored if command executed via sign

molor opened this issue ยท 2 comments

commented

Type of bug

Other unexpected behaviour

/ess version output

[14:12:56] Server version: 1.16.5-R0.1-SNAPSHOT git-Paper-775 (MC: 1.16.5) (fine)
[14:12:56] Brand version: Paper (fine)
[14:12:56] EssentialsX version: 2.19.0-dev+169-815c6f8 (fine)
[14:12:56] LuckPerms version: 5.3.3 (fine)
[14:12:56] Vault version: 1.7.3-b131 (fine)
[14:12:56] EssentialsXGeoIP version: 2.19.0-dev+169-815c6f8 (fine)
[14:12:56] EssentialsXSpawn version: 2.19.0-dev+169-815c6f8 (fine)

Server startup log

null

EssentialsX config files

default

Error log (if applicable)

No response

Bug description

command-cooldowns in config.yml don't prevent the execution of the command by player if he clicked RMB on the sign.

Steps to reproduce

command-cooldowns:
  suicide: 300
  1. Type /setblock ^ ^1 ^ minecraft:oak_sign{"Text1":'[{"text":"click on me","clickEvent":{"action":"run_command","value":"suicide"}}]',"Text2":"","Text3":"","Text4":""}
  2. Right-click on the sign
  3. After respawn (and before 5 minutes passed), click on it again
  4. See that command-cooldowns don't work.

If I type /suicide in chat and die, then I can't type it again in next 5 minutes, but the sign still works and kills me..

Expected behaviour

Error message in chat about cooldown and how much time left to perform command again.

Actual behaviour

[00:00:01] Player died
[00:00:03] Player died
[00:00:04] Player died
[00:00:05] Player died
[00:00:07] Player died
[00:00:08] Player died
[00:00:10] Player died
... to be continued
commented

Since 1.13, CraftBukkit has executed sign click commands through the vanilla command dispatcher, which (among other more severe issues) bypasses the PlayerCommandPreprocessEvent that we listen to for enforcing cooldowns. As of Paper 1.17.1 build 88, Paper now runs sign commands in the same way as they would be run from chat (see PaperMC/Paper#6109) (which also fixes using WorldEdit commands like //wand on signs and makes invalid/erroring commands show regular Unknown command and Bukkit error messages, instead of failing silently).

This should hopefully get backported to Paper 1.16.5 soon (PaperMC/Paper#6116) - once this is done you can upgrade Paper and cooldowns will apply to sign commands. see comment below

commented

The latest builds of Paper 1.16.5 (780+) and 1.17.1 (88+) now include the fix for sign commands.