-
-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix matching forbidden types in set component command #2872
base: legacy/v5
Are you sure you want to change the base?
Conversation
The reason we switched to contains was because we don't process stuff such as block states, so that "grass[]" wouldn't be a bypass. The only real way to get around this would be by using regex to extract the actual block type from the pattern. We opted for the current solution as it would indeed cover all cases, but it could probably have been handled better. |
Gets rid of problems such as 'grass_block' matching 'grass' if 'grass' is a forbidden type.
Hmm, so the set command actually supports all WE patterns, which means something like |
We need to handle that differently. As most patterns are either |
Instead of trying to parse patterns ourselves to figure out if invalid blocks are used, let WE handle it by modifying the disallowed blocks list. This ensures things like '/p set floor hand' only work for allowed blocks. Currently it seems some of the WE pattern parsers don't check against the disallowed blocks list. E.g. BlockCategoryPatternParser doesn't, so '/p set floor ##buttons' works even if all buttons are disallowed.
Well that'd also affect #clipboard. The solution to that would be to parse the pattern without supplying a player, but then we lose all context based patterns. |
5890c91
to
3e591b2
Compare
The |
Maybe it would indeed be best to just check the parsed pattern explicitly. Although currently WE doesn't allow you to check which blocks are used in e.g. |
I had that idea too, but there's no good way to iterate over all blocks involved in a pattern. The only way I could think of, which sounds awful, would be to manually go through every block that would be updated and check what the pattern returns. Not a very pleasant thought, lol. |
Overview
Gets rid of problems such as 'grass_block' matching 'grass' if 'grass' is a forbidden type.
Fixes [no issue report] (see below)
Description
Create a clean install of PlotSquared, claim a plot, remove all of your PlotSquared permissions and give yourself
plots.set.*
. Now run/p set floor grass_block
. You'll get the error:This pull request aims to resolve this.
Checklist