File tree Expand file tree Collapse file tree
dev.skidfuscator.obfuscator/src/main/java/dev/skidfuscator/obfuscator/transform/impl/misc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ allprojects {
2323 testImplementation ' org.junit.jupiter:junit-jupiter-api:5.9.0'
2424 testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.9.0'
2525 }
26+
27+ compileJava {
28+ options. encoding = " UTF-8" // Will fail on the non-ascii comments if not set
29+ }
2630}
2731
2832group ' dev.skidfuscator.community'
Original file line number Diff line number Diff line change 2626import java .util .Arrays ;
2727import java .util .List ;
2828import java .util .Stack ;
29+ import java .util .concurrent .ThreadLocalRandom ;
30+ import java .util .stream .Collectors ;
2931
3032public class AhegaoTransformer extends AbstractTransformer {
33+
34+ private static final String DEFAULT_AHEGAO_FIELD_NAME = "nothing_to_see_here" ;
35+
3136 public AhegaoTransformer (Skidfuscator skidfuscator ) {
3237 super (skidfuscator , "Ahegao" );
3338 }
@@ -43,9 +48,17 @@ void handle(final FinalClassTransformEvent event) {
4348 return ;
4449 }
4550
51+ List <String > fieldNames = classNode .getFields ().stream ()
52+ .map (FieldNode ::getName )
53+ .collect (Collectors .toList ());
54+
55+ String ahegaoName = DEFAULT_AHEGAO_FIELD_NAME ;
56+ while (fieldNames .contains (ahegaoName ))
57+ ahegaoName += (char ) ThreadLocalRandom .current ().nextInt (Character .MAX_CODE_POINT );
58+
4659 final FieldNode mapleNode = new SkidFieldNodeBuilder (skidfuscator , classNode )
4760 .access (Opcodes .ACC_PRIVATE | Opcodes .ACC_STATIC )
48- .name ("nothing_to_see_here" )
61+ .name (ahegaoName )
4962 .desc ("[Ljava/lang/String;" )
5063 .signature (null )
5164 .value (null )
You can’t perform that action at this time.
0 commit comments