Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Add permission nodes for more gamemaster blocks.

Open Mickey42302 opened this issue 2 months ago • 6 comments

I would like to suggest adding permissions for more of the gamemaster blocks that are included in Java Edition. The patch I created adds the following nodes:

• Structure Block ("minecraft.structureblock")

• Jigsaw Block ("minecraft.jigsawblock")

• Light Block ("minecraft.lightblock") Note: This controls whether or not players can change the light level by interacting with a Light Block with one in their hand.

• Lectern Block ("minecraft.lecternblock") Note: This permission node controls whether or not a lectern with NBT can be placed. Regular players can still place the block with no NBT.

• Test Block ("minecraft.testblock")

• Test Instance Block ("minecraft.testinstanceblock")

Mickey42302 avatar Nov 11 '25 02:11 Mickey42302

shouldn't be a feature patch, requireNonNull is dangerous, perm node names leave something to be desired

electronicboy avatar Nov 11 '25 02:11 electronicboy

What do you think would be a better name for the permission nodes?

As for "requireNonNull", the IDE suggested that I add that to avoid a NullPointerException.

Mickey42302 avatar Nov 12 '25 04:11 Mickey42302

Its better to use Preconditions.checkState(x != null, “message”) than requireNonNull, its even outlined in the CONTRIBUTING.md file iirc

Toffikk avatar Nov 12 '25 04:11 Toffikk

requireNonNull, works by throwing an exception if the value is null, as does the preconditions, we shouldn't be introducing throws to such a trivial state, validate it

electronicboy avatar Nov 12 '25 10:11 electronicboy

yea that might be smarter, also what is the reason for the unnecessary assert? it should be removed if im seeing correctly

Toffikk avatar Nov 12 '25 10:11 Toffikk

What do you mean by assert?

Mickey42302 avatar Nov 16 '25 00:11 Mickey42302

https://github.com/PaperMC/Paper/pull/9339 if we want to implement this, something along the line of this PR might be better. For now, I don't see much benefit in spamming permission checks for every game master block like that.

lynxplay avatar Dec 19 '25 22:12 lynxplay