cRankManager:GetPlayerPermissions(UUID) returns empty array seemingly always.
#1
I was testing out cRankManager:GetPlayerPermissions(UUID), seeing how it returned the *, when I found out it returned... literally nothing. So I tried it out with non-admin groups, and it continued to return nothing. So I tried a different, imperfect method to replicate it. Code and outputs below.

The Code:
function Initialize(a_Plugin)
	a_Plugin:SetName("cRankManagerTest")
	a_Plugin:SetVersion(1)
  
	cPluginManager:BindCommand("/ranky", "a.b", ranksCommand, "")
	
	-- Send a message to the console that Chatter is initialized.
	LOG("Initialized cRankManagerTest v." .. a_Plugin:GetVersion())
	return true
end

function OnDisable()
	LOG("cRankManagerTest is disabled")
end

function ranksCommand(a_split,a_player)
  local UUID = a_player:GetUUID()
  LOG("======================")
  LOG(UUID)
  LOG(a_player:GetName())
  local arr = cRankManager:GetPlayerPermissions(UUID)
  LOG(table.concat(arr,", "))
  local str = ""
  for _,v in pairs(arr) do
    str = str == "" and str .. v or str .. ", " .. v
  end
  LOG(#arr)
  LOG(str)
  LOG("___________________")
  local str2 = ""
  local arr2 = cRankManager:GetPlayerGroups(UUID)
  LOG(#arr2)
  for _,v1 in ipairs(arr2) do
    local arr3 = cRankManager:GetGroupPermissions(v1)
    LOG(#arr3)
    for _,v2 in ipairs(arr3) do

      str2 = str2 == "" and str2 .. v2 or str2 .. ", " .. v2
    end
  end
  LOG(str2)
  LOG("___________________")
  return true
end

No rank assigned:
[15:31:42] ======================
[15:31:42] 3bb504d5e15147dcb104c620315dd5e3
[15:31:42] ZeeTwelveCam
[15:31:42]
[15:31:42] 0
[15:31:42]
[15:31:42] ___________________
[15:31:42] 0
[15:31:42]
[15:31:42] ___________________

Rank assigned:
[15:33:13] ======================
[15:33:13] 3bb504d5e15147dcb104c620315dd5e3
[15:33:13] ZeeTwelveCam
[15:33:13]
[15:33:13] 0
[15:33:13]
[15:33:13] ___________________
[15:33:13] 1
[15:33:13] 1
[15:33:13] *
[15:33:13] ___________________

and for reference:

[15:34:01] ======================
[15:34:01] 3bb504d5e15147dcb104c620315dd5e3
[15:34:01] ZeeTwelveCam
[15:34:01]
[15:34:01] 0
[15:34:01]
[15:34:01] ___________________
[15:34:01] 1
[15:34:01] 2
[15:34:01] core.build, a.b
[15:34:01] ___________________

So did I do something wrong? I currently don't have a way to compile a debug build, so can't provide any information that might give.
Reply
Thanks given by:
#2
I think GetUUID Is wrong here. @line 17 here (maybe I'm wrong but this one has a very bad documentation)

GetUUID gets the official mojang UUID which is unique per player.
GetUniqueID gets unique ID which is unique per player AND online being. Only for cuberite (internal)
If you leave and reconnect, GetUUID is still the same but GetUniqueID returns another value.

The no logical way to veg the answer, just try both
Reply
Thanks given by:
#3
Documentation specifically states that you use UUID, not UniqueID.

Either way though, I tested it. No errors, but no list in any of the 4 parts, so no, that's not how it works.
Reply
Thanks given by:
#4
I find the documentation to be really on point. GetUniqueID returns the ID within the server that identifies all entities. (btw, that ID is also needed for the client, since they also have to identify the entity as well). GetUUID returns the ID that Mojang created, or Cuberite generated in case the server is running in offline mode.

Could you look at what GetUUID returns? Also, perhaps you could try GetGroupPermissions on a specific group, just to see if it returns what you expect it to return.
Reply
Thanks given by:
#5
Added on

LOG(table.concat(cRankManager:GetGroupPermissions("Default").", "))

And it worked as expected. Also, the return of GetUUID is printed into the logs above as the string of letters and characters.
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)