šŸ”‘ PermissionsEx v2.0 [API 5]

Update: Updated to the latest PEX build (#121). Didnt work still so I went off a working config from a backup AGAIN. It works now

Getting an error with Dense Ores version 2.0 for minecraft 1.8.9 when trying to break one of the blocks it messes with the permissions for a bit. here is a snippet of the logs. http://pastebin.com/BcnbT4Tx

Uh Iā€™m pretty sure that has nothing to do with PEX. More likely to be a bug in either Sponge or Dense Ores.

Thereā€™s an open issue here: Error executing task java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException Ā· Issue #580 Ā· SpongePowered/SpongeForge Ā· GitHub

Thanks, found it earlier after seeing zmlā€™s respone

I read somewhere that the console needs to be given permission to run commands and have 2 questions:

  1. First of all, why? Are you worried the person who owns a given server computer might be a spy for another server or something?
  2. Second of all, how do I actually give the console permission, assuming itā€™s still necessary?

Thatā€™s not exactly true. The way it works is that the console is just a command sender like any other (player, command block, rcon console, etc). Therefore, plugins check permissions. Now normally, Sponge has the console permissions configured so that if the permissions plugin returns no result for a permission, the console is granted that permission, so generally the console has all permissions.

The difficulty is that there are some ways to accidentally explicitly deny all permissions to the console. When this happens, the console no longer has all permissions. However, normally this wonā€™t happen.

basically tl;dr 1. because we donā€™t stop it, 2. itā€™s not necessary.

Okay, fair enough. I figured it was something like that, although I felt compelled to ask because it seems a little strange still.
Anyway, moving on, I also noticed that, by default, permissions.json apparently gives permission to anything in the context ā€œlocalipā€: ā€œ127.0.0.1ā€. I assume this means anything on the local computer, and that this is to ensure that the console has permission, right? Or am I completely confused because Iā€™m so tired or something LOL?

That affects players and is designed to help with small servers/lan servers so the player connecting from the same computer as the server can automatically manage things ingame. The console defaulting is built into Sponge (so it will apply to any permissions plugin)

1 Like

Hello.

I still not familiar with subjects and methods to get perms info from player :frowning:

How is the code to i get the group the player is, using my plugin? Can be with or without PEX, i only need to get te group, and set the group of player.

I making a rank plugin and i only need this to finish the plugin!
Thanks.

Donā€™t understand what youā€™re trying to say, but this might help

@SnowBlitzz lolno

Thatā€™s all exposed within Spongeā€™s permissions API. player.getParents() returns all parents (not necessarily just groups) of a player in the current context, player.getSubjectData().addParent(contexts, parent); (SubjectData is the raw data, Subject calculates context combinations and inheritance ā€“ so for editing you probably want to work with player.getSubjectData()). To get groups objects to add, you want to get the group Subject with permissionService.getGroupSubjects().get(groupName)

2 Likes

Thanks, i got the player group with

player.getParents().get(0).getIdentifier()

But i dont know how to get all groups to compare if that identifier is a group(may have other thinks on ā€œparentsā€).
And i dont know how to set the group of player.

I tryed to use

player.getParents().set(0, "Visitor");

But the ā€œVisitorā€ need to be a Subject :frowning: How to create a new Subject?


I dont know how to get

permissionService.getGroupSubjects().get(groupName)

to work. permissionService dont have any method.

permissionService is an instance of PermissionService, gotten from the Gameā€™s ServiceManager.

player.getParents().get(0).getContainingCollection().equals(permissionService.getGroupSubjects()) will evaluate to true if the parent is a group (make sure to do size checks as well so that users with no parents are handled as well.

pService.getGroupSubjects().get(ā€œVisitorā€) would get you a Subject for the visitor group. Also the parents list returned is immutable, so you want to work through the SubjectData (player.getSubjectData() to modify parents).

1 Like

Thank you! This helped me to prevent errors on get the group if the players have other settings on parents :smiley:

I have a problemā€¦ you can see in my file, that the owner is alone with all permissions allowed. But once i change something at the Player Permissions like ā€œessentialcmds.clearinventoryā€: -1, then the Owner also cant use itā€¦ whats wrong ?

same here. everything seems to affect the owner

That is by design. The default group applies to every user, even those in the Owner group as well. Since essentialcmds.clearinventory is more specific than the default permission, and both have the same weight (1), the essentialcmds.clearinventory permission takes effect. To counteract this, you can increase the weight of the owner default to 2 ā€“ so /pex group Owner def 2, which will then override the negation.

1 Like

Thanks you very much :smiley: helped me alot

How admit to edit command block?