Examples of NameBuilder


Examples of games.stendhal.common.NameBuilder

   * @return <code>true</code> if was handled.
   */
  public boolean execute(final String[] params, final String remainder) {
    final RPAction summon = new RPAction();

    final NameBuilder nameBuilder = new NameBuilder();
    Integer x = null;
    Integer y = null;

    for (int i = 0; i < params.length; ++i) {
      final String str = params[i];

      if (str != null) {
        if (str.matches("[0-9].*")) {
              try {
                final Integer num = new Integer(str);

                if (x == null) {
                  x = num;
                } else if (y == null) {
                  y = num;
                } else {
                  nameBuilder.append(str);
                }
              } catch (final NumberFormatException e) {
                ClientSingletonRepository.getUserInterface().addEventLine(new StandardEventLine("Invalid number: " + str));
                return true;
              }
          } else {
            nameBuilder.append(str);
          }
      }
    }

    summon.put("type", "summon");
    summon.put("creature", nameBuilder.toString());

    if (x != null) {
      if (y != null) {
          summon.put("x", x);
          summon.put("y", y);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.