Example #1
0
  /**
   * Gets the session for the player.
   *
   * @param player
   * @return
   */
  public EditSession createEditSession(Player player) {
    LocalPlayer wePlayer = wrapPlayer(player);
    LocalSession session = controller.getSession(wePlayer);
    BlockBag blockBag = session.getBlockBag(wePlayer);

    EditSession editSession =
        controller
            .getEditSessionFactory()
            .getEditSession(wePlayer.getWorld(), session.getBlockChangeLimit(), blockBag, wePlayer);
    editSession.enableQueue();

    return editSession;
  }
Example #2
0
  @Override
  public boolean act(
      ServerInterface server,
      LocalConfiguration config,
      LocalPlayer player,
      LocalSession session,
      WorldVector clicked) {

    LocalWorld world = clicked.getWorld();
    EditSession editSession = new EditSession(server, world, session.getBlockChangeLimit());

    try {
      editSession.makePineTree(clicked.add(0, 1, 0));
    } catch (MaxChangedBlocksException e) {
      player.printError("Max blocks change limit reached.");
    } finally {
      session.remember(editSession);
    }

    return true;
  }