{
if(l2p.extensions.scripts.ScriptManager.loading)
{
return null;
}
ScriptObject o;
Script scriptClass = ScriptManager.getInstance().getClasses().get(_class);
if(scriptClass == null)
{
_log.info("Script class " + _class + " not found");
return null;
}
try
{
o = scriptClass.newInstance();
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
if(variables != null && variables.size() > 0)
{
for(Map.Entry<String, Object> obj : variables.entrySet())
{
try
{
o.setProperty(obj.getKey(), obj.getValue());
}
catch(Exception e)
{
}
}
}
try
{
o.setProperty("self", getStoredId());
}
catch(Exception e)
{
e.printStackTrace();
}
Object ret = args == null ? o.invokeMethod(method) : o.invokeMethod(method, args);
try
{
o.setProperty("self", null);
}
catch(Exception e)
{
e.printStackTrace();
}