| 381 | } |
| 382 | |
| 383 | void init_player(py::module_ &m, py::class_<OfflinePlayer> &offline_player, |
| 384 | py::class_<Player, Mob, OfflinePlayer> &player) |
| 385 | { |
| 386 | py::class_<Skin>(m, "Skin", "Represents a player skin.") |
| 387 | .def(py::init<std::string, Image, std::optional<std::string>, std::optional<Image>>(), py::arg("id"), |
| 388 | py::arg("image"), py::arg("cape_id") = py::none(), py::arg("cape_image") = py::none()) |
| 389 | .def_property_readonly("id", &Skin::getId, "Get the Skin ID.") |
| 390 | .def_property_readonly("image", &Skin::getImage, "Get the Skin image.", py::return_value_policy::reference) |
| 391 | .def_property_readonly("cape_id", &Skin::getCapeId, "Get the Cape ID.") |
| 392 | .def_property_readonly("cape_image", &Skin::getCapeImage, "Get the Cape image.", |
| 393 | py::return_value_policy::reference); |
| 394 | |
| 395 | offline_player // |
| 396 | .def_property_readonly("name", &OfflinePlayer::getName, "Returns the name of this player") |
| 397 | .def_property_readonly("unique_id", &OfflinePlayer::getUniqueId, "Returns the UUID of this player"); |
| 398 | |
| 399 | player // |
| 400 | .def_property_readonly("name", &OfflinePlayer::getName, "Returns the name of this player") |
| 401 | .def_property_readonly("unique_id", &Player::getUniqueId, "Returns the UUID of this player") |
| 402 | .def_property("is_op", &Player::isOp, &Player::setOp, "The operator status of this playerall") |
| 403 | .def_property_readonly("xuid", &Player::getXuid, "Returns the Xbox User ID (XUID) of this player") |
| 404 | .def_property_readonly("address", &Player::getAddress, "Gets the socket address of this player") |
| 405 | .def("transfer", &Player::transfer, "Transfers the player to another server.", py::arg("host"), |
| 406 | py::arg("port") = 19132) |
| 407 | .def("kick", &Player::kick, py::arg("message"), "Kicks player with custom kick message.") |
| 408 | .def("perform_command", &Player::performCommand, py::arg("command"), |
| 409 | "Makes the player perform the given command.") |
| 410 | .def_property("is_sneaking", &Player::isSneaking, &Player::setSneaking, |
| 411 | "Gets or sets the sneak mode of the player") |
| 412 | .def_property("is_sprinting", &Player::isSprinting, &Player::setSprinting, |
| 413 | "Gets or sets whether the player is sprinting or not.") |
| 414 | .def("play_sound", &Player::playSound, py::arg("location"), py::arg("sound"), py::arg("volume") = 1.0, |
| 415 | py::arg("pitch") = 1.0, "Play a sound for a player at the location.") |
| 416 | .def("stop_sound", &Player::stopSound, py::arg("sound"), "Stop the specified sound from playing.") |
| 417 | .def("stop_all_sounds", &Player::stopAllSounds, "Stop all sounds from playing.") |
| 418 | .def("send_popup", &Player::sendPopup, py::arg("message"), "Sends this player a popup message") |
| 419 | .def("send_tip", &Player::sendTip, py::arg("message"), "Sends this player a tip message") |
| 420 | .def("send_toast", &Player::sendToast, py::arg("title"), py::arg("content"), |
| 421 | "Sends this player a toast notification.") |
| 422 | .def("give_exp", &Player::giveExp, py::arg("amount"), "Gives the player the amount of experience specified.") |
| 423 | .def("give_exp_levels", &Player::giveExpLevels, py::arg("amount"), |
| 424 | "Gives the player the amount of experience levels specified.") |
| 425 | .def_property("exp_progress", &Player::getExpProgress, &Player::setExpProgress, |
| 426 | "Gets or sets the players current experience progress towards the next level.") |
| 427 | .def_property("exp_level", &Player::getExpLevel, &Player::setExpLevel, |
| 428 | "Gets or sets the players current experience level.") |
| 429 | .def_property_readonly("total_exp", &Player::getTotalExp, "Gets the players total experience points.") |
| 430 | .def_property("is_flying", &Player::isFlying, &Player::setFlying, "If the player is currently flying or not.") |
| 431 | .def_property("allow_flight", &Player::getAllowFlight, &Player::setAllowFlight, |
| 432 | "If the Player is allowed to fly via jump key double-tap.") |
| 433 | .def_property("fly_speed", &Player::getFlySpeed, &Player::setFlySpeed, |
| 434 | "Gets or sets the current allowed speed that a client can fly.") |
| 435 | .def_property("walk_speed", &Player::getWalkSpeed, &Player::setWalkSpeed, |
| 436 | "Gets or sets the current allowed speed that a client can walk.") |
| 437 | .def_property("scoreboard", &Player::getScoreboard, &Player::setScoreboard, |
| 438 | "Gets or sets the player's visible Scoreboard.", py::return_value_policy::reference) |
| 439 | .def("send_title", py::overload_cast<std::string, std::string, int, int, int>(&Player::sendTitle, py::const_), |
| 440 | "Sends a title and a subtitle message to the player. If they are empty strings, the display will be " |
no test coverage detected