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

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?

adding groups that are child and parent to a ladder will not work, is this also intended?

why does everytime i wan to run PEX on my server it says its a ā€˜non-mod fileā€™

[07:58:46] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[07:58:46] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[07:58:46] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker
[07:58:49] [main/INFO] [FML]: Forge Mod Loader version 11.15.1.1847 for Minecraft 1.8.9 loading
[07:58:49] [main/INFO] [FML]: Java is Java HotSpotā„¢ 64-Bit Server VM, version 1.8.0_91, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_91
[07:58:49] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[07:58:49] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[07:58:49] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[07:58:49] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[07:58:49] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[07:58:51] [main/INFO] [FML]: Found valid fingerprint for Minecraft Forge. Certificate fingerprint e3c3d50c7c986df74c645c0ac54639741c90a557
[07:58:51] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[07:58:51] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[07:58:52] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[07:58:52] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[07:58:52] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[07:58:59] [Server thread/INFO]: Starting minecraft server version 1.8.9
[07:59:00] [Server thread/INFO] [FML]: MinecraftForge v11.15.1.1847 Initialized
[07:59:00] [Server thread/INFO] [FML]: Replaced 204 ore recipies
[07:59:00] [Server thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer
[07:59:00] [Server thread/INFO] [FML]: Searching F:\New LapTop File\Minecraft Things\The UniCrafters Community Server - Copy\mods for mods
[07:59:00] [Server thread/INFO] [FML]: Also searching F:\New LapTop File\Minecraft Things\The UniCrafters Community Server - Copy\mods\1.8.9 for mods
[07:59:01] [Server thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
[07:59:02] [Server thread/INFO] [FML]: FML has found a non-mod file PermissionsEx-Sponge.jar in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.
[07:59:02] [Server thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, Baubles] at CLIENT
[07:59:02] [Server thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, Baubles] at SERVER
[07:59:02] [Server thread/INFO] [FML]: Processing ObjectHolder annotations
[07:59:02] [Server thread/INFO] [FML]: Found 384 ObjectHolder annotations
[07:59:03] [Server thread/INFO] [FML]: Identifying ItemStackHolder annotations
[07:59:03] [Server thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[07:59:03] [Server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[07:59:03] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[07:59:03] [Server thread/INFO] [FML]: Applying holder lookups
[07:59:03] [Server thread/INFO] [FML]: Holder lookups applied
[07:59:03] [Server thread/INFO] [FML]: Injecting itemstacks
[07:59:03] [Server thread/INFO] [FML]: Itemstack injection complete
[07:59:03] [Server thread/INFO]: Loading properties
[07:59:03] [Server thread/INFO]: Default game type: SURVIVAL
[07:59:03] [Server thread/INFO]: Generating keypair
[07:59:03] [Server thread/INFO]: Starting Minecraft server on 192.168.0.109:55555
[07:59:03] [Server thread/INFO]: Using default channel type
[07:59:03] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[07:59:03] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[07:59:03] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[07:59:03] [Server thread/WARN]: To change this, set ā€œonline-modeā€ to ā€œtrueā€ in the server.properties file.
[07:59:04] [Server thread/INFO] [FML]: Injecting itemstacks
[07:59:04] [Server thread/INFO] [FML]: Itemstack injection complete
[07:59:04] [Server thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
[07:59:04] [Server thread/INFO]: Preparing level ā€œworldā€
[07:59:04] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance
[07:59:04] [Server thread/INFO] [FML]: Applying holder lookups
[07:59:04] [Server thread/INFO] [FML]: Holder lookups applied
[07:59:05] [Server thread/INFO] [FML]: Loading dimension 0 (world) (net.minecraft.server.dedicated.DedicatedServer@1fe3adff)
[07:59:05] [Server thread/INFO] [FML]: Loading dimension 1 (world) (net.minecraft.server.dedicated.DedicatedServer@1fe3adff)
[07:59:05] [Server thread/INFO] [FML]: Loading dimension -1 (world) (net.minecraft.server.dedicated.DedicatedServer@1fe3adff)
[07:59:05] [Server thread/INFO]: Preparing start region for level 0
[07:59:06] [Server thread/INFO]: Preparing spawn area: 48%
[07:59:07] [Server thread/INFO]: Done (2.842s)! For help, type ā€œhelpā€ or ā€œ?ā€
[07:59:07] [Server thread/INFO]: Starting GS4 status listener
[07:59:07] [Query Listener #1/INFO]: Query running on 192.168.0.109:25565

You need to have Sponge installed.

still the same and i still canā€™t use /pex
btw can you use PEX commands from commands?

Is there a sponge version specific wiki page? I was also wondering if there was any way to split the permissions file with the ranks against what permissions etc. and the users file with users against ranks?

1 Like