org.bukkit.scoreboard.Objective Java Examples

The following examples show how to use org.bukkit.scoreboard.Objective. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Game.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void updateScoreboardTimer() {
    if (this.status != GameStatus.RUNNING || !getOriginalOrInheritedScoreaboard()) {
        return;
    }

    Objective obj = this.gameScoreboard.getObjective("display");
    if (obj == null) {
        obj = this.gameScoreboard.registerNewObjective("display", "dummy");
    }

    obj.setDisplayName(this.formatScoreboardTitle());

    for (GamePlayer player : players) {
        player.player.setScoreboard(gameScoreboard);
    }
}
 
Example #2
Source File: BPlayerBoard.java    From Netherboard with Apache License 2.0 6 votes vote down vote up
private void sendObjectiveDisplay(Objective obj) {
    try {
        Object objHandle = NMS.getHandle(obj);

        Object packet = NMS.PACKET_DISPLAY.newInstance(
                1,
                objHandle
        );

        NMS.sendPacket(packet, player);
    } catch(InstantiationException | IllegalAccessException
            | InvocationTargetException | NoSuchMethodException e) {

        LOGGER.error("Error while creating and sending display packet. (Unsupported Minecraft version?)", e);
    }
}
 
Example #3
Source File: BPlayerBoard.java    From Netherboard with Apache License 2.0 6 votes vote down vote up
private void sendObjective(Objective obj, ObjectiveMode mode) {
    try {
        Object objHandle = NMS.getHandle(obj);

        Object packetObj = NMS.PACKET_OBJ.newInstance(
                objHandle,
                mode.ordinal()
        );

        NMS.sendPacket(packetObj, player);
    } catch(InstantiationException | IllegalAccessException
            | InvocationTargetException | NoSuchMethodException e) {

        LOGGER.error("Error while creating and sending objective packet. (Unsupported Minecraft version?)", e);
    }
}
 
Example #4
Source File: UHPlugin.java    From KTP with GNU General Public License v3.0 6 votes vote down vote up
public void setMatchInfo() {
	Objective obj = null;
	try {
		obj = sb.getObjective(sbobjname);
		obj.setDisplaySlot(null);
		obj.unregister();
	} catch (Exception e) {
		
	}
	Random r = new Random();
	sbobjname = "KTP"+r.nextInt(10000000);
	obj = sb.registerNewObjective(sbobjname, "dummy");
	obj = sb.getObjective(sbobjname);

	obj.setDisplayName(this.getScoreboardName());
	obj.setDisplaySlot(DisplaySlot.SIDEBAR);
	obj.getScore(Bukkit.getOfflinePlayer(ChatColor.GRAY+"Episode "+ChatColor.WHITE+episode)).setScore(5);
	obj.getScore(Bukkit.getOfflinePlayer(ChatColor.WHITE+""+Bukkit.getServer().getOnlinePlayers().size()+ChatColor.GRAY+" joueurs")).setScore(4);
	obj.getScore(Bukkit.getOfflinePlayer(ChatColor.WHITE+""+getAliveTeams().size()+ChatColor.GRAY+" teams")).setScore(3);
	obj.getScore(Bukkit.getOfflinePlayer("")).setScore(2);
	obj.getScore(Bukkit.getOfflinePlayer(ChatColor.WHITE+formatter.format(this.minutesLeft)+ChatColor.GRAY+":"+ChatColor.WHITE+formatter.format(this.secondsLeft))).setScore(1);
}
 
Example #5
Source File: RaindropsListener.java    From ProjectAres with GNU Affero General Public License v3.0 6 votes vote down vote up
private void setRaindropsCount(Player player, int count) {
    if(player == null) return;

    final Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
    Objective objective = scoreboard.getObjective(player.getName());

    Integer oldCount = raindrops.get(player);
    if(oldCount != null) {
        Utils.removeScore(player, String.format("%,d", oldCount));
    }
    Utils.addScore(player, objective, String.format("%,d", count), 1);

    raindrops.put(player, count);

    Utils.giveGhastTear(player, count);
}
 
Example #6
Source File: RaindropsListener.java    From ProjectAres with GNU Affero General Public License v3.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void displayScoreboard(final PlayerJoinEvent event) {
    final Player player = event.getPlayer();
    final User user = userStore.getUser(player);
    final PlayerId playerId = tc.oc.api.bukkit.users.Users.playerId(player);
    final Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
    final Objective objective = getOrCreateObjective(scoreboard, player.getName(), "dummy");
    final String raindropsName = ChatColor.AQUA + "Raindrops";

    objective.setDisplayName(renderer.renderLegacy(generalFormatter.brandName(), event.getPlayer()));

    objective.getScore(raindropsName).setScore(2);
    Utils.displayScoreboard(player, objective);
    setRaindropsCount(player, user.raindrops());
    GizmoUtils.setGizmo(player, Gizmos.emptyGizmo, true);
}
 
Example #7
Source File: Arena.java    From civcraft with GNU General Public License v2.0 6 votes vote down vote up
public void decrementTimer() {
	if (timeleft <= 0) {
		if (!ended) {
			CivMessage.sendArena(this, "Time is up! Nobody Wins!");
			ArenaManager.declareDraw(this);
			ended = true;
		}
	} else {
		this.timeleft--;

		for (ArenaTeam team : this.teams.values()) {	
			Objective obj = objectives.get(team.getName()+";score");
			Score score = obj.getScore("Time Left");
			score.setScore(timeleft);
		}
	}
}
 
Example #8
Source File: GScoreboard.java    From GlobalWarming with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Display a player's score
 * - Uses the player's associated-world scoreboard
 * - Note: the player may be in a different world, that's ok
 * - Player names are mapped to color warmth (based on their score)
 */
private void updatePlayerScore(GPlayer gPlayer) {
    if (gPlayer != null) {
        //Do not update associated-worlds with disabled climate-engines:
        // - Ignore offline players (e.g., someone completing an offline player's bounty)
        Player onlinePlayer = gPlayer.getOnlinePlayer();
        if (onlinePlayer != null && ClimateEngine.getInstance().isClimateEngineEnabled(gPlayer.getAssociatedWorldId())) {
            //Update the player's score:
            Scoreboard scoreboard = getScoreboard(gPlayer);
            if (scoreboard != null) {
                Objective objective = scoreboard.getObjective(GLOBAL_WARMING);
                if (objective != null) {
                    Team team = scoreboard.getPlayerTeam(onlinePlayer);
                    if (team != null) {
                        team.setColor(Colorizer.getScoreColor(gPlayer.getCarbonScore()));
                        objective.getScore(onlinePlayer).setScore(gPlayer.getCarbonScore());
                    }
                }
            }
        }
    }
}
 
Example #9
Source File: GScoreboard.java    From GlobalWarming with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Update the global score for all worlds
 */
private void updateGlobalScores() {
    for (World world : Bukkit.getWorlds()) {
        //Do not update worlds with disabled climate-engines:
        WorldClimateEngine climateEngine = ClimateEngine.getInstance().getClimateEngine(world.getUID());
        if (climateEngine != null && climateEngine.isEnabled()) {
            //Get the scoreboard for this world:
            Scoreboard scoreboard = getScoreboard(world.getUID(), false);

            //Get its objective (scoreboard title / group):
            Objective objective = null;
            if (scoreboard != null) {
                objective = scoreboard.getObjective(GLOBAL_WARMING);
            }

            //Update the title to show this world's temperature:
            if (objective != null) {
                double temperature = climateEngine.getTemperature();
                objective.setDisplayName(climateEngine.formatTemp(temperature));
            }
        }
    }
}
 
Example #10
Source File: GScoreboard.java    From GlobalWarming with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Get any scoreboard by world
 * - Note: players should use their associated-world (not current-world)
 */
private Scoreboard getScoreboard(UUID worldId, boolean isCreateIfNotFound) {
    Scoreboard scoreboard = null;
    if (ClimateEngine.getInstance().isClimateEngineEnabled(worldId)) {
        if (scoreboards.containsKey(worldId)) {
            //Existing scoreboard:
            scoreboard = scoreboards.get(worldId);
        } else if (isCreateIfNotFound) {
            //New scoreboard:
            scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
            scoreboards.put(worldId, scoreboard);

            //Objective (scoreboard title / group):
            Objective objective = scoreboard.registerNewObjective(
                    GLOBAL_WARMING,
                    "scores",
                    "Carbon Score");

            objective.setDisplaySlot(DisplaySlot.SIDEBAR);
        }
    }

    return scoreboard;
}
 
Example #11
Source File: TpsPingTask.java    From NyaaUtils with MIT License 6 votes vote down vote up
private void refreshPing() {
    Set<Player> offlined = new HashSet<>();
    Bukkit.getOnlinePlayers().stream().filter(((Predicate<Player>) playerPing30s::containsKey).negate()).forEach(l -> playerPing30s.put(l, new LinkedBlockingDeque<>(30)));
    playerPing30s.forEach((player, pings) -> {
        if (!player.isOnline()) {
            offlined.add(player);
            return;
        }
        if (pings.size() == 30) pings.poll();
        int playerPing = PlayerUtils.getPing(player);
        pings.add(playerPing);
        if (plugin.cfg.ping_tab) {
            Scoreboard scoreboard = player.getScoreboard();
            Objective playerPingObj = scoreboard.getObjective("nyaautilsping");
            if (playerPingObj != null) {
                playerPingObj.getScore(player.getName()).setScore(playerPing);
            }
        }
    });
    offlined.forEach(playerPing30s::remove);
}
 
Example #12
Source File: EffSetScore.java    From skRayFall with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void execute(Event evt) {
    if (player == null || num == null || player.getSingle(evt).getScoreboard() == null) {
        Skript.error("This player is either not online or has yet to have a scoreboard set for them");
        return;
    }
    Scoreboard sb = player.getSingle(evt).getScoreboard();
    Objective objective = sb.getObjective(DisplaySlot.SIDEBAR);
    Score score;
    if (name.getSingle(evt) == null){
        Skript.warning("First arg in \"set score %string% in sidebar of %player% to %number%\" was null. " +
                "Objective will now be named null.");
        score = objective.getScore("null");
    } else {
        score = objective.getScore(name.getSingle(evt).replace("\"", ""));
    }
    score.setScore(num.getSingle(evt).intValue());
}
 
Example #13
Source File: Game.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void updateScoreboard() {
    if (!getOriginalOrInheritedScoreaboard()) {
        return;
    }

    Objective obj = this.gameScoreboard.getObjective("display");
    if (obj == null) {
        obj = this.gameScoreboard.registerNewObjective("display", "dummy");
    }

    obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    obj.setDisplayName(this.formatScoreboardTitle());

    for (CurrentTeam team : teamsInGame) {
        this.gameScoreboard.resetScores(this.formatScoreboardTeam(team, false, false));
        this.gameScoreboard.resetScores(this.formatScoreboardTeam(team, false, true));
        this.gameScoreboard.resetScores(this.formatScoreboardTeam(team, true, false));

        Score score = obj.getScore(this.formatScoreboardTeam(team, !team.isBed, team.isBed && "RESPAWN_ANCHOR".equals(team.teamInfo.bed.getBlock().getType().name()) && Player116ListenerUtils.isAnchorEmpty(team.teamInfo.bed.getBlock())));
        score.setScore(team.players.size());
    }

    for (GamePlayer player : players) {
        player.player.setScoreboard(gameScoreboard);
    }
}
 
Example #14
Source File: Dummy.java    From FunnyGuilds with Apache License 2.0 6 votes vote down vote up
public void updateScore(User user) {
    if (! FunnyGuilds.getInstance().getPluginConfiguration().dummyEnable) {
        return;
    }

    Scoreboard scoreboard = this.user.getCache().getScoreboard();

    if (scoreboard == null) {
        FunnyGuilds.getInstance().getPluginLogger().debug(
                "We're trying to update Dummy score but scoreboard hasn't been initialized yet" +
                        "(maybe player left the game while updating?)");
        return;
    }

    Objective objective = scoreboard.getObjective(OBJECTIVE_NAME);

    if (objective == null || ! objective.getName().equals(OBJECTIVE_NAME)) {
        this.initialize();
    } else {
        objective.getScore(user.getName()).setScore(user.getRank().getPoints());
    }
}
 
Example #15
Source File: Game.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void updateScoreboard() {
    if (!getOriginalOrInheritedScoreaboard()) {
        return;
    }

    Objective obj = this.gameScoreboard.getObjective("display");
    if (obj == null) {
        obj = this.gameScoreboard.registerNewObjective("display", "dummy");
    }

    obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    obj.setDisplayName(this.formatScoreboardTitle());

    for (CurrentTeam team : teamsInGame) {
        this.gameScoreboard.resetScores(this.formatScoreboardTeam(team, false, false));
        this.gameScoreboard.resetScores(this.formatScoreboardTeam(team, false, true));
        this.gameScoreboard.resetScores(this.formatScoreboardTeam(team, true, false));

        Score score = obj.getScore(this.formatScoreboardTeam(team, !team.isBed, team.isBed && "RESPAWN_ANCHOR".equals(team.teamInfo.bed.getBlock().getType().name()) && Player116ListenerUtils.isAnchorEmpty(team.teamInfo.bed.getBlock())));
        score.setScore(team.players.size());
    }

    for (GamePlayer player : players) {
        player.player.setScoreboard(gameScoreboard);
    }
}
 
Example #16
Source File: Game.java    From BedWars with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void updateScoreboardTimer() {
    if (this.status != GameStatus.RUNNING || !getOriginalOrInheritedScoreaboard()) {
        return;
    }

    Objective obj = this.gameScoreboard.getObjective("display");
    if (obj == null) {
        obj = this.gameScoreboard.registerNewObjective("display", "dummy");
    }

    obj.setDisplayName(this.formatScoreboardTitle());

    for (GamePlayer player : players) {
        player.player.setScoreboard(gameScoreboard);
    }
}
 
Example #17
Source File: EffNameOfScore.java    From skRayFall with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void execute(Event evt) {

    for (Player p : players.getArray(evt)) {
        if (!(p.isOnline())) {
            Skript.error("The player is not online!");
            continue;
        }
        try {
            if (p.getScoreboard().getObjective("sidebarHold") != null) {
                Objective objective = p.getScoreboard().getObjective(DisplaySlot.SIDEBAR);
                objective.setDisplayName(name.getSingle(evt).replace("\"", ""));
            } else {
                Objective objectiveh = p.getScoreboard().registerNewObjective("sidebarHold", "dummy");
                objectiveh.setDisplaySlot(DisplaySlot.SIDEBAR);
                objectiveh.setDisplayName(name.getSingle(evt).replace("\"", ""));
            }
        } catch (IllegalArgumentException e){
            Skript.error(e.getLocalizedMessage());
        }
    }
}
 
Example #18
Source File: ScoreBoardManager.java    From CombatLogX with GNU General Public License v3.0 6 votes vote down vote up
public void removeScoreboard(Player player) {
    UUID uuid = player.getUniqueId();
    CustomScoreBoard customScoreBoard = this.customScoreBoardMap.remove(uuid);
    if(customScoreBoard == null) return;
    
    customScoreBoard.disableScoreboard();
    if(shouldSavePrevious() && this.previousScoreboardMap.containsKey(uuid)) {
        Scoreboard previousScoreboard = this.previousScoreboardMap.get(uuid);
        if(previousScoreboard == null) return;
        
        Objective objective = previousScoreboard.getObjective("combatlogx");
        if(objective != null) return;
        
        player.setScoreboard(previousScoreboard);
    }
}
 
Example #19
Source File: Game.java    From BedwarsRel with GNU General Public License v3.0 5 votes vote down vote up
private void updateLobbyScoreboard() {
  this.scoreboard.clearSlot(DisplaySlot.SIDEBAR);

  Objective obj = this.scoreboard.getObjective("lobby");
  if (obj != null) {
    obj.unregister();
  }

  obj = this.scoreboard.registerNewObjective("lobby", "dummy");
  obj.setDisplaySlot(DisplaySlot.SIDEBAR);
  obj.setDisplayName(this.formatLobbyScoreboardString(
      BedwarsRel.getInstance().getStringConfig("lobby-scoreboard.title", "&eBEDWARS")));

  List<String> rows = BedwarsRel.getInstance().getConfig()
      .getStringList("lobby-scoreboard.content");
  int rowMax = rows.size();
  if (rows == null || rows.isEmpty()) {
    return;
  }

  for (String row : rows) {
    if (row.trim().equals("")) {
      for (int i = 0; i <= rowMax; i++) {
        row = row + " ";
      }
    }

    Score score = obj.getScore(this.formatLobbyScoreboardString(row));
    score.setScore(rowMax);
    rowMax--;
  }

  for (Player player : this.getPlayers()) {
    player.setScoreboard(this.scoreboard);
  }
}
 
Example #20
Source File: PercentHealthObjectiveModule.java    From UHC with MIT License 5 votes vote down vote up
protected void updatePlayer(Player player, Double newHealth) {
    Preconditions.checkArgument(newHealth >= 0, "Health cannot be less than 0");
    final Double oldHealth = trackedHealth.put(player.getUniqueId(), newHealth);

    if (!newHealth.equals(oldHealth)) {
        for (final Map.Entry<Objective, Integer> objective : objectives.entrySet()) {
            objective
                    .getKey()
                    .getScore(player.getName())
                    .setScore((int) Math.ceil(newHealth * objective.getValue()));
        }
    }
}
 
Example #21
Source File: PercentHealthObjectiveModule.java    From UHC with MIT License 5 votes vote down vote up
@Override
protected List<String> getEnabledLore() {
    final List<String> lore = Lists.newArrayList();
    lore.addAll(messages.getRawStrings("enabled lore.header"));

    for (final Objective objective : objectives.keySet()) {
        lore.addAll(messages.evalTemplates("enabled lore.item", ImmutableMap.of("objective", objective.getName())));
    }

    return lore;
}
 
Example #22
Source File: Game.java    From BedwarsRel with GNU General Public License v3.0 5 votes vote down vote up
private void updateScoreboardTimer() {
  Objective obj = this.scoreboard.getObjective("display");
  if (obj == null) {
    obj = this.scoreboard.registerNewObjective("display", "dummy");
  }

  obj.setDisplayName(this.formatScoreboardTitle());

  for (Player player : this.getPlayers()) {
    player.setScoreboard(this.scoreboard);
  }
}
 
Example #23
Source File: PlayerStat.java    From SkyWarsReloaded with GNU General Public License v3.0 5 votes vote down vote up
private static void getScoreboard(Player player) {
	Scoreboard scoreboard = scoreboards.get(player);
	if (scoreboard != null) {
           resetScoreboard(player);
       }
	ScoreboardManager manager = SkyWarsReloaded.get().getServer().getScoreboardManager();
	scoreboard = manager.getNewScoreboard();
       Objective objective = SkyWarsReloaded.getNMS().getNewObjective(scoreboard, "dummy", "info");
       objective.setDisplaySlot(DisplaySlot.SIDEBAR);
       scoreboards.put(player, scoreboard);
	updateScoreboard(player);
}
 
Example #24
Source File: Game.java    From BedwarsRel with GNU General Public License v3.0 5 votes vote down vote up
public void updateScoreboard() {
  if (this.state == GameState.WAITING
      && BedwarsRel.getInstance().getBooleanConfig("lobby-scoreboard.enabled", true)) {
    this.updateLobbyScoreboard();
    return;
  }

  Objective obj = this.scoreboard.getObjective("display");
  if (obj == null) {
    obj = this.scoreboard.registerNewObjective("display", "dummy");
  }

  obj.setDisplaySlot(DisplaySlot.SIDEBAR);
  obj.setDisplayName(this.formatScoreboardTitle());

  for (Team t : this.teams.values()) {
    this.scoreboard.resetScores(this.formatScoreboardTeam(t, false));
    this.scoreboard.resetScores(this.formatScoreboardTeam(t, true));

    boolean teamDead = (t.isDead(this) && this.getState() == GameState.RUNNING) ? true : false;
    Score score = obj.getScore(this.formatScoreboardTeam(t, teamDead));
    score.setScore(t.getPlayers().size());
  }

  for (Player player : this.getPlayers()) {
    player.setScoreboard(this.scoreboard);
  }
}
 
Example #25
Source File: PlayerStat.java    From SkyWarsReloaded with GNU General Public License v3.0 5 votes vote down vote up
private static void resetScoreboard(Player player) {
	Scoreboard scoreboard = scoreboards.get(player);
	for (Objective objective: scoreboard.getObjectives()) {
    	if (objective != null) {
            objective.unregister();
        }
	}
}
 
Example #26
Source File: Scoreboards.java    From CardinalPGM with MIT License 5 votes vote down vote up
public static String getNextConversion(Objective objective, int slot, Team team, String string, String insert, String addition, Set<String> used, boolean doNotInterruptColorCodes) {
    while (used.contains(Scoreboards.getConversion(string, insert))) {
        insert += addition;
    }
    String steam = Scoreboards.convertToScoreboard(team, string, insert, doNotInterruptColorCodes);
    used.add(steam);
    if (slot == 0) {
        objective.getScore(steam).setScore(1);
    }
    objective.getScore(steam).setScore(slot);
    return steam;
}
 
Example #27
Source File: PlayerStat.java    From SkyWarsReloaded with GNU General Public License v3.0 5 votes vote down vote up
public static void getScoreboard(Player player) {
	Scoreboard scoreboard = scoreboards.get(player);
	if (scoreboard != null) {
           resetScoreboard(player);
       }
	ScoreboardManager manager = SkyWarsReloaded.get().getServer().getScoreboardManager();
	scoreboard = manager.getNewScoreboard();
       Objective objective = scoreboard.registerNewObjective("info", "dummy");
       objective.setDisplaySlot(DisplaySlot.SIDEBAR);
       scoreboards.put(player, scoreboard);
	updateScoreboard(player);
}
 
Example #28
Source File: CraftScoreboard.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public Objective getObjective(DisplaySlot slot) throws IllegalArgumentException {
    Validate.notNull(slot, "Display slot cannot be null");
    net.minecraft.scoreboard.ScoreObjective objective = board.func_96539_a(CraftScoreboardTranslations.fromBukkitSlot(slot));
    if (objective == null) {
        return null;
    }
    return this.objectives.get(objective.getName());
}
 
Example #29
Source File: EffDeleteIdScore.java    From skRayFall with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void execute(Event evt) {
    String usedId = id.getSingle(evt).replace("\"", "");
    if (Core.sbManager.getScore(usedId) != null) {
        Score score = Core.sbManager.getScore(usedId);
        Objective obj = score.getObjective();
        obj.getScoreboard().resetScores(score.getEntry());
        Core.sbManager.deleteScoreId(usedId);
    }
}
 
Example #30
Source File: IdScoreBoardManager.java    From skRayFall with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Update group scores by ID. This will replace the old scores for all players in the group.
 *
 * @param id       The ID text for the group score.
 * @param newName  New name of the score.
 * @param newValue New value of the score.
 */
void groupUpdateScore(String id, String newName, int newValue) {
    if (groupScoreMap.containsKey(id) && groupMap.get(id) != null) {
        ArrayList<Player> ls = groupMap.get(id);
        GroupScore old = groupScoreMap.get(id);
        for (Player p : ls) {
            Objective obj = p.getScoreboard().getObjective(DisplaySlot.SIDEBAR);
            obj.getScoreboard().resetScores(old.getName());
            Score newScore = obj.getScore(newName);
            newScore.setScore(newValue);
        }
        groupScoreMap.put(id, new GroupScore(newName, newValue));
    }
}