Solved Scoreboard 'registerNewObjective' deprecated?

zimb3l

New member
Dec 1, 2023
1
1
3
Hey!

I'm currently trying to write a plugin, one of which's features is supposed to be showing a scoreboard every 30minutes with a score based on mob kills.
Most of this is not implemented yet but the update function, but I receive a Warning from IntelliJ in one of the lines for creating the scoreboard


Code:
public class TimerHandler {
final String name_string = "mobBattle";
    static final Criteria criteria = Criteria.DUMMY;
    final String display_name_string = "Mob Battle";

    void setupScoreboardDisplay() {
        ScoreboardManager manager = Bukkit.getScoreboardManager();

        final Scoreboard scoreboard = manager.getNewScoreboard();
        final Objective objective = scoreboard.registerNewObjective(name_string, criteria, display_name_string);
      
    [...]
    }
}
More precisely the line
Code:
final Objective objective = scoreboard.registerNewObjective(name_string, criteria, display_name_string);
gives the following warning:
Code:
'registerNewObjective([email protected] String, [email protected] Criteria, [email protected] String)' is deprecated

The Plugin is Paper for MC version 20.1

Edit:
Close this, I got it fixed. Display name needs to be a "net.kyori.adventure.text.Component"
 
Last edited:
  • Like
Reactions: Machine Maker