@@ -157,9 +157,10 @@ public MultiLineComponent apply(PlaceholderContext ctx,
157157 PlaceholderUtils .checkArgs (args , 2 , true );
158158 try {
159159 if (GTStringUtils .toDouble (args .get (0 )) != 0 ) {
160- return args .get (1 );
161- } else if (args .size () > 2 ) return args .get (2 );
162- else return MultiLineComponent .empty ();
160+ return new MultiLineComponent (args .get (1 )).setIgnoreSpaces (true );
161+ } else if (args .size () > 2 ) {
162+ return new MultiLineComponent (args .get (2 )).setIgnoreSpaces (true );
163+ } else return MultiLineComponent .empty ();
163164 } catch (NumberFormatException e ) {
164165 return args .get (1 );
165166 }
@@ -223,9 +224,10 @@ public MultiLineComponent apply(PlaceholderContext ctx,
223224 List <MultiLineComponent > args ) throws PlaceholderException {
224225 PlaceholderUtils .checkArgs (args , 2 );
225226 int count = PlaceholderUtils .toInt (args .get (0 ));
227+ PlaceholderUtils .checkRange ("n" , 0 , 50000 , count );
226228 MultiLineComponent out = MultiLineComponent .empty ();
227229 for (int i = 0 ; i < count ; i ++) out .append (args .get (1 ));
228- return out ;
230+ return out . setIgnoreSpaces ( true ) ;
229231 }
230232 });
231233 PlaceholderHandler .addPlaceholder (new Placeholder ("block" ) {
@@ -256,7 +258,7 @@ public MultiLineComponent apply(PlaceholderContext ctx,
256258 PlaceholderUtils .checkArgs (args , 1 , true );
257259 int i = PlaceholderUtils .toInt (args .get (0 ));
258260 PlaceholderUtils .checkArgs (args , i + 1 , true );
259- return args .get (i + 1 );
261+ return new MultiLineComponent ( args .get (i + 1 )). setIgnoreSpaces ( true );
260262 }
261263 });
262264 PlaceholderHandler .addPlaceholder (new Placeholder ("redstone" ) {
@@ -290,7 +292,7 @@ public MultiLineComponent apply(PlaceholderContext ctx,
290292 int i = PlaceholderUtils .toInt (args .get (0 ));
291293 if (ctx .previousText () == null ) throw new NotSupportedException ();
292294 PlaceholderUtils .checkRange ("line" , 1 , ctx .previousText ().size (), i );
293- return MultiLineComponent .of (ctx .previousText ().get (i - 1 ));
295+ return MultiLineComponent .of (ctx .previousText ().get (i - 1 )). setIgnoreSpaces ( true ) ;
294296 }
295297 });
296298 PlaceholderHandler .addPlaceholder (new Placeholder ("progress" ) {
@@ -407,7 +409,8 @@ public MultiLineComponent apply(PlaceholderContext ctx,
407409 if (GTStringUtils .equals (args .get (2 ), "" )) args .set (2 , MultiLineComponent .literal (p ));
408410 if (GTStringUtils .equals (args .get (0 ), "get" ))
409411 return MultiLineComponent
410- .literal (data .getString (PlaceholderUtils .toInt (args .get (2 )) % capacity ));
412+ .literal (data .getString (PlaceholderUtils .toInt (args .get (2 )) % capacity ))
413+ .setIgnoreSpaces (true );
411414 else if (args .get (0 ).equalsString ("set" )) {
412415 data .set (PlaceholderUtils .toInt (args .get (2 )) % capacity ,
413416 StringTag .valueOf (args .get (3 ).toString ()));
@@ -438,8 +441,7 @@ public MultiLineComponent apply(PlaceholderContext ctx, List<MultiLineComponent>
438441 out .append (args .get (i ));
439442 if (i != args .size () - 1 ) out .append (" " );
440443 }
441- out .setIgnoreSpaces (true );
442- return out ;
444+ return out .setIgnoreSpaces (true );
443445 }
444446 });
445447 PlaceholderHandler .addPlaceholder (new Placeholder ("nbt" ) {
@@ -488,7 +490,7 @@ public MultiLineComponent apply(PlaceholderContext ctx,
488490 public MultiLineComponent apply (PlaceholderContext ctx ,
489491 List <MultiLineComponent > args ) throws PlaceholderException {
490492 PlaceholderUtils .checkArgs (args , 1 );
491- return MultiLineComponent .literal ((char ) PlaceholderUtils .toInt (args .get (0 )));
493+ return MultiLineComponent .literal ((char ) PlaceholderUtils .toInt (args .get (0 ))). setIgnoreSpaces ( true ) ;
492494 }
493495 });
494496 PlaceholderHandler .addPlaceholder (new Placeholder ("subList" ) {
@@ -504,6 +506,7 @@ public MultiLineComponent apply(PlaceholderContext ctx,
504506 MultiLineComponent out = MultiLineComponent .empty ();
505507 for (int i = l ; i < r - 1 ; i ++) out .append (args .get (i )).append (' ' );
506508 out .append (args .get (r - 1 ));
509+ out .setIgnoreSpaces (true );
507510 return out ;
508511 }
509512 });
@@ -807,5 +810,14 @@ public MultiLineComponent apply(PlaceholderContext ctx,
807810 }
808811 }
809812 });
813+ PlaceholderHandler .addPlaceholder (new Placeholder ("eval" ) {
814+
815+ @ Override
816+ public MultiLineComponent apply (PlaceholderContext ctx ,
817+ List <MultiLineComponent > args ) throws PlaceholderException {
818+ PlaceholderUtils .checkArgs (args , 1 );
819+ return PlaceholderHandler .processPlaceholders (args .get (0 ).toString (), ctx );
820+ }
821+ });
810822 }
811823}
0 commit comments