Пример #1
0
  /**
   * Construct a new script engine. Each engine has its own global state that persists across calls
   * to run scripts.
   *
   * @param services
   */
  public ScriptRunner(ServiceManager services) {
    this.services = services;

    // If theres's console, install our own console
    final ConsoleManager consoleManager = services.findService(ConsoleManager.class);
    if (consoleManager != null) {
      consoleManager.addParticipant(new Console());
    }
  }
Пример #2
0
 /**
  * Helper function to support scripting.
  *
  * @param services
  */
 public static EntityPrototypeDatabase findService(ServiceManager services) {
   return services.findService(EntityPrototypeDatabase.class);
 }