EngineHub / CraftBook

🔧 Machines, ICs, PLCs, and more!
https://enginehub.org/craftbook/
GNU General Public License v3.0
304 stars 163 forks source link

Make sure to remove perm/op after command #1277

Open Phoenix616 opened 3 years ago

Phoenix616 commented 3 years ago

This change makes sure that the wildcard permission and op status are properly removed from the player after the command in the command items or custom crafting configs are executed even if any kind of exception occurred while executing it.

Also adjusted the CustomCrafting op setters to work the same way as the CommandItems ones (checking the wasOp) and explicitly setting the op to false after execution to improve code readability.

me4502 commented 3 years ago

The reason this isn't done is that it was causing server deadlocks in some cases.

Generally the SUPERUSER commanditem run as type is no longer supported, and will be fully removed in CB5.

It may be replaced with a permission attachment system, but generally that doesn't work too well with how perm plugins do caching now. Console is the recommended way

Phoenix616 commented 3 years ago

Tbh. I feel like a deadlock would still be a lot better than a player walking around with op and * permission.

me4502 commented 3 years ago

The deadlock was much more likely than the case you described. Really I'd prefer to keep it in the "not recommended" state as is with it /mostly/ working, then remove it in CB5 where people won't send me death threats for months for removing a feature in a non-major release

me4502 commented 3 years ago

To clarify - changing it to this makes the feature detrimental enough that it's /likely/ to cause problems, which massively increases the current risk factor. I'd rather entirely remove it than introduce the deadlock issue

Phoenix616 commented 3 years ago

Do you have any further information on the deadlock? Because I have been running a similar code for years without any issues...

me4502 commented 3 years ago

Not really - it was just something that got reported a lot without reproducibility on my end