Cuberite Forum
Noob needs help (Cannot access cMojang) - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Noob needs help (Cannot access cMojang) (/thread-1961.html)



Noob needs help (Cannot access cMojang) - Sidcode - 05-19-2015

Hey,
Im a noob in Lua so I need your help.
I try to learn lua with MC-Server.

I want to access the global "cMojang" variable in my command.
So I created a function namend uuid_Handler (just a test) where I send a message:
Code:
function uuid_Handle(Args, Player)
  Player:SendMessage("Deine UUID lautet:\n"..cMojang:GetUUIDFromPlayerName(Player:GetName(), true))
  return true;
end
The whole file is in the attachments.

The plugin is loading without errors, but when I run the command "/uuid" I get the following error:
Code:
[18:36:12] LUA: Plugins/uuidTool/main.lua:36: attempt to index global 'cMojang' (a nil value)
[18:36:12] Stack trace:
[18:36:12]   Plugins/uuidTool/main.lua(36): (no name)
[18:36:12] Stack trace end
[18:36:12] Error in plugin uuidTool calling function <callback>()

I get the same error ("attempt to index global 'GetTranslation' (a nil value)") when I want to use the GetTranslation variable from TransAPI. TransAPI is loaded and the clientfile downloaded from github is in my "Plugins" folder. But when I access the function GetTranslation it gives me the same error.

What am I doing wrong?

Greetings from Germany,
Sidcode


RE: Noob needs help (Cannot access cMojang) - LO1ZB - 05-19-2015

You can use 'Player:GetUUID()'
http://mc-server.xoft.cz/LuaAPI/cPlayer.html


RE: Noob needs help (Cannot access cMojang) - worktycho - 05-19-2015

Did you mean cMojangAPI?


RE: Noob needs help (Cannot access cMojang) - NiLSPACE - 05-19-2015

Hello and welcome to the forum

You're using cMojang, but it's actualy cMojangAPI

If you want to use the TransAPI I think you're supposed to call the functions using cPluginManager:CallPlugin. For example: cPluginManager:CallPlugin("TransAPI", "GetTranslation", ...)


RE: Noob needs help (Cannot access cMojang) - bearbin - 05-19-2015

I should have fixed the transAPI client now. The way you were using it originally is the right way.

You might have to download a new version of the client from the GitHub though.


RE: Noob needs help (Cannot access cMojang) - Sidcode - 05-19-2015

Hey,
thanks for all your help!
I'll try your suggestions.

@bearbin
Thanks for updating your plugin!
One question: Do I have to create the "languages" folder in the MCServer/Plugins folder or in the MCServer/Plugins/TransAPI folder?

Greetings from Germany,
Sidcode


RE: Noob needs help (Cannot access cMojang) - bearbin - 05-19-2015

You create the "languages" folder in MCServer/Plugins/yourpluginfoldername.