diff --git a/python/src/endstone/_internal/endstone_python.pyi b/python/src/endstone/_internal/endstone_python.pyi index 4cd6fa9fa..73337cc5b 100644 --- a/python/src/endstone/_internal/endstone_python.pyi +++ b/python/src/endstone/_internal/endstone_python.pyi @@ -1,6 +1,6 @@ from __future__ import annotations import typing -__all__ = ['ColorFormat', 'Command', 'CommandExecutor', 'CommandSender', 'Logger', 'Plugin', 'PluginCommand', 'PluginDescription', 'PluginLoader', 'PluginManager', 'Server'] +__all__ = ['ColorFormat', 'Command', 'CommandExecutor', 'CommandSender', 'Logger', 'PermissionDefault', 'Plugin', 'PluginCommand', 'PluginDescription', 'PluginLoader', 'PluginManager', 'Server', 'ServerOperator'] class ColorFormat: AQUA: typing.ClassVar[str] = '§b' BLACK: typing.ClassVar[str] = '§0' @@ -206,6 +206,55 @@ class Logger: """ Get the name of this Logger instance. """ +class PermissionDefault: + """ + Members: + + TRUE + + FALSE + + OP + + OPERATOR + + NOT_OP + + NOT_OPERATOR + """ + FALSE: typing.ClassVar[PermissionDefault] # value = + NOT_OP: typing.ClassVar[PermissionDefault] # value = + NOT_OPERATOR: typing.ClassVar[PermissionDefault] # value = + OP: typing.ClassVar[PermissionDefault] # value = + OPERATOR: typing.ClassVar[PermissionDefault] # value = + TRUE: typing.ClassVar[PermissionDefault] # value = + __members__: typing.ClassVar[dict[str, PermissionDefault]] # value = {'TRUE': , 'FALSE': , 'OP': , 'OPERATOR': , 'NOT_OP': , 'NOT_OPERATOR': } + def __eq__(self, other: typing.Any) -> bool: + ... + def __getstate__(self) -> int: + ... + def __hash__(self) -> int: + ... + def __index__(self) -> int: + ... + def __init__(self, value: int) -> None: + ... + def __int__(self) -> int: + ... + def __ne__(self, other: typing.Any) -> bool: + ... + def __repr__(self) -> str: + ... + def __setstate__(self, state: int) -> None: + ... + def __str__(self) -> str: + ... + @property + def name(self) -> str: + ... + @property + def value(self) -> int: + ... class Plugin(CommandExecutor): def __init__(self) -> None: ... @@ -390,3 +439,12 @@ class Server: """ Gets the version of this server implementation. """ +class ServerOperator: + @property + def op(self) -> bool: + """ + The operator status of this object + """ + @op.setter + def op(self, arg1: bool) -> None: + ... diff --git a/src/endstone_python/permissions.cpp b/src/endstone_python/permissions.cpp index 5385da265..ba7e6e1ba 100644 --- a/src/endstone_python/permissions.cpp +++ b/src/endstone_python/permissions.cpp @@ -14,10 +14,25 @@ #include +#include "endstone/permissions/permission_default.h" +#include "endstone/permissions/server_operator.h" + namespace py = pybind11; namespace endstone::detail { -void init_permissions(py::module &m) {} +void init_permissions(py::module &m) +{ + py::class_>(m, "ServerOperator") + .def_property("op", &ServerOperator::isOp, &ServerOperator::setOp, "The operator status of this object"); + + py::enum_(m, "PermissionDefault") + .value("TRUE", PermissionDefault::True) + .value("FALSE", PermissionDefault::False) + .value("OP", PermissionDefault::Operator) + .value("OPERATOR", PermissionDefault::Operator) + .value("NOT_OP", PermissionDefault::Operator) + .value("NOT_OPERATOR", PermissionDefault::NotOperator); +} } // namespace endstone::detail