@@ -532,7 +532,7 @@ public void stencilBrush(
532532 int maxY = player .getWorld ().getMaxY ();
533533 try {
534534 brush = new StencilBrush (stream , rotation , yscale , onlyWhite ,
535- "#clipboard" . equalsIgnoreCase (image )
535+ isClipboard (image )
536536 ? session .getClipboard ().getClipboard () : null , minY , maxY
537537 );
538538 } catch (EmptyClipboardException ignored ) {
@@ -903,32 +903,28 @@ private void terrainBrush(
903903 int minY = player .getWorld ().getMinY ();
904904 int maxY = player .getWorld ().getMaxY ();
905905 if (flat ) {
906- try {
907- brush = new FlattenBrush (stream , rotation , yscale , layers , smooth ,
908- "#clipboard" .equalsIgnoreCase (image )
909- ? session .getClipboard ().getClipboard () : null , shape , minY , maxY
910- );
911- } catch (EmptyClipboardException ignored ) {
912- brush = new FlattenBrush (stream , rotation , yscale , layers , smooth , null , shape , minY , maxY );
913- }
906+ brush = new FlattenBrush (stream , rotation , yscale , layers , smooth ,
907+ isClipboard (image )
908+ ? session .getClipboard ().getClipboard () : null , shape , minY , maxY
909+ );
914910 } else {
915- try {
916- brush = new HeightBrush (stream , rotation , yscale , layers , smooth ,
917- "#clipboard" .equalsIgnoreCase (image )
918- ? session .getClipboard ().getClipboard () : null , minY , maxY
919- );
920- } catch (EmptyClipboardException ignored ) {
921- brush = new HeightBrush (stream , rotation , yscale , layers , smooth , null , minY , maxY );
922- }
911+ brush = new HeightBrush (stream , rotation , yscale , layers , smooth ,
912+ isClipboard (image )
913+ ? session .getClipboard ().getClipboard () : null , minY , maxY
914+ );
923915 }
924916 if (randomRotate ) {
925917 brush .setRandomRotate (true );
926918 }
927919 set (context , brush , "worldedit.brush.height" ).setSize (radius );
928920 }
929921
922+ private static boolean isClipboard (String image ) {
923+ return "#clipboard" .equalsIgnoreCase (image );
924+ }
925+
930926 private InputStream getHeightmapStream (String filename ) throws FileNotFoundException {
931- if (filename == null || "none" .equalsIgnoreCase (filename )) {
927+ if (filename == null || "none" .equalsIgnoreCase (filename ) || isClipboard ( filename ) ) {
932928 return null ;
933929 }
934930 String filenamePng = filename .endsWith (".png" ) ? filename : filename + ".png" ;
0 commit comments