2727namespace endstone {
2828
2929namespace debugshape_internal {
30- // Decreases from the maximum value to avoid conflicts with sapi's id allocation
31- inline std::atomic id_counter{UINT64_MAX};
30+ // Decreases from the maximum value to avoid conflicts with sapi's id allocation
31+ inline std::atomic id_counter{UINT64_MAX};
3232} // namespace debugshape_internal
3333
3434/* *
@@ -107,20 +107,20 @@ class DebugShape {
107107 * @brief Adds the player to this debug shape causing it to display on the player's screen.
108108 * @param player the player to add.
109109 */
110- void addPlayer (const Player &player)
110+ void addPlayer (Player &player)
111111 {
112112 players_.emplace (player.getUniqueId ());
113- player.sendDebugShape (this );
113+ player.sendDebugShape (static_cast < const T &>(* this ) );
114114 }
115115
116116 /* *
117117 * @brief Removes the player from this debug shape causing it to be removed from the player's screen.
118118 * @param player the player to remove.
119119 */
120- void removePlayer (const Player &player)
120+ void removePlayer (Player &player)
121121 {
122122 players_.erase (player.getUniqueId ());
123- player.removeDebugShape (this );
123+ player.removeDebugShape (static_cast < const T &>(* this ) );
124124 }
125125
126126 /* *
@@ -157,14 +157,14 @@ class DebugShape {
157157 DebugShapeId id_;
158158 std::optional<Vector<float >> position_;
159159 std::optional<Color> color_;
160- std::unordered_set<UUID> players_;
160+ mutable std::unordered_set<UUID> players_;
161161
162162 void onChange () const
163163 {
164164 for (const auto &player : getPlayers ()) {
165- player->sendDebugShape (this );
165+ player->sendDebugShape (static_cast < const T &>(* this ) );
166166 }
167167 }
168168};
169169
170- } // namespace endstone
170+ } // namespace endstone
0 commit comments