Examples of Objective


Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.Objective

      for (String key : Current.GameStates.keySet())
      {
        GameState gs = Current.GameStates.get(key);
        for (String objKey : gs.getMap().getObjectives().keySet())
        {
          Objective obj = gs.getMap().getObjectives().get(objKey);
          Trigger trg = obj.getTrigger();
          switch (trg.getType())
          {
            case BLOCK_BREAK:
              ProcessBlockBreak(gs, obj);
              break;
View Full Code Here

Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.Objective

        break;
      }
      count++;
    }

    Objective obj = gs.getMap().getObjectives().get(key);

    if (obj != null)
    {
      if (gs.getCompletedObjectives().contains(key))
      {
        result = ChatColor.GREEN + "[Done] " + ChatColor.WHITE;
      }
      else
      {
        result = ChatColor.RED + "[      ] " + ChatColor.WHITE;
      }
      result = result + obj.getText() + ChatColor.BLUE + " (" + obj.getScoreValue() + ")";
    }

    return result;
  }
View Full Code Here

Examples of net.citizensnpcs.questers.quests.Objective

    @Override
    public boolean update(Event event, ObjectiveProgress progress) {
        if (event instanceof PlayerMoveEvent) {
            PlayerMoveEvent ev = (PlayerMoveEvent) event;
            Objective objective = progress.getObjective();
            double leeway = objective.hasParameter("leeway") ? objective.getParameter("leeway").getDouble() : objective
                    .getAmount();
            if (LocationUtils.withinRange(ev.getTo(), objective.getLocation(), leeway)
                    && withinYawRange(ev.getTo(), objective)) {
                if (!objective.hasParameter("time"))
                    return true;
                return updateTime(objective.getParameter("time").getInt(), progress.getPlayer());
            } else
                reachTimes.remove(progress.getPlayer());
        }
        return false;
    }
View Full Code Here

Examples of net.md_5.bungee.api.score.Objective

    {
        Scoreboard serverScoreboard = con.getServerSentScoreboard();
        switch ( objective.getAction() )
        {
            case 0:
                serverScoreboard.addObjective( new Objective( objective.getName(), objective.getValue(), objective.getType() ) );
                break;
            case 1:
                serverScoreboard.removeObjective( objective.getName() );
                break;
            case 2:
                Objective oldObjective = serverScoreboard.getObjective( objective.getName() );
                if ( oldObjective != null )
                {
                    oldObjective.setValue( objective.getValue() );
                }
                break;
            default:
                throw new IllegalArgumentException( "Unknown objective action: " + objective.getAction() );
        }
View Full Code Here

Examples of org.bukkit.scoreboard.Objective

    this.bombThieves.clear();
    this.cakeThieves.clear();
    if (this.getScoreboardType() != ScoreboardType.NONE) {
      this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
      scoreboard.registerNewObjective(this.getScoreboardType().getDisplayName(), "dummy");
      Objective obj = scoreboard.getObjective(this.getScoreboardType().getDisplayName());
      Validate.isTrue(obj.isModifiable(), "Cannot modify players' scores on the " + this.name + " scoreboard.");
      for (Team team : this.getTeams()) {
        String teamName = team.getKind().getColor() + team.getName() + ChatColor.RESET;
        if (this.getScoreboardType() == ScoreboardType.POINTS) {
          obj.getScore(Bukkit.getOfflinePlayer(teamName)).setScore(team.getPoints());
        } else if (this.getScoreboardType() == ScoreboardType.LIFEPOOL) {
          obj.getScore(Bukkit.getOfflinePlayer(teamName)).setScore(team.getRemainingLifes());
        }
      }
      obj.setDisplaySlot(DisplaySlot.SIDEBAR);
      for (Team team : this.getTeams()) {
        for (Player player : team.getPlayers()) {
          player.setScoreboard(scoreboard);
        }
      }
View Full Code Here

Examples of org.bukkit.scoreboard.Objective

    }
    if (attackerTeam.getTeamConfig().resolveBoolean(TeamConfig.KILLSTREAK)) {
      War.war.getKillstreakReward().rewardPlayer(attacker, this.getKillCount(attacker.getName()));
    }
    if (this.getScoreboard() != null && this.getScoreboardType() == ScoreboardType.TOPKILLS) {
      Objective obj = this.getScoreboard().getObjective("Top kills");
      obj.getScore(attacker).setScore(this.getKillCount(attacker.getName()));
    }
    if (defenderTeam.getTeamConfig().resolveBoolean(TeamConfig.INVENTORYDROP)) {
      dropItems(defender.getLocation(), defender.getInventory().getContents());
      dropItems(defender.getLocation(), defender.getInventory().getArmorContents());
    }
View Full Code Here

Examples of org.bukkit.scoreboard.Objective

  public void setRemainingLives(int remainingLives) {
    this.remainingLives = remainingLives;
    if (this.warzone.getScoreboard() != null && this.warzone.getScoreboardType() == ScoreboardType.LIFEPOOL) {
      String teamName = kind.getColor() + name + ChatColor.RESET;
      OfflinePlayer teamPlayer = Bukkit.getOfflinePlayer(teamName);
      Objective obj = this.warzone.getScoreboard().getObjective("Lifepool");
      obj.getScore(teamPlayer).setScore(remainingLives);
    }
  }
View Full Code Here

Examples of org.bukkit.scoreboard.Objective

        if (board == null) {
            dB.echoError(scriptEntry.getResidingQueue(), "Scoreboard " + id.asString() + " does not exist!");
            return;
        }

        Objective obj = null;

        if (act.equals(Action.ADD)) {

            if (objective != null) {
                // Try getting the objective from the board
                obj = board.getObjective(objective.asString());

                // Create the objective if it does not already exist
                if (obj == null) {
                    obj = board.registerNewObjective(objective.asString(), criteria.asString());
                }
                // If a different criteria has been set for this objective,
                // recreate the objective
                else if (criteria != null && !obj.getCriteria().equals(criteria.asString())) {
                    obj.unregister();
                    obj = board.registerNewObjective(objective.asString(), criteria.asString());
                }

                // Change the objective's display slot
                if (!displaySlot.asString().equalsIgnoreCase("none")) {
                    obj.setDisplaySlot(DisplaySlot.valueOf(displaySlot.asString().toUpperCase()));
                }

                obj.setDisplayName(objective.asString());

                if (!lines.isEmpty()) {
                    // If we've gotten this far, but the score is null,
                    // use a score of 0
                    if (score == null) score = new Element(0);

                    // Set all the score lines in the scoreboard, creating fake players
                    // for those lines that are not meant to track players
                    //
                    // Read https://forums.bukkit.org/threads/help-with-multi-line-scoreboards.181149/
                    // for clarifications
                    for (String line : lines) {
                        line = line.replaceAll("[pP]@", "");
                        if (line.length() > 48) {
                            line = line.substring(0, 48);
                        }
                        ScoreboardHelper.addScore(obj, getOfflinePlayer(line), score.asInt());
                    }
                }
            }
            // If there is no objective and no viewers, but there are some lines,
            // the command cannot do anything at all, so print a message about that
            else if (viewers == null && !lines.isEmpty()) {
                dB.echoDebug(scriptEntry, "Cannot add lines without specifying an objective!");
            }
        }
        else if (act.equals(Action.REMOVE)) {
            if (objective != null) {
                // Try getting the objective from the board
                obj = board.getObjective(objective.asString());

                if (obj != null) {
                    // Remove the entire objective if no lines have been specified
                    if (lines.isEmpty()) {
                        dB.echoDebug(scriptEntry, "Removing objective " + obj.getName() +
                                " from scoreboard " + id.asString());
                        obj.unregister();
                    }
                    else {
                        for (String line : lines) {
                            line = line.replaceAll("[pP]@", "");
                            ScoreboardHelper.removeScore(obj, getOfflinePlayer(line));
View Full Code Here

Examples of org.bukkit.scoreboard.Objective

    /**
     * @return false if power levels are disabled
     */
    public static boolean powerLevelHeartbeat() {
        Objective mainObjective = getPowerLevelObjective();

        if (mainObjective == null) {
            return false; // indicates
        }

        for (String playerName : dirtyPowerLevels) {
            McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);

            if (mcMMOPlayer == null) {
                continue;
            }

            Player player = mcMMOPlayer.getPlayer();
            int power = mcMMOPlayer.getPowerLevel();

            mainObjective.getScore(playerName).setScore(power);

            for (ScoreboardWrapper wrapper : PLAYER_SCOREBOARDS.values()) {
                wrapper.updatePowerLevel(player, power);
            }
        }
View Full Code Here

Examples of org.bukkit.scoreboard.Objective

     *
     * @return the main scoreboard objective, or null if disabled
     */
    public static Objective getPowerLevelObjective() {
        if (!Config.getInstance().getPowerLevelTagsEnabled()) {
            Objective objective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);

            if (objective != null) {
                objective.unregister();
                mcMMO.p.debug("Removed leftover scoreboard objects from Power Level Tags.");
            }

            return null;
        }

        Objective powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().getObjective(POWER_OBJECTIVE);

        if (powerObjective == null) {
            powerObjective = mcMMO.p.getServer().getScoreboardManager().getMainScoreboard().registerNewObjective(POWER_OBJECTIVE, "dummy");
            powerObjective.setDisplayName(TAG_POWER_LEVEL);
            powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
        }

        return powerObjective;
    }
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.