Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions include/endstone/debugshape/debug_shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down Expand Up @@ -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<const T &>(*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<const T &>(*this));
}

/**
Expand Down Expand Up @@ -157,14 +157,14 @@ class DebugShape {
DebugShapeId id_;
std::optional<Vector<float>> position_;
std::optional<Color> color_;
std::unordered_set<UUID> players_;
mutable std::unordered_set<UUID> players_;

void onChange() const
{
for (const auto &player : getPlayers()) {
player->sendDebugShape(this);
player->sendDebugShape(static_cast<const T &>(*this));
}
}
};

} // namespace endstone
} // namespace endstone
13 changes: 7 additions & 6 deletions include/endstone/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -37,6 +31,13 @@

namespace endstone {

class DebugArrow;
class DebugBox;
class DebugCircle;
class DebugLine;
class DebugSphere;
class DebugText;

/**
* @brief Represents a player.
*/
Expand Down