LuckPerms

LuckPerms

41.4k Downloads

Add luckperms.asroot

sgdc3 opened this issue · 6 comments

commented

It would be interesting to add a permission that makes user "like" ops (player.isOp() returns true).

commented

The only use case I can think of for this is if you wanted a player to be op, but not inherit op permissions from Bukkit?

The only way to achieve this (afaik) would be to implement PermissibleBase and inject it into the server. I'm trying to keep reflection to an absolute minimum. Currently, I just replace the permission map in the LuckPerms attachment, and no more than that. (See: https://github.com/lucko/LuckPerms/blob/master/bukkit/src/main/java/me/lucko/luckperms/BukkitListener.java#L78)

It seems like overkill to do that much reflection for one simple feature. It's not so pretty.
https://github.com/weaondara/BungeePerms/blob/master/src/main/java/net/alpenblock/bungeeperms/platform/bukkit/Injector.java
https://github.com/PEXPlugins/PermissionsEx/blob/master/permissionsex-bukkit/src/main/java/ninja/leaping/permissionsex/bukkit/PermissibleInjector.java

You also have to completely re-implement all of the magic with default/wildcard/parent/child permissions that Bukkit does behind the scenes.

Also, I don't really see the use case? I guess some plugins check ServerOperator#isOp instead of using permission nodes? If that's the case, an auto-op plugin would best serve that purpose IMO. (check for permission on login, call Player#setOP(true) if they have the permission, and deop on quit) In the past, where I've needed to get OP status to sync across a network, I've just used that approach.

Maybe I've overlooked something? Let me know what you think. 😄

commented

Possible scenario: i want to give op to an admin only for x minutes or only in a certain world

commented

Ok, sounds realistic. I over-thought my last response, I was trying to workout why you'd need it - my initial reaction was for being op, but not inheriting op permissions, which is why I went on about reflection. Turns out that's just me being a derp, so ignore that.

Ok, so, what you suggest seems simple enough.

Add a config option to set LuckPerms to handle all OPs. Then each time a user's permissions are refreshed, we check for the presence of "luckperms.op" or whatever, and set their op status accordingly. Does that seem ok?

commented

@lucko It sounds good, the only thing you should ensure is to flush the op list on startup to avoid accidents.

commented

Sure - that's actually added already. https://github.com/lucko/LuckPerms/blob/master/bukkit/src/main/java/me/lucko/luckperms/LPBukkitPlugin.java#L140

I'll work on this soon; should be simple enough to add.

commented

Fine ;) Thank you for your amazing work!