From 54ee86872a2626e94f1d9f62fb432436f4bc54e1 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 1 Oct 2024 00:51:12 +0100 Subject: [PATCH] fix: factory function for PermissibleBase --- include/endstone/detail/permissions/permissible_base.h | 6 ++++-- src/endstone_core/permissions/permissible_base.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/endstone/detail/permissions/permissible_base.h b/include/endstone/detail/permissions/permissible_base.h index 96f78a945..eaabb27ac 100644 --- a/include/endstone/detail/permissions/permissible_base.h +++ b/include/endstone/detail/permissions/permissible_base.h @@ -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; diff --git a/src/endstone_core/permissions/permissible_base.cpp b/src/endstone_core/permissions/permissible_base.cpp index 704289e83..862683eeb 100644 --- a/src/endstone_core/permissions/permissible_base.cpp +++ b/src/endstone_core/permissions/permissible_base.cpp @@ -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 { @@ -216,7 +216,7 @@ void PermissibleBase::clearPermissions() std::shared_ptr PermissibleBase::create(Permissible *opable) { - return create0(opable); + return std::make_shared(Private(), opable); } } // namespace endstone::detail