mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 15:45:10 +00:00
Implemented banned classes config for Nashorn scripts.
This commit is contained in:
1 parent
c24a900f18
commit
df88e5b4f9
2 files changed
+34
-2
No files matched your search
@@ -11,6 +11,8 @@ import noppes.npcs.config.legacy.LegacyConfig;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ConfigScript
|
||||
@@ -50,6 +52,9 @@ public class ConfigScript
|
||||
public static Property ScriptDevIDsProperty;
|
||||
public static String ScriptDevIDs = "";
|
||||
|
||||
public static Property BannedClassesProperty;
|
||||
public final static HashSet<String> BannedClasses = new HashSet<>();
|
||||
|
||||
public static void init(File configFile)
|
||||
{
|
||||
config = new Configuration(configFile);
|
||||
@@ -133,6 +138,16 @@ public class ConfigScript
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
BannedClassesProperty = config.get(CUSTOMIZATION, "Banned Classes", "java.net.URL,java.net.URI",
|
||||
"Comma separated list of classes that cannot be used in scripts through Java.for().\n" +
|
||||
"Classes must be fully written out with library names preceding them.\n" +
|
||||
"This is a feature ONLY AVAILABLE ON NASHORN.");
|
||||
String bannedClassesString = BannedClassesProperty.getString();
|
||||
|
||||
try {
|
||||
BannedClasses.clear();
|
||||
BannedClasses.addAll(Arrays.asList(bannedClassesString.split(",")));
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user