Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Allow bukkit commands in /execute command

Open Machine-Maker opened this issue 4 years ago • 10 comments

Oh what a beautiful command system bukkit has crammed on top of brigadier...

If there's a better way to fix this, let me know. Main issue is that when the /execute command, and its children are registered, the root node from the dispatcher it's using gets thrown away because a new instance of the dispatcher is created later on (in CraftServer#syncCommands). So the root node it's using is "outdated". This DelegatingRootCommandNode always calls for the latest one. Further changes were needed to make sure the player's are sent the correct redirect node for /execute instead of the "outdated" root node.

Machine-Maker avatar Aug 26 '21 23:08 Machine-Maker

I feel like there should be a config option for this, this looks like it may have a chance of breaking maps designed for vanilla environments.

NoahvdAa avatar Aug 27 '21 08:08 NoahvdAa

I think that the ultimate end goal is that we replace the SimpleCommandMap with something which actually basically backs the internal command dispatcher, the current command system setup is basically a hacked together clusterfuck of hell

electronicboy avatar Aug 27 '21 08:08 electronicboy

I feel like there should be a config option for this, this looks like it may have a chance of breaking maps designed for vanilla environments.

How exactly would it break? You can still run all the same commands, there's just more of them.

I think that the ultimate end goal is that we replace the SimpleCommandMap with something which actually basically backs the internal command dispatcher, the current command system setup is basically a hacked together clusterfuck of hell

Yeah absolutely. The whole CommandMap thing is really annoying.

Machine-Maker avatar Sep 02 '21 06:09 Machine-Maker

How exactly would it break? You can still run all the same commands, there's just more of them.

Some servers have plugins like Essentials installed, which override commands such as /tp. /execute is probably the most used command for checking if certain conditions are met. I'd imagine that servers running command block/function based maps would break if they also had a plugin installed that overrode a command that was working in /execute before this change.

While trying to test for this, I tried to put the following command in a command block: /execute as NoahvdAa at @s run tp @s ~ ~1 ~. After applying this patch, the server would shut down whenever I clicked on the command block with this command in it. There isn't any error message, not even in debug mode, so I'm not entirely sure which part of the patch is causing this. The only plugin installed on the server was EssentialsX (2.19.1-dev+4-fde6524).

NoahvdAa avatar Sep 02 '21 19:09 NoahvdAa

How exactly would it break? You can still run all the same commands, there's just more of them.

Some servers have plugins like Essentials installed, which override commands such as /tp. /execute is probably the most used command for checking if certain conditions are met. I'd imagine that servers running command block/function based maps would break if they also had a plugin installed that overrode a command that was working in /execute before this change.

While trying to test for this, I tried to put the following command in a command block: /execute as NoahvdAa at @s run tp @s ~ ~1 ~. After applying this patch, the server would shut down whenever I clicked on the command block with this command in it. There isn't any error message, not even in debug mode, so I'm not entirely sure which part of the patch is causing this. The only plugin installed on the server was EssentialsX (2.19.1-dev+4-fde6524).

Tbh. this isn't really a main concern in my eyes, especially seeing the major benefit of having plugin commands working again.

Before the internal command changes plugin commands worked just fine in command blocks and similar issues arose hence the replace-commands config option in the spigot.yml and the command-block-overrides in the commands.yml (these would ideally need to be supported by this PR again) and the ability to use namespaces to manually fix it/properly account for that on building it.

Phoenix616 avatar Sep 10 '21 22:09 Phoenix616

This… might be a bigger concern when my PR that fixes plugin commands in datapack functions is merged. Because then, any server with a datapack that uses /tp for example and has essentials, will break.

Machine-Maker avatar Sep 11 '21 16:09 Machine-Maker

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 10 '21 18:11 stale[bot]

Rebased for 1.18.1

Machine-Maker avatar Jan 09 '22 02:01 Machine-Maker

Rebased for 1.18.2

Machine-Maker avatar Mar 30 '22 04:03 Machine-Maker

https://github.com/PaperMC/Paper/pull/8235 Will resolve this underlying issue, do we still want to push for this individual fix? image

Owen1212055 avatar Dec 24 '22 22:12 Owen1212055

Closing in favor of https://github.com/PaperMC/Paper/pull/8235

Owen1212055 avatar Apr 07 '23 01:04 Owen1212055