Package org.spout.vanilla.scoreboard

Examples of org.spout.vanilla.scoreboard.Scoreboard


          correctName = p.getName().equals(playerName);
        }
      }

      // check if the team is correct if specified
      Scoreboard board = p.get(Scoreboard.class);
      boolean correctTeam = teamName == null; // default to whether the team name is set
      if (teamName != null && board != null) {
        Team team = board.getTeam(teamName);
        if (team != null) {
          if (teamNameInverted) {
            // make sure the player is not on the specified team
            correctTeam = !team.getPlayerNames().contains(p.getName());
          } else {
            // make sure the player is on the specified team
            correctTeam = team.getPlayerNames().contains(p.getName());
          }
        }
      }

      // make sure the player has the right amount of points for the specified objectives
      boolean enoughPoints = minScores.isEmpty() && maxScores.isEmpty(); // default to whether there are any objectives set
      if (board != null) {
        // first make sure the player has the minimum requirements
        for (Map.Entry<String, Integer> e : minScores.entrySet()) {
          Objective obj = board.getObjective(e.getKey());
          if (obj == null) {
            continue;
          }

          int score = obj.getScore(p.getName()); // player's score for specified objective
          int minScore = e.getValue(); // specified minimum score
          enoughPoints = score >= minScore;
          if (!enoughPoints) {
            // not enough? break.
            break;
          }
        }

        // next make sure the player isn't over the maximums
        for (Map.Entry<String, Integer> e : maxScores.entrySet()) {
          Objective obj = board.getObjective(e.getKey());
          if (obj == null) {
            continue;
          }

          int score = obj.getScore(p.getName()); // player's score for specified objective
View Full Code Here


    args.assertCompletelyParsed();

    String name = player.getName();
    player.sendMessage(ChatStyle.GREEN + "Displaying scoreboard...");

    Scoreboard scoreboard = player.add(Scoreboard.class);
    scoreboard.createObjective("test_obj_1")
        .setDisplayName(ChatStyle.GREEN + "Test Objective 1")
        .setScore(name, 9001)
        .setCriteria(Objective.CRITERIA_HEALTH)
        .setSlot(ObjectiveSlot.SIDEBAR);

    scoreboard.createObjective("test_obj_2")
        .setDisplayName(ChatStyle.DARK_AQUA + "Test Objective 2")
        .setScore(name, 0)
        .setCriteria(Objective.CRITERIA_TOTAL_KILL_COUNT)
        .setSlot(ObjectiveSlot.LIST);
  }
View Full Code Here

    args.assertCompletelyParsed();

    String name = player.getName();
    player.sendMessage("Creating team...");

    Scoreboard scoreboard = player.get(Scoreboard.class);
    if (scoreboard == null) {
      throw new CommandException("You do not have an active scoreboard.");
    }

    Team t = scoreboard.createTeam("spoutdev");
    t.setDisplayName(ChatStyle.DARK_AQUA + "Spout", false);
    t.setPrefix(ChatStyle.GREEN.toString(), true);
    t.addPlayerName(name);
  }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.scoreboard.Scoreboard

Copyright © 2018 www.massapicom. 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.