From f4c04299961a96e153bf50e2e1fb92c8f9db77f5 Mon Sep 17 00:00:00 2001 From: Simon Pribylski <66266021+Persson-dev@users.noreply.github.com> Date: Mon, 24 Jan 2022 21:24:55 +0100 Subject: Add player permission level (#5358) --- src/ClientHandle.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/ClientHandle.cpp') diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index c2135777b..cd7de10dc 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -459,6 +459,10 @@ void cClientHandle::FinishAuthenticate() // Return a server login packet: m_Protocol->SendLogin(*m_Player, *World); + // Send the player's permission level. + // The key effect is to allow 1.9+ clients to open the command block UI. + SendPlayerPermissionLevel(); + if (m_Player->GetKnownRecipes().empty()) { SendInitRecipes(0); @@ -1042,7 +1046,7 @@ void cClientHandle::HandleCommandBlockBlockChange(int a_BlockX, int a_BlockY, in return; } - if ((m_Player == nullptr) || !m_Player->HasPermission("comandblock.set")) + if ((m_Player == nullptr) || !m_Player->HasPermission("cuberite.commandblock.set")) { SendChat("You cannot edit command blocks on this server", mtFailure); return; @@ -1589,7 +1593,7 @@ void cClientHandle::HandleChat(const AString & a_Message) Msg.AddTextPart(m_Player->GetName(), Color); Msg.ParseText(m_Player->GetSuffix()); Msg.AddTextPart("> "); - if (m_Player->HasPermission("chat.format")) + if (m_Player->HasPermission("cuberite.chat.format")) { Msg.ParseText(Message); } @@ -2880,6 +2884,15 @@ void cClientHandle::SendPlayerMoveLook(void) +void cClientHandle::SendPlayerPermissionLevel() +{ + m_Protocol->SendPlayerPermissionLevel(); +} + + + + + void cClientHandle::SendPlayerPosition(void) { m_Protocol->SendPlayerPosition(); -- cgit v1.2.3