@@ -538,15 +538,20 @@ private BaseBlock parseLogic(String input, ParserContext context) throws InputPa
538538 //FAWE end
539539 }
540540
541- if (DeprecationUtil .isSign (blockType )) {
541+ //FAWE start - only handle if extra data is actually supplied or if the user has permission for nbt
542+ boolean allowWorkingDefault = context .requireActor ().hasPermission ("worldedit.anyblock.nbt" ) && nbt != null ;
543+ if (DeprecationUtil .isSign (blockType ) && (blockAndExtraData .length > 1 || allowWorkingDefault )) {
544+ //FAWE end
542545 // Allow special sign text syntax
543546 String [] text = new String [4 ];
544547 text [0 ] = blockAndExtraData .length > 1 ? blockAndExtraData [1 ] : "" ;
545548 text [1 ] = blockAndExtraData .length > 2 ? blockAndExtraData [2 ] : "" ;
546549 text [2 ] = blockAndExtraData .length > 3 ? blockAndExtraData [3 ] : "" ;
547550 text [3 ] = blockAndExtraData .length > 4 ? blockAndExtraData [4 ] : "" ;
548551 return validate (context , new SignBlock (state , text ));
549- } else if (blockType == BlockTypes .SPAWNER && (blockAndExtraData .length > 1 || nbt != null )) {
552+ //FAWE start - only handle if extra data is actually supplied or if the user has permission for nbt
553+ } else if (blockType == BlockTypes .SPAWNER && (blockAndExtraData .length > 1 || allowWorkingDefault )) {
554+ //FAWE end
550555 // Allow setting mob spawn type
551556 String mobName ;
552557 if (blockAndExtraData .length > 1 ) {
@@ -563,7 +568,9 @@ private BaseBlock parseLogic(String input, ParserContext context) throws InputPa
563568 mobName = EntityTypes .PIG .id ();
564569 }
565570 return validate (context , new MobSpawnerBlock (state , mobName ));
566- } else if ((blockType == BlockTypes .PLAYER_HEAD || blockType == BlockTypes .PLAYER_WALL_HEAD ) && (blockAndExtraData .length > 1 || nbt != null )) {
571+ //FAWE start - only handle if extra data is actually supplied or if the user has permission for nbt
572+ } else if ((blockType == BlockTypes .PLAYER_HEAD || blockType == BlockTypes .PLAYER_WALL_HEAD ) && (blockAndExtraData .length > 1 || allowWorkingDefault )) {
573+ //FAWE end
567574 // allow setting type/player/rotation
568575 if (blockAndExtraData .length == 1 ) {
569576 return validate (context , new SkullBlock (state ));
@@ -600,7 +607,17 @@ private <T extends BlockStateHolder> T validate(ParserContext context, T holder)
600607 }
601608 CompoundTag nbt = holder .getNbtData ();
602609 if (nbt != null ) {
603- if (!actor .hasPermission ("worldedit.anyblock.nbt" )) {
610+ if (actor .hasPermission ("worldedit.anyblock.nbt" )) {
611+ return holder ;
612+ }
613+ if (nbt .equals (holder .getBlockType ().getDefaultState ().getNbtData ())) {
614+ if (!actor .hasPermission ("worldedit.anyblock.default-nbt" )) {
615+ throw new DisallowedUsageException (Caption .of (
616+ "fawe.error.nbt.forbidden" ,
617+ TextComponent .of ("worldedit.anyblock.default-nbt" )
618+ ));
619+ }
620+ } else {
604621 throw new DisallowedUsageException (Caption .of (
605622 "fawe.error.nbt.forbidden" ,
606623 TextComponent .of ("worldedit.anyblock.nbt" )
0 commit comments