Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.99 KB | None | 0 0
  1.         // script load should NOT be used in place of reload.  If a script is already loaded
  2.         // successfully, quest_reload ought to be used.  The script_load command should only
  3.         // be used for scripts that failed to load altogether (eg. due to errors) or that
  4.         // did not at all exist during server boot.  Using script_load to re-load a previously
  5.         // loaded script may cause unpredictable script flow, minor loss of data, and more.
  6.         // This provides a way to load new scripts without having to reboot the server.
  7.         else if (command.startsWith("admin_script_load"))
  8.         {
  9.             String[] parts = command.split(" ");
  10.             if (parts.length < 2)
  11.             {
  12.                 //activeChar.sendMessage("Example: //script_load <questFolder>/<questSubFolders...>/<filename>.<ext> ");
  13.                 activeChar.sendMessage("Example: //script_load quests/SagasSuperclass/__init__.py");
  14.             }
  15.             else
  16.             {
  17.                 File file = new File(L2ScriptEngineManager.SCRIPT_FOLDER, parts[1]);
  18.                 if (file.isFile())
  19.                 {
  20.                     if (RunS(file, activeChar))
  21.                         return true;
  22.                     }
  23.                 else
  24.                     {
  25.                     String cmd = parts[1];
  26.                     if ((!cmd.contains(".java")) && (!cmd.contains(".py")))
  27.                     {
  28.                         cmd = "ai/individual/"+parts[1]+".java";
  29.                         File file2 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, cmd);
  30.                         if (file2.isFile())
  31.                             if (RunS(file2, activeChar))
  32.                                 return true;
  33.  
  34.                         cmd = "ai/individual/"+parts[1]+".py";
  35.                         file2 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, cmd);
  36.                         if (file2.isFile())
  37.                             if (RunS(file2, activeChar))
  38.                                 return true;
  39.  
  40.                         cmd = "ai/group_template/"+parts[1]+".java";
  41.                         file2 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, cmd);
  42.                         if (file2.isFile())
  43.                             if (RunS(file2, activeChar))
  44.                                 return true;
  45.  
  46.                         cmd = "ai/group_template/"+parts[1]+".py";
  47.                         file2 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, cmd);
  48.                         if (file2.isFile())
  49.                             if (RunS(file2, activeChar))
  50.                                 return true;
  51.  
  52.                         cmd = "instances/"+parts[1]+"/"+parts[1]+".java";
  53.                         file2 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, cmd);
  54.                         if (file2.isFile())
  55.                             if (RunS(file2, activeChar))
  56.                                 return true;
  57.  
  58.                         cmd = "instances/"+parts[1]+"/"+parts[1]+".py";
  59.                         file2 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, cmd);
  60.                         if (file2.isFile())
  61.                             if (RunS(file2, activeChar))
  62.                                 return true;
  63.  
  64.                         cmd = "quests/"+parts[1]+"/"+parts[1]+".java";
  65.                         file2 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, cmd);
  66.                         if (file2.isFile())
  67.                             if (RunS(file2, activeChar))
  68.                                 return true;
  69.  
  70.                         cmd = "quests/"+parts[1]+"/"+parts[1]+".py";
  71.                         file2 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, cmd);
  72.                         if (file2.isFile())
  73.                             if (RunS(file2, activeChar))
  74.                                 return true;
  75.  
  76.                         cmd = "quests/"+parts[1]+"/__init__.py";
  77.                         file2 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, cmd);
  78.                         if (file2.isFile())
  79.                             if (RunS(file2, activeChar))
  80.                                 return true;
  81.  
  82.                 }
  83.                     activeChar.sendMessage("File Not Found: " + parts[1]);
  84.                 }
  85.             }
  86.            
  87.         }
  88.         return true;
  89.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement