diff --git a/include/endstone/debugshape/debug_shape.h b/include/endstone/debugshape/debug_shape.h index 650515777..f8f1b11e9 100644 --- a/include/endstone/debugshape/debug_shape.h +++ b/include/endstone/debugshape/debug_shape.h @@ -27,8 +27,8 @@ namespace endstone { namespace debugshape_internal { - // Decreases from the maximum value to avoid conflicts with sapi's id allocation - inline std::atomic id_counter{UINT64_MAX}; +// Decreases from the maximum value to avoid conflicts with sapi's id allocation +inline std::atomic id_counter{UINT64_MAX}; } // namespace debugshape_internal /** @@ -107,20 +107,20 @@ class DebugShape { * @brief Adds the player to this debug shape causing it to display on the player's screen. * @param player the player to add. */ - void addPlayer(const Player &player) + void addPlayer(Player &player) { players_.emplace(player.getUniqueId()); - player.sendDebugShape(this); + player.sendDebugShape(static_cast(*this)); } /** * @brief Removes the player from this debug shape causing it to be removed from the player's screen. * @param player the player to remove. */ - void removePlayer(const Player &player) + void removePlayer(Player &player) { players_.erase(player.getUniqueId()); - player.removeDebugShape(this); + player.removeDebugShape(static_cast(*this)); } /** @@ -157,14 +157,14 @@ class DebugShape { DebugShapeId id_; std::optional> position_; std::optional color_; - std::unordered_set players_; + mutable std::unordered_set players_; void onChange() const { for (const auto &player : getPlayers()) { - player->sendDebugShape(this); + player->sendDebugShape(static_cast(*this)); } } }; -} // namespace endstone \ No newline at end of file +} // namespace endstone diff --git a/include/endstone/player.h b/include/endstone/player.h index e75031719..3a5781848 100644 --- a/include/endstone/player.h +++ b/include/endstone/player.h @@ -21,12 +21,6 @@ #include "endstone/form/action_form.h" #include "endstone/form/message_form.h" #include "endstone/form/modal_form.h" -#include "endstone/debugshape/debug_arrow.h" -#include "endstone/debugshape/debug_box.h" -#include "endstone/debugshape/debug_circle.h" -#include "endstone/debugshape/debug_line.h" -#include "endstone/debugshape/debug_sphere.h" -#include "endstone/debugshape/debug_text.h" #include "endstone/game_mode.h" #include "endstone/inventory/player_inventory.h" #include "endstone/offline_player.h" @@ -37,6 +31,13 @@ namespace endstone { +class DebugArrow; +class DebugBox; +class DebugCircle; +class DebugLine; +class DebugSphere; +class DebugText; + /** * @brief Represents a player. */