Skip to content

Commit

Permalink
refactor(scoreboard):: remove Score::getScore and setScore to getValu…
Browse files Browse the repository at this point in the history
…e and setValue
  • Loading branch information
wu-vincent committed Jul 22, 2024
1 parent 178e11d commit 87d47dc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions include/endstone/detail/scoreboard/score.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class EndstoneScore : public Score {
public:
EndstoneScore(std::unique_ptr<EndstoneObjective> objective, ScoreEntry entry);
[[nodiscard]] ScoreEntry getEntry() const override;
[[nodiscard]] int getScore() const override;
void setScore(int score) override;
[[nodiscard]] int getValue() const override;
void setValue(int score) override;
[[nodiscard]] bool isScoreSet() const override;
[[nodiscard]] Objective &getObjective() const override;
[[nodiscard]] Scoreboard &getScoreboard() const override;
Expand Down
4 changes: 2 additions & 2 deletions include/endstone/scoreboard/score.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ class Score {
*
* @return the current score
*/
[[nodiscard]] virtual int getScore() const = 0;
[[nodiscard]] virtual int getValue() const = 0;

/**
* @brief Sets the current score.
*
* @param score New score
*/
virtual void setScore(int score) = 0;
virtual void setValue(int score) = 0;

/**
* @brief Shows if this score has been set at any point in time.
Expand Down
14 changes: 7 additions & 7 deletions python/src/endstone/_internal/endstone_python.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1630,18 +1630,18 @@ class Score:
Gets the Objective being tracked by this Score.
"""
@property
def score(self) -> int:
def scoreboard(self) -> Scoreboard:
"""
Gets or sets the current score.
Gets the scoreboard for the associated objective.
"""
@score.setter
def score(self, arg1: int) -> None:
...
@property
def scoreboard(self) -> Scoreboard:
def value(self) -> int:
"""
Gets the scoreboard for the associated objective.
Gets or sets the current score.
"""
@value.setter
def value(self, arg1: int) -> None:
...
class Scoreboard:
"""
Represents a scoreboard
Expand Down
4 changes: 2 additions & 2 deletions src/endstone_core/scoreboard/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ScoreEntry EndstoneScore::getEntry() const
return entry_;
}

int EndstoneScore::getScore() const
int EndstoneScore::getValue() const
{
if (objective_->checkState()) {
const auto &id = getScoreboardId();
Expand All @@ -46,7 +46,7 @@ int EndstoneScore::getScore() const
return 0;
}

void EndstoneScore::setScore(int score)
void EndstoneScore::setValue(int score)
{
if (objective_->checkState()) {
const auto &id = getOrCreateScoreboardId();
Expand Down
2 changes: 1 addition & 1 deletion src/endstone_python/scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void init_scoreboard(py::module_ &m)
py::class_<Score>(m, "Score", "Represents a score for an objective on a scoreboard.")
.def_property_readonly("entry", &Score::getEntry, "Gets the entry being tracked by this Score",
py::return_value_policy::reference_internal)
.def_property("score", &Score::getScore, &Score::setScore, "Gets or sets the current score.")
.def_property("value", &Score::getValue, &Score::setValue, "Gets or sets the current score.")
.def_property_readonly("is_score_set", &Score::isScoreSet,
"Shows if this score has been set at any point in time.")
.def_property_readonly("objective", &Score::getObjective, "Gets the Objective being tracked by this Score.",
Expand Down

0 comments on commit 87d47dc

Please sign in to comment.