Esempio n. 1
0
  @Override
  public void onDisable() {
    circuitPersistence.saveCircuits();
    circuitManager.shutdownAllCircuits();
    circuitPersistence.clearLoadedWorldsList();

    String msg = getDescription().getName() + " " + getDescription().getVersion() + " disabled.";
    log.info(msg);
  }
Esempio n. 2
0
  /**
   * Prints a chip block info. When block points to a chip pin, the player receives an /rcpin
   * message of this pin. When block points to an activation block, debug mode is toggled for this
   * player. When block points to any other structure block the chip info is sent.
   *
   * @param player The player to send the info message to.
   * @param block Queried block.
   */
  public void probeChipBlock(Player player, Block block) {
    try {
      RCpin.printPinInfo(block, player, this);
    } catch (IllegalArgumentException ie) {
      // not probing a pin
      Circuit c = circuitManager.getCircuitByStructureBlock(block.getLocation());

      if (c != null) {
        if (c.activationBlock.equals(block.getLocation())) player.performCommand("rcdebug");
        else RCinfo.printCircuitInfo(player, c, this);
      }
    }
  }
Esempio n. 3
0
  private void postStartup() {
    if (!circuitPersistence.loadOldFile()) {
      for (World w : getServer().getWorlds()) {
        if (!circuitPersistence.isWorldLoaded(w)) circuitPersistence.loadCircuits(w);
      }
    }

    circuitPersistence.loadChannels();
    log(Level.INFO, "Processing " + circuitManager.getCircuits().size() + " active chip(s).");

    Runnable updater =
        new Runnable() {

          @Override
          public void run() {
            String ver;
            try {
              ver = checkUpdate();
            } catch (IOException ex) {
              log(
                  Level.WARNING,
                  "Couldn't check for an update (" + ex.getClass().getSimpleName() + ").");
              return;
            }
            if (ver != null) {
              log(
                  Level.INFO,
                  "A new RedstoneChips version ("
                      + ver
                      + ") is available.\n"
                      + "To download the update go to: http://eisental.github.com/RedstoneChips");
            }
          }
        };
    getServer().getScheduler().scheduleAsyncDelayedTask(this, updater);
  }