Not sure if this is the right section to ask, but i have a mod made with Forge and i added the PermissionsEx API to check if the player has a permission. But for some reason it looks like the API doesn’t work (or perhaps it always say that a player hasn’t a permission while in the json file he have it). What i’m doing right now is this in Forge
So basically i send a message to the player saying if he has that permission, but it always return false (as he doesn’t). Am i checking it wrong or it’s just that a mod can’t communicate with a sponge plugin?
It’s all one big JVM. Forge has no say in what can ‘communicate’ with it, nor does sponge. It’s all just classes and methods. The correct answer is that you are doing it wrong. Are you sure this code is even called?
Also, just use the Sponge permission API. player.hasPermission(String)
In sponge i can check the permission correctly. The problem is that i had to check it in Forge, not in Sponge. And yes, the code is called as the message is displayed correctly
You need to have sponge added as a library. Although, if you’re already building against PEX, not sure why it wouldn’t be, unless you’re not using a build system.
Wich is what i’ve done, i’ve downloaded the sponge api jar and included into eclipse. The jar i’m using is the spongeapi-5.0.0-shaded.jar
EDIT: in fact i understand that using pex api is useless, so i’m trying to use the sponge api directly but as i said when compiling i got that errore, event if the api jar is in the referenced libraries
Also, I understood that part perfectly. What I don’t know is why you need the PEX API and not the Sponge one. PEX didn’t invent permissions, it just provides an implementation for what’s already there.
$ git clone [email protected]:SpongePowered/SpongeAPI.git
Cloning into 'SpongeAPI'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
First of all, I don’t bother with the SSH-style format. I just use https://github.com/SpongePowered/SpongeAPI.git.
Second, that’s a description of how to download, set up, and compile it yourself. That is not a description of how to use a build system for a project of your own.
Meanwhile, Eclipse is to development what McAfee is to antivirus (or what Internet Explorer 9 is to web browsing)
To create a permission node in Forge to use in Sponge simply use player.canCommandSenderUseCommand(4, "some.perm.node");
My issue to add this to the docs is still open, i will have to revisit it so that the next person gets a simple link