Пример #1
0
  private void displayCategory(Category c, Player p) {
    p.sendMessage("----Available Commands and Sub-Categories----");
    p.sendMessage("-----------------------------------------");
    for (Command com : c.listCommands()) {
      p.sendMessage(com.toString());
    }

    for (Category subCat : c.listCategories()) {
      p.sendMessage(subCat.toString());
    }
  }
Пример #2
0
  private static void parseNode(Node n, Category parent) {
    String name = n.getNodeName();
    if (name.equals("Category")) {
      Category cat = parseCategory(n);
      parent.addCategory(cat);
    }

    if (name.equals("Command")) {
      Command com = parseCommand(n);
      parent.addCommand(com);
    }
  }
Пример #3
0
  public void update(Player p, String value, boolean showPrompt) {
    if (value.equals("reset")) {
      reset();
      return;
    }

    if (activeCom != null) {
      activeCom.update(this, value);
      if (showPrompt) nextPrompt(p);
    }

    if (activeCat != null) {
      activeCat.update(this, value);
      if (showPrompt) nextPrompt(p);
    }

    if (activeCom == null && activeCat == null) {
      rootNode.update(this, value);
      if (showPrompt) nextPrompt(p);
    }
  }