Skip to content

Commit

Permalink
fix: factory function for PermissibleBase
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Sep 30, 2024
1 parent 6e45928 commit 54ee868
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions include/endstone/detail/permissions/permissible_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ namespace endstone::detail {
* Base Permissible for use in any Permissible object via proxy or extension
*/
class PermissibleBase : public Permissible {
protected:
explicit PermissibleBase(Permissible *opable);
struct Private {
explicit Private() = default;
};

public:
explicit PermissibleBase(Private, Permissible *opable);
[[nodiscard]] bool isOp() const override;
void setOp(bool value) override;
[[nodiscard]] bool isPermissionSet(std::string name) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/endstone_core/permissions/permissible_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace endstone::detail {

PermissibleBase::PermissibleBase(Permissible *opable) : opable_(opable), parent_(opable ? *opable : *this) {}
PermissibleBase::PermissibleBase(Private, Permissible *opable) : opable_(opable), parent_(opable ? *opable : *this) {}

bool PermissibleBase::isOp() const
{
Expand Down Expand Up @@ -216,7 +216,7 @@ void PermissibleBase::clearPermissions()

std::shared_ptr<PermissibleBase> PermissibleBase::create(Permissible *opable)
{
return create0<PermissibleBase>(opable);
return std::make_shared<PermissibleBase>(Private(), opable);
}

} // namespace endstone::detail

0 comments on commit 54ee868

Please sign in to comment.