I am currently making a scripting system for Minecraft. It works by taking a script that a user has made and then compiling and loading it at runtime. An instance of the script is created and gets an instance of the API passed to it. This all works very well so far, but I need to "sandbox" the script. I want the script to only have access to the API and a few basic classes like String and Array. Someone has told me that you can use ProtectionDomain to do this, but so far I haven't been able to figure it out. I've done some google searches on it, and haven't really found anything.
Thanks in advance.