@@ -1688,7 +1688,7 @@ public enum ScriptActionType {
16881688
16891689 STRIP_COLOR (builder -> builder .name ("Strip Color from Text" )
16901690 .description ("Searches for color codes in a text and removes them." )
1691- .icon (Items .WRITABLE_BOOK )
1691+ .icon (Items .CYAN_DYE )
16921692 .arg ("Result" , ScriptActionArgumentType .VARIABLE )
16931693 .arg ("Text" , ScriptActionArgumentType .TEXT , b -> b .optional (true ))
16941694 .category (ScriptActionCategory .TEXTS )
@@ -1704,6 +1704,26 @@ public enum ScriptActionType {
17041704 result = result .replaceAll ("&x(&[0-9a-fA-F]){6}" , "" );
17051705 result = result .replaceAll ("&[0-9a-fA-FlonmkrLONMKR]" , "" );
17061706
1707+ ctx .context ().setVariable (ctx .variable ("Result" ).name (), new ScriptTextValue (result ));
1708+ })),
1709+
1710+ REPEAT_TEXT (builder -> builder .name ("Repeat Text" )
1711+ .description ("Repeats a text the given number of times." )
1712+ .icon (Items .REPEATING_COMMAND_BLOCK )
1713+ .arg ("Result" , ScriptActionArgumentType .VARIABLE )
1714+ .arg ("Text to repeat" , ScriptActionArgumentType .TEXT )
1715+ .arg ("Times to repeat" , ScriptActionArgumentType .NUMBER )
1716+ .category (ScriptActionCategory .TEXTS )
1717+ .action (ctx -> {
1718+ String result = "" ;
1719+ String input = ctx .value ("Text to repeat" ).asText ();
1720+ int times = (int ) ctx .value ("Times to repeat" ).asNumber ();
1721+
1722+ for (int i = 0 ; i < times ; i ++)
1723+ {
1724+ result += input ;
1725+ }
1726+
17071727 ctx .context ().setVariable (ctx .variable ("Result" ).name (), new ScriptTextValue (result ));
17081728 }));
17091729
0 commit comments