Minestom icon indicating copy to clipboard operation
Minestom copied to clipboard

implement other permission system

Open Jenya705 opened this issue 3 years ago • 2 comments

This PR adds the new permission system. You can register permission and verify them for specific CommandSender.

Register permission:

MinecraftServer.getPermissionManager().registerPermission(new Permission(
    "some.permission", // Permission name
    PermissionDefault.TRUE // Default behaviour of permission (TRUE, OP, OP(level) or create new using predicate)
));

Verify permission:

Player player;
boolean hasPermission = player.hasPermission("some.permission")

or

Player player;
boolean hasPermission = MinecraftServer.getPermissionManager().verify(player, "some.permission");

It is easy to change permission manager realisation using setter in MinecraftServer or ServerProcess

Jenya705 avatar Jan 07 '22 10:01 Jenya705

Such change should be discussed with contributors first. The current proposal add unnecessary (and unsafe) mutability, lack thread safety, expose more than required, and remove support for entity permission.

TheMode avatar Jan 07 '22 10:01 TheMode

I combined old permission system and this permission system. PermissionManager in ServerProcess is final.

And maybe fix thread safety

Jenya705 avatar Jan 07 '22 15:01 Jenya705

Closed due to mass conflicts. Feel free to reopen and fix them.

KrystilizeNevaDies avatar Mar 30 '23 00:03 KrystilizeNevaDies