示例#1
0
  public MainMenu(Game game) {
    super(game);
    guiCam = new Camera2D(glGraphics, 320, 480);
    batcher = new SpriteBatcher(glGraphics, 100);
    soundBounds = new Rectangle(0, 0, 64, 64);
    playBounds = new Rectangle(160 - 150, 200 + 18, 300, 36);
    highscoresBounds = new Rectangle(160 - 150, 200 - 18, 300, 36);
    helpBounds = new Rectangle(160 - 150, 200 - 18 - 36, 300, 36);
    touchPoint = new Vector2();

    Settings.load(game.getFileIO());
  }
示例#2
0
 public void init(InputStream oldStdin, PipeOutputStream stdin, PipeInputStream stdout)
     throws IOException {
   this.stdoutPipe = stdout;
   this.stdinPipe = stdin;
   this.oldStdin = oldStdin;
   settings.load();
   updater = new Updater();
   UserRegistry.REGISTRY.load();
   manager = new XMPPChatManager();
   copier = new StreamCopier(oldStdin, stdinPipe);
   parser = new LogParser(stdoutPipe);
 }
示例#3
0
文件: SRPG.java 项目: Nagib/sRPG
  @Override
  public void onEnable() {
    this.saveDefaultConfig();

    // set all instance related references
    plugin = this;
    pm = getServer().getPluginManager();
    Settings.dataFolder = getDataFolder();

    for (String command : new String[] {"srpg"}) {
      getCommand(command).setExecutor(commandListener);
    }

    // create plugins/SRPG/
    getDataFolder().mkdirs();
    // try to load settings, disable plugin on fail

    boolean disable = false;
    settings.load();
    if (database == null || !database.connect()) {
      output("disabling plugin");
      disable = true;
    }
    if (disable) {
      pm.disablePlugin(this);
    } else {
      pm.registerEvents(new DamageEventListener(), this);
      pm.registerEvents(new SpawnEventListener(), this);
      pm.registerEvents(new PlayerEventListener(), this);
      pm.registerEvents(new BlockEventListener(), this);

      pdfFile = this.getDescription();
      output(pdfFile.getName() + " v" + pdfFile.getVersion() + " has been enabled.");
      database.updateDatabase(pdfFile.getVersion());
      this.getServer().getScheduler().scheduleSyncRepeatingTask(this, timedEffectManager, 20, 20);
      this.getServer().getScheduler().scheduleSyncRepeatingTask(this, cascadeQueueScheduler, 1, 1);
      spawnListener.addExistingCreatures();
      Watcher.addWorlds(plugin.getServer().getWorlds());
    }
  }
示例#4
0
  BARControl(String[] args) {
    try {
      // load settings
      Settings.load();

      // parse arguments
      parseArguments(args);

      // init display
      display = new Display();

      // connect to server
      LoginData loginData = new LoginData(serverName, serverPort, serverTLSPort);
      boolean connectOkFlag = false;
      if ((loginData.serverName != null)
          && !loginData.serverName.equals("")
          && (loginData.password != null)
          && !loginData.password.equals("")
          && !loginDialogFlag) {
        // connect to server with preset data
        try {
          BARServer.connect(
              loginData.serverName,
              loginData.port,
              loginData.tlsPort,
              loginData.password,
              serverKeyFileName);
          connectOkFlag = true;
        } catch (ConnectionError error) {
        }
      }
      while (!connectOkFlag) {
        // get login data
        if (!getLoginData(loginData)) {
          System.exit(0);
        }
        if ((loginData.port == 0) && (loginData.tlsPort == 0)) {
          throw new Error("Cannot connect to server. No server ports specified!");
        }
        /// ??? host name scheck

        // connect to server
        try {
          BARServer.connect(
              loginData.serverName,
              loginData.port,
              loginData.tlsPort,
              loginData.password,
              serverKeyFileName);
          connectOkFlag = true;
        } catch (ConnectionError error) {
          if (!Dialogs.confirmError(
              new Shell(),
              "Connection fail",
              "Error: " + error.getMessage(),
              "Try again",
              "Cancel")) {
            System.exit(1);
          }
        }
      }

      // open main window
      createWindow();
      createTabs();
      createMenu();

      // run
      run();

      // disconnect
      BARServer.disconnect();

      // save settings
      Settings.save();
    } catch (org.eclipse.swt.SWTException exception) {
      System.err.println("ERROR graphics: " + exception.getCause());
      if (debug) {
        for (StackTraceElement stackTraceElement : exception.getStackTrace()) {
          System.err.println("  " + stackTraceElement);
        }
      }
    } catch (CommunicationError communicationError) {
      System.err.println("ERROR communication: " + communicationError.getMessage());
    } catch (AssertionError assertionError) {
      System.err.println("INTERNAL ERROR: " + assertionError.toString());
      for (StackTraceElement stackTraceElement : assertionError.getStackTrace()) {
        System.err.println("  " + stackTraceElement);
      }
      System.err.println("");
      System.err.println("Please report this assertion error to [email protected].");
    } catch (InternalError error) {
      System.err.println("INTERNAL ERROR: " + error.getMessage());
    } catch (Error error) {
      System.err.println("ERROR: " + error.getMessage());
      if (debug) {
        for (StackTraceElement stackTraceElement : error.getStackTrace()) {
          System.err.println("  " + stackTraceElement);
        }
      }
    }
  }
示例#5
0
文件: Flarf.java 项目: BangL/Flarf
 public void load() {
   Settings.load(this);
   Localization.init(this, Settings.localfile);
 }