MCPcopy Create free account
hub / github.com/EndstoneMC/endstone / init_server

Function init_server

src/endstone/python/endstone_python.cpp:285–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285void init_server(py::class_<Server> &server)
286{
287 server.def_property_readonly("name", &Server::getName, "Gets the name of this server implementation.")
288 .def_property_readonly("version", &Server::getVersion, "Gets the version of this server implementation.")
289 .def_property_readonly("minecraft_version", &Server::getMinecraftVersion,
290 "Gets the Minecraft version that this server is running.")
291 .def_property_readonly("protocol_version", &Server::getProtocolVersion,
292 "Gets the network protocol version that this server supports.")
293 .def_property_readonly("logger", &Server::getLogger, py::return_value_policy::reference,
294 "Returns the primary logger associated with this server instance.")
295 .def_property_readonly("language", &Server::getLanguage, py::return_value_policy::reference,
296 "Gets the current language interface used by the server.")
297 .def_property_readonly("plugin_manager", &Server::getPluginManager, py::return_value_policy::reference,
298 "Gets the plugin manager for interfacing with plugins.")
299 .def("get_plugin_command", &Server::getPluginCommand, py::arg("name"), py::return_value_policy::reference,
300 "Gets a PluginCommand with the given name or alias.")
301 .def_property_readonly("command_sender", &Server::getCommandSender, py::return_value_policy::reference,
302 "Gets a CommandSender for this server.")
303 .def("dispatch_command", &Server::dispatchCommand, py::arg("sender"), py::arg("command_line"),
304 "Dispatches a command on this server, and executes it if found.")
305 .def_property_readonly("scheduler", &Server::getScheduler, py::return_value_policy::reference,
306 "Gets the scheduler for managing scheduled events.")
307 .def_property_readonly("service_manager", &Server::getServiceManager, py::return_value_policy::reference,
308 "Gets the service manager.")
309 .def(
310 "get_registry",
311 [](const Server &self, const py::type &t) -> py::object { return get_registry(self, t, RegistryTypes{}); },
312 py::arg("type"), py::return_value_policy::reference, "Returns the registry for all the enchantments.")
313 .def_property_readonly("level", &Server::getLevel, py::return_value_policy::reference_internal,
314 "Gets the server level.")
315 .def_property_readonly("online_players", &Server::getOnlinePlayers, py::return_value_policy::reference_internal,
316 "Gets a list of all currently online players.")
317 .def_property("max_players", &Server::getMaxPlayers, &Server::setMaxPlayers,
318 "The maximum amount of players which can login to this server.")
319 .def("get_player", py::overload_cast<std::string>(&Server::getPlayer, py::const_), py::arg("name").noconvert(),
320 py::return_value_policy::reference, "Gets the player with the exact given name, case insensitive.")
321 .def("get_player", py::overload_cast<UUID>(&Server::getPlayer, py::const_), py::arg("unique_id").noconvert(),
322 py::return_value_policy::reference, "Gets the player with the given UUID.")
323 .def_property_readonly("online_mode", &Server::getOnlineMode,
324 "Gets whether the Server is in online mode or not.")
325 .def_property_readonly("port", &Server::getPort, "Get the game port that the server runs on.")
326 .def_property_readonly("port_v6", &Server::getPortV6, "Get the game port (IPv6) that the server runs on.")
327 .def("shutdown", &Server::shutdown, "Shutdowns the server, stopping everything.")
328 .def("reload", &Server::reload, "Reloads the server configuration, functions, scripts and plugins.")
329 .def("reload_data", &Server::reloadData, "Reload only the Minecraft data for the server.")
330 .def("broadcast", &Server::broadcast, py::arg("message"), py::arg("permission"),
331 "Broadcasts the specified message to every user with the given permission name.")
332 .def(
333 "broadcast_message", [](const Server &self, const Message &message) { self.broadcastMessage(message); },
334 py::arg("message"),
335 "Broadcasts the specified message to every user with permission endstone.broadcast.user")
336 .def_property_readonly("item_factory", &Server::getItemFactory,
337 "Gets the instance of the item factory (for ItemMeta).",
338 py::return_value_policy::reference)
339 .def_property_readonly("scoreboard", &Server::getScoreboard,
340 "Gets the primary Scoreboard controlled by the server.",
341 py::return_value_policy::reference)
342 .def("create_scoreboard", &Server::createScoreboard, "Creates a new Scoreboard to be tracked by the server.",

Callers 1

PYBIND11_MODULEFunction · 0.85

Calls 4

get_registryFunction · 0.85
createBossBarMethod · 0.80
broadcastMessageMethod · 0.45
createBlockDataMethod · 0.45

Tested by

no test coverage detected