Skip to content

Commit

Permalink
refactor: rename properties in Translatable class
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Jul 23, 2024
1 parent d14d220 commit 3016900
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions python/src/endstone/_internal/endstone_python.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2043,17 +2043,17 @@ class ThunderChangeEvent(Event):
Gets the state of thunder that the world is being set to
"""
class Translatable:
def __init__(self, translate: str, params: list[str] | None = None) -> None:
def __init__(self, translate: str, with_: list[str] | None = None) -> None:
...
@property
def parameters(self) -> list[str]:
def translate(self) -> str:
"""
Get the translation parameters.
Get the translation key for use in a translation component.
"""
@property
def translation_key(self) -> str:
def with_(self) -> list[str]:
"""
Get the translation key for use in a translation component.
Get the translation parameters.
"""
class Vector:
"""
Expand Down
6 changes: 3 additions & 3 deletions src/endstone_python/endstone_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ void init_translatable(py::module_ &m)
.def(py::init([](std::string translate, const std::optional<std::vector<std::string>> &with) {
return Translatable(std::move(translate), with.value_or(std::vector<std::string>{}));
}),
py::arg("translate"), py::arg("params") = py::none())
.def_property_readonly("translation_key", &Translatable::getTranslationKey,
py::arg("translate"), py::arg("with_") = py::none())
.def_property_readonly("translate", &Translatable::getTranslationKey,
"Get the translation key for use in a translation component.")
.def_property_readonly("parameters", &Translatable::getParameters, "Get the translation parameters.");
.def_property_readonly("with_", &Translatable::getParameters, "Get the translation parameters.");
}

void init_server(py::class_<Server> &server)
Expand Down

0 comments on commit 3016900

Please sign in to comment.