File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
src/main/java/com/cleanroommc/groovyscript/sandbox Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -74,12 +74,12 @@ public static JsonObject createDefaultJson() {
7474 private final String asmClass = null ;
7575 private boolean debug ;
7676
77-
7877 private final boolean invalidPackId ;
7978 private boolean warnedAboutInvalidPackId ;
8079 private int packmodeConfigState ;
8180
8281 public static final String [] GROOVY_SUFFIXES = SandboxData .GROOVY_SUFFIXES ;
82+ private static final Pattern ID_PATTERN = Pattern .compile ("[a-z0-9_]+" );
8383
8484 public static boolean isGroovyFile (String path ) {
8585 return SandboxData .isGroovyFile (path );
@@ -88,8 +88,7 @@ public static boolean isGroovyFile(String path) {
8888 public RunConfig (JsonObject json ) {
8989 String name = JsonHelper .getString (json , "" , "packName" , "name" );
9090 String id = JsonHelper .getString (json , "" , "packId" , "id" );
91- Pattern idPattern = Pattern .compile ("[a-z_]+" );
92- this .invalidPackId = id .isEmpty () || !idPattern .matcher (id ).matches ();
91+ this .invalidPackId = id .isEmpty () || !ID_PATTERN .matcher (id ).matches ();
9392 if (name .isEmpty () && !this .invalidPackId ) {
9493 name = CaseFormat .LOWER_UNDERSCORE .to (CaseFormat .UPPER_CAMEL , id ).replace ('_' , ' ' );
9594 }
You can’t perform that action at this time.
0 commit comments