Added ids to settings map & added logger

This commit is contained in:
JKetelaar
2015-04-27 22:47:24 +02:00
parent 576067963d
commit d0103875eb
15 changed files with 161 additions and 42 deletions
@@ -4,11 +4,8 @@ import org.parabot.core.Context;
import org.parabot.core.Core;
import org.parabot.core.ui.BotUI;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.AbstractFramework;
import org.parabot.environment.scripts.framework.*;
import org.parabot.environment.scripts.framework.Frameworks;
import org.parabot.environment.scripts.framework.LoopTask;
import org.parabot.environment.scripts.framework.SleepCondition;
import org.parabot.environment.scripts.framework.Strategy;
import org.parabot.environment.scripts.randoms.Random;
import java.util.Collection;
@@ -68,7 +65,15 @@ public class Script implements Runnable {
@Override
public final void run() {
Context context = Context.getInstance();
// Core.verbose("Initializing security manager...");
// String previousPolicy = System.getProperty("java.security.policy");
// SecurityManager previousSecurityManager = System.getSecurityManager();
// System.setProperty("java.security.policy", Directories.getSettingsPath() + "/java.policy");
// SecurityManagerDemo sm = new SecurityManagerDemo();
// System.setSecurityManager(sm);
Core.verbose("Initializing script...");
context.getServerProvider().initScript(this);
Core.verbose("Done.");
@@ -122,6 +127,8 @@ public class Script implements Runnable {
this.state = STATE_STOPPED;
context.setRunningScript(null);
BotUI.getInstance().toggleRun();
// System.setProperty("java.security.policy", previousPolicy);
// System.setSecurityManager(previousSecurityManager);
Core.verbose("Done.");
}
@@ -19,7 +19,8 @@ public abstract class ScriptExecuter {
* @param script
*/
public final void finalize(final ThreadGroup tg, final Script script) {
new Thread(tg, script).start();
Thread thread = new Thread(tg, script);
thread.start();
}
@@ -0,0 +1,5 @@
package org.parabot.environment.scripts.executers;
public class SecurityManagerDemo extends SecurityManager {
}
@@ -1,6 +1,7 @@
package org.parabot.environment.scripts.randoms;
import org.parabot.core.Core;
import org.parabot.core.ui.Logger;
import java.util.ArrayList;
@@ -89,7 +90,7 @@ public class RandomHandler {
public boolean checkAndRun() {
for(Random r : this.activeRandoms) {
if(r.activate()) {
Core.verbose("Running random '" + r.getName() + "'.");
Logger.addMessage("Running random '" + r.getName() + "'.");
r.execute();
return true;
}
@@ -3,6 +3,7 @@ package org.parabot.environment.servers.executers;
import org.parabot.core.Context;
import org.parabot.core.parsers.randoms.RandomParser;
import org.parabot.core.ui.components.PaintComponent;
import org.parabot.environment.scripts.executers.SecurityManagerDemo;
import org.parabot.environment.servers.ServerProvider;
/**